# Builds the project with Java 8.

name: Java 8 build
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      coveralls_repo_token: ${{ secrets.COVERALLS_REPO_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - name: Set up JDK 8
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'

      - name: Build with Maven
        run: mvn -B --file pom.xml package jacoco:report

      - name: Coveralls
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

# Builds the project with Java 8.

name: Java 8 build
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      coveralls_repo_token: ${{ secrets.COVERALLS_REPO_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - name: Set up JDK 8
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'

      - name: Build with Maven
        run: mvn -B --file pom.xml package jacoco:report

      # Set environment variables for Coveralls. Copied from https://github.com/trautonen/coveralls-maven-plugin/issues/136
      - name: Set branch name and PR number
        id: refs
        env:
          BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }}
        run: |
          echo "::set-output name=branch_name::${BRANCH_NAME_OR_REF#refs/heads/}"
          echo "::set-output name=pr_number::$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
      - name: Coveralls Maven plugin
        env:
          CI_NAME: Github
          CI_BUILD_NUMBER: ${{ github.run_id }}
          CI_BUILD_URL: https://github.com/${{ github.repository }}/commit/${{ github.event.after }}/checks
          CI_BRANCH: ${{ steps.refs.outputs.branch_name }}
          CI_PULL_REQUEST: ${{ steps.refs.outputs.pr_number }}
        run: |
          mvn coveralls:report \
          --no-transfer-progress \
          -D repoToken=${{ secrets.COVERALLS_TOKEN }}

Revert "Try to use Coveralls action to send coverage data"
Revert "Try to use Coveralls action to send coverage data"
