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,23 @@ 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- run : |
63- dotnet tool install --global dotnet-coverage
62+ - name : Install tools
63+ run : dotnet tool restore
6464 - name : Build and analyze with coverage
6565 env :
6666 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
67+ USE_MOCK_SERVER : ${{ vars.USE_MOCK_SERVER }}
6768 shell : powershell
6869 run : |
69- # Start SonarCloud analysis
7070 .\.sonar\scanner\dotnet-sonarscanner begin `
7171 /k:"Tsingis_bitcoin-web-api" `
7272 /o:"tsingis" `
73- /d:sonar.token="${{ secrets .SONAR_TOKEN }}" `
73+ /d:sonar.token="${{ env .SONAR_TOKEN }}" `
7474 /d:sonar.host.url="https://sonarcloud.io" `
7575 /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" `
7676 /d:sonar.scanner.scanAll=false `
77- /d:sonar.exclusions="global.json"
78- dotnet build --no-incremental
79- dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
77+ dotnet restore --locked-mode
78+ dotnet build --no-restore
79+ dotnet-coverage collect "dotnet test --no-restore --no-build " -f xml -o "coverage.xml"
8080 .\.sonar\scanner\dotnet-sonarscanner end `
81- /d:sonar.token="${{ secrets .SONAR_TOKEN }}"
81+ /d:sonar.token="${{ env .SONAR_TOKEN }}"
0 commit comments