43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
name: SonarQube Code Quality Scan
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
jobs:
|
|
scan:
|
|
runs-on: windowsx64
|
|
steps:
|
|
- name: Checkout Code (Gitea Direct)
|
|
run: |
|
|
git clone https://git.we965.cn/learning/VectorDBDemo.git .
|
|
git fetch --depth=0
|
|
git checkout ${{ github.ref_name }}
|
|
|
|
- name: Add Sonar Scanner to PATH
|
|
run: |
|
|
$scannerPath = "D:\Paths\sonar-scanner-cli\bin"
|
|
echo "$scannerPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
|
|
|
- name: Verify .NET SDK (Local)
|
|
run: |
|
|
dotnet --list-sdks
|
|
dotnet --version
|
|
|
|
- name: Build .NET Project
|
|
run: |
|
|
dotnet restore
|
|
dotnet build --configuration Release
|
|
|
|
# 修复语法后的扫描步骤
|
|
- name: Run SonarQube Scan
|
|
run: |
|
|
sonar-scanner `
|
|
-Dsonar.projectKey=squ_ace35d06f649f2e7f982d243b8b41294cf9a0861 `
|
|
-Dsonar.sources=./ `
|
|
-Dsonar.host.url=http://127.0.0.1:9000 `
|
|
-Dsonar.login=${{ secrets.SONAR_TOKEN }} `
|
|
-Dsonar.language=csharp `
|
|
-Dsonar.dotnet.build.directory=./**/bin/Release `
|
|
-Dsonar.exclusions=**/obj/**,**/bin/Debug/** `
|
|
-Dsonar.coverage.exclusions=**/Test/**,**/*.Tests.cs |