File tree Expand file tree Collapse file tree 2 files changed +56
-7
lines changed Expand file tree Collapse file tree 2 files changed +56
-7
lines changed Original file line number Diff line number Diff line change 30
30
31
31
steps :
32
32
- uses : actions/checkout@v4
33
- with :
34
- fetch-depth : 0
35
-
36
- - uses : sonarsource/sonarqube-scan-action@master
37
- env :
38
- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
39
- SONAR_HOST_URL : ${{ secrets.SONAR_HOST_URL }}
40
33
41
34
- name : 🏗 Setup Node.js
42
35
uses : actions/setup-node@v4
Original file line number Diff line number Diff line change
1
+ name : SonarQube Analysis
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ workflow_dispatch :
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ - uses : actions/checkout@v4
15
+ with :
16
+ fetch-depth : 0
17
+
18
+ - name : Set up JDK 17
19
+ uses : actions/setup-java@v4
20
+ with :
21
+ java-version : 17
22
+ distribution : ' zulu'
23
+
24
+ - name : Cache SonarQube packages
25
+ uses : actions/cache@v4
26
+ with :
27
+ path : ~\.sonar\cache
28
+ key : ${{ runner.os }}-sonar
29
+ restore-keys : ${{ runner.os }}-sonar
30
+
31
+ - name : Cache SonarQube scanner
32
+ id : cache-sonar-scanner
33
+ uses : actions/cache@v4
34
+ with :
35
+ path : .\.sonar\scanner
36
+ key : ${{ runner.os }}-sonar-scanner
37
+ restore-keys : ${{ runner.os }}-sonar-scanner
38
+
39
+ - name : Install SonarQube scanner
40
+ if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
41
+ shell : powershell
42
+ run : |
43
+ New-Item -Path .\.sonar\scanner -ItemType Directory
44
+ dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
45
+
46
+ - name : Build and analyze
47
+ shell : powershell
48
+ run : |
49
+ .\.sonar\scanner\dotnet-sonarscanner begin /k:"localib" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
50
+ dotnet build backend
51
+ .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
52
+
53
+ - uses : sonarsource/sonarqube-scan-action@master
54
+ env :
55
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
56
+ SONAR_HOST_URL : ${{ secrets.SONAR_HOST_URL }}
You can’t perform that action at this time.
0 commit comments