-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (54 loc) · 1.54 KB
/
code-analyze-sonarqube.yml
File metadata and controls
64 lines (54 loc) · 1.54 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Code Analyze With SonarQube
run-name: Run code analyze triggered by ${{github.actor}}
on:
workflow_dispatch:
# pull_request:
# types: [opened, reopened, synchronize]
# branches:
# - main
# - dev
# paths:
# - 'src/**'
# push:
# branches:
# - main
# - dev
# paths:
# - 'src/**'
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build with tests
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
continue-on-error: true
run: ./gradlew build --info
- name: SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: ./gradlew sonar --info