-
Notifications
You must be signed in to change notification settings - Fork 3
52 lines (48 loc) · 1.32 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
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
matrix-build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17, 21]
env:
DEFAULT_JAVA: 17
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }}
cancel-in-progress: true
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'gradle'
- uses: gradle/actions/wrapper-validation@v3
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build with Gradle
run: ./gradlew build --warning-mode=all -PjavaVersion=${{ matrix.java }}
- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: ./gradlew sonar -Dsonar.token=$SONAR_TOKEN --info --warning-mode=all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"