From d4dba4a62b145e59bc1889fde34f8b9c8930a2bd Mon Sep 17 00:00:00 2001 From: Ashley Scopes <73482956+ascopes@users.noreply.github.com> Date: Sun, 26 Jan 2025 12:06:40 +0000 Subject: [PATCH 1/2] Defer coverage reports to the end of the CI pipeline Applies the new functionality in https://github.com/codecov/codecov-action/issues/1436 to be able to defer reporting coverage until the entire pipeline has uploaded coverage reports. This reduces noise in pull request logs. --- .github/workflows/build-ea.yml | 72 ---------------------------------- .github/workflows/build.yml | 35 ++++++++++++++++- codecov.yml | 23 ++++++----- 3 files changed, 45 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/build-ea.yml diff --git a/.github/workflows/build-ea.yml b/.github/workflows/build-ea.yml deleted file mode 100644 index a0ca0ba4a..000000000 --- a/.github/workflows/build-ea.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build Latest - -on: - pull_request: - branches: - - main - push: - branches: - - main - workflow_call: {} - workflow_dispatch: {} - -jobs: - build: - name: Build on JDK ${{ matrix.java-version }} (${{ matrix.os-name }}) - runs-on: ${{ matrix.os-name }} - - strategy: - fail-fast: false - matrix: - os-name: [ubuntu-latest] - java-version: - - GA # Latest GA JDK - - EA # Current Mainline - include: - - os-name: macos-latest - java-version: GA - - os-name: windows-latest - java-version: GA - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Initialize JDK - uses: oracle-actions/setup-java@v1 - with: - website: jdk.java.net - release: ${{ matrix.java-version }} - - - name: Maven cache - uses: actions/cache@v4 - env: - cache-name: maven-cache - with: - path: - ~/.m2 - key: build-${{ env.cache-name }} - - - name: Compile and run tests - shell: bash - run: ./mvnw -B -U clean verify - - - name: Upload to codecov - uses: codecov/codecov-action@v4 - with: - name: tests-java-${{ matrix.java-version }}-os-${{ matrix.os-name }} - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Stash reports - uses: actions/upload-artifact@v4 - if: always() - with: - name: reports-${{ matrix.java-version }}-${{ matrix.os-name }} - if-no-files-found: error - path: | - **/surefire-reports/** - **/failsafe-reports/** - **/build*.log - retention-days: 30 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c376e7ac9..6bf8b6c90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,19 +23,33 @@ jobs: - 11 # LTS - 17 # LTS - 21 # LTS + - GA # General access + include: + - os-name: ubuntu-latest + java-version: GA + - os-name: macos-latest + java-version: GA steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 2 - - name: Initialize JDK + - name: Initialize Zulu JDK + if: matrix.java-version != 'GA' uses: actions/setup-java@v4 with: check-latest: true distribution: zulu java-version: ${{ matrix.java-version }} + - name: Initialize Oracle JDK + if: matrix.java-version == 'GA' + uses: oracle-actions/setup-java@v1 + with: + website: jdk.java.net + release: ${{ matrix.java-version }} + - name: Maven cache uses: actions/cache@v4 env: @@ -66,3 +80,22 @@ jobs: **/failsafe-reports/** **/build*.log retention-days: 30 + + notify-coverage: + name: Notify of coverage + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: + - build + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Publish code coverage + uses: codecov/codecov-action@v5 + continue-on-error: true + if: always() + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + run_command: send-notifications diff --git a/codecov.yml b/codecov.yml index a369cc601..d65988b63 100644 --- a/codecov.yml +++ b/codecov.yml @@ -15,22 +15,21 @@ # # General behaviour. +coverage: + round: up + precision: 2 + codecov: - branch: main - max_report_age: 12 + notify: + # Notify via a separate pipeline step in CI once all builds have completed. This way, we don't + # report coverage after each parallel build completes, which results in spammy and incorrect + # email notifications and prematurely marking the build as having failed. + # https://github.com/codecov/codecov-action/issues/1436#issuecomment-2614065472 + manual_trigger: true require_ci_to_pass: true strict_yaml_branch: main -# PR comment format. comment: layout: "reach, diff, flags, files" behavior: default - require_changes: false - require_base: true - require_head: true - -# Global coverage options. -coverage: - precision: 2 - range: "10...100" - round: down + require_changes: true From 076a5a11fd264cb4f77d848b04edec962d588c3e Mon Sep 17 00:00:00 2001 From: Ashley <73482956+ascopes@users.noreply.github.com> Date: Thu, 30 Jan 2025 20:46:39 +0000 Subject: [PATCH 2/2] Update codecov.yml Signed-off-by: Ashley <73482956+ascopes@users.noreply.github.com> --- codecov.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index d65988b63..ee1f3cd04 100644 --- a/codecov.yml +++ b/codecov.yml @@ -32,4 +32,3 @@ codecov: comment: layout: "reach, diff, flags, files" behavior: default - require_changes: true