77 - " src/**"
88 - " tests/**"
99 - " **/*.props"
10+ - " **/packages.lock.json"
11+ - " .config/dotnet-tools.json"
1012 - " global.json"
1113 - " .github/workflows/sonar.yml"
1214 pull_request :
1517 paths :
1618 - " src/**"
1719 - " tests/**"
20+ - " **/*.props"
21+ - " **/packages.lock.json"
22+ - " .config/dotnet-tools.json"
1823 - " global.json"
1924 - " .github/workflows/sonar.yml"
2025 workflow_dispatch :
3439 uses : actions/setup-dotnet@v5
3540 with :
3641 global-json-file : ./global.json
42+ cache : true
43+ cache-dependency-path : " **/packages.lock.json"
3744 - name : Set up JDK
3845 uses : actions/setup-java@v5
3946 with :
@@ -52,30 +59,26 @@ jobs:
5259 path : .\.sonar\scanner
5360 key : ${{ runner.os }}-sonar-scanner
5461 restore-keys : ${{ runner.os }}-sonar-scanner
55- - name : Install SonarCloud scanner
56- if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
57- shell : powershell
58- run : |
59- New-Item -Path .\.sonar\scanner -ItemType Directory
60- dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
61- - name : Install dotnet-coverage tool
62+ - name : Install dotnet-coverage & dotnet-sonarscanner
6263 run : |
63- dotnet tool install --global dotnet-coverage
64+ dotnet tool restore dotnet-coverage
6465 - name : Build and analyze with coverage
6566 env :
6667 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
68+ USE_MOCK_SERVER : ${{ vars.USE_MOCK_SERVER }}
6769 shell : powershell
6870 run : |
6971 # Start SonarCloud analysis
7072 .\.sonar\scanner\dotnet-sonarscanner begin `
7173 /k:"Tsingis_bitcoin-web-api" `
7274 /o:"tsingis" `
73- /d:sonar.token="${{ secrets .SONAR_TOKEN }}" `
75+ /d:sonar.token="${{ env .SONAR_TOKEN }}" `
7476 /d:sonar.host.url="https://sonarcloud.io" `
7577 /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" `
7678 /d:sonar.scanner.scanAll=false `
7779 /d:sonar.exclusions="global.json"
78- dotnet build --no-incremental
79- dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
80+ dotnet restore --locked-mode
81+ dotnet build --no-restore
82+ dotnet-coverage collect "dotnet test --no-restore --no-build" -f xml -o "coverage.xml"
8083 .\.sonar\scanner\dotnet-sonarscanner end `
81- /d:sonar.token="${{ secrets .SONAR_TOKEN }}"
84+ /d:sonar.token="${{ env .SONAR_TOKEN }}"
0 commit comments