-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.91 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
61
62
63
64
65
66
67
68
name: Java CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
matrix-build:
name: Build and test with Java ${{ matrix.java }}
permissions:
contents: read
strategy:
matrix:
java: ['17', '21']
env:
DEFAULT_JAVA: '17'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.java }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-sonar-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Enable testcontainer reuse
run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties"
- name: Build with Java ${{ matrix.java }} without integration tests
run: ./gradlew clean build --info --exclude-task integrationTest -PjavaVersion=${{matrix.java}}
- name: Build with Java ${{ matrix.java }} with integration tests
if: ${{ env.DEFAULT_JAVA == matrix.java }}
run: ./gradlew build --info -PjavaVersion=${{matrix.java}}
- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: ./gradlew sonar --info --exclude-task integrationTest -Dsonar.token=$SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build:
name: Build and test with all Java versions
needs: matrix-build
runs-on: ubuntu-latest
continue-on-error: false
steps:
- run: echo Build successful