-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (48 loc) · 1.34 KB
/
build.yaml
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
name: Build and verify
on:
pull_request:
push:
branches: [ master ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- jdk: 11.0.16
sonarEnabled: true
- jdk: 17.0.4
sonarEnabled: false
steps:
- name: Check out code
uses: actions/[email protected]
with:
# Fetch entire history for SonarCloud analysis.
fetch-depth: 0
- name: Set up JDK
uses: actions/[email protected]
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Cache SonarCloud packages
if: ${{ matrix.sonarEnabled }}
uses: actions/[email protected]
with:
path: "${HOME}/.sonar/cache"
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Display build environment details
run: mvn --version
- name: Build project
run: mvn -T1C install
- name: Perform SonarCloud analysis
if: ${{ matrix.sonarEnabled }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn sonar:sonar
- name: Remove installed project artifacts
run: mvn build-helper:remove-project-artifact