-
Notifications
You must be signed in to change notification settings - Fork 4
49 lines (42 loc) · 1.53 KB
/
Copy pathsonar_jdk17_ubuntu.yml
File metadata and controls
49 lines (42 loc) · 1.53 KB
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
name: SonarCloud analysis with JDK 17 on Ubuntu
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch: {}
# cancel superseded runs on the same branch/PR to save CI minutes.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
# skip the analysis job for contributors/forks who lack the required sonar token
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v7
with:
# disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up JDKs (17 for build, 21 for sonarcloud)
uses: actions/setup-java@v6
with:
java-version: |
17
21
distribution: temurin
cache: maven
- name: Build with Maven/JDK 17, test with SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
# set java_home to jdk 21 for the sonarcloud scanner.
# bytecode remains java 17 compatible due to pom settings.
export JAVA_HOME=$JAVA_HOME_21_X64
mvn --batch-mode --file pom.xml --activate-profiles sonarcloud clean verify