Skip to content

Commit 8331de5

Browse files
committed
SonarQube adjustments.
1 parent 46f0da7 commit 8331de5

File tree

2 files changed

+56
-7
lines changed

2 files changed

+56
-7
lines changed

.github/workflows/main-fe.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ jobs:
3030

3131
steps:
3232
- 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 }}
4033

4134
- name: 🏗 Setup Node.js
4235
uses: actions/setup-node@v4

.github/workflows/sonar.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 }}

0 commit comments

Comments
 (0)