-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (56 loc) · 1.8 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
matrix-build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
java: [11] # 17 & 21 removed because of https://github.com/itsallcode/junit5-system-extensions/issues/68
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }}
cancel-in-progress: true
env:
DEFAULT_JAVA: 11
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: |
11
17
21
cache: maven
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build with Maven
run: mvn --errors --batch-mode clean install -Djava.version=${{ matrix.java }}
- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: mvn --errors --batch-mode -Dsonar.token=$SONAR_TOKEN org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar -Djava.version=${{ matrix.java }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"