Java CI with Maven #9
This file contains 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: Java CI with Maven | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [11, 17, 21] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
cache: maven | |
- name: Build with Maven | |
timeout-minutes: 10 | |
id: test_runner | |
run: mvn -B package --file pom.xml -Dgroups=functional | |
continue-on-error: true | |
- name: Generate test reports | |
# Only generate and upload reports if tests failed. | |
if: failure() | |
run: mvn -B surefire-report:report-only | |
# Only run upload if tests failed. | |
- name: Generate and upload test reports | |
if: steps.test_runner.outputs.status == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test reports | |
# Once SUREFIRE-2219 is finished we can upload only the html report. | |
path: | | |
tmp/html/ | |
tmp/test-results/xml/ |