Merge pull request #839 from ascopes/task/codecov-v5-action #2595
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
pull_request: | |
branches: | |
- main | |
- v* | |
push: | |
branches: | |
- main | |
- v* | |
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: | |
- 17 # LTS | |
- 21 # LTS | |
- 25 # LTS | |
include: | |
- os-name: windows-11-arm | |
java-version: 25 # LTS | |
- os-name: macos-latest | |
java-version: 25 # LTS | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 2 | |
- name: Initialize Zulu JDK | |
uses: actions/setup-java@v5 | |
with: | |
check-latest: true | |
distribution: zulu | |
java-version: ${{ 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@v5 | |
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 | |
notify-coverage: | |
name: Notify of coverage | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
needs: | |
- build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- 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 |