Skip to content

Commit ccb9afe

Browse files
committed
Add SonarCloud workflow for code analysis
1 parent 47a4d79 commit ccb9afe

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/sonar.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
analyze:
13+
name: SonarCloud
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
18+
- uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v5
24+
with:
25+
dotnet-version: 10.0.x
26+
27+
- name: Install SonarScanner
28+
run: |
29+
dotnet tool install --global dotnet-sonarscanner
30+
31+
- name: Begin Sonar Analysis
32+
run: |
33+
dotnet sonarscanner begin \
34+
/k:"neozhu" \
35+
/o:"neo.zhu" \
36+
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
37+
/d:sonar.host.url="https://sonarcloud.io"
38+
39+
- name: Restore
40+
run: dotnet restore CleanArchitecture.Blazor.slnx
41+
- name: Build
42+
run: dotnet build CleanArchitecture.Blazor.slnx --configuration Debug --no-restore
43+
44+
- name: End Sonar Analysis
45+
run: |
46+
dotnet sonarscanner end \
47+
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)