-
Notifications
You must be signed in to change notification settings - Fork 161
47 lines (38 loc) · 1.17 KB
/
sonarCloud-scan.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
name: Sonar Scan
on:
push:
branches:
- 'develop'
pull_request:
branches:
- 'develop'
env:
SONAR_TOKEN_AVAILABLE: ${{ secrets.SONAR_TOKEN != '' }}
jobs:
build:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4
- name: Set up runner
uses: ./.github/actions/setUpRunner
- name: Set up Maven caches
uses: ./.github/actions/setUpMavenCaches
with:
kapua-artifact-cache-enabled: 'false'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
- name: Build and analyze
if: ${{ env.SONAR_TOKEN_AVAILABLE == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B compile -PsonarScan
- name: Skip Build and analyze
if: ${{ env.SONAR_TOKEN_AVAILABLE == 'false' }}
run: echo "Secret SONAR_TOKEN not available to this workflow run... Skipping analysis!"