Skip to content

Commit b243c6f

Browse files
Fix SonarCloud coverage: use dotnet-coverage collect with vscoveragexml format
Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
1 parent b1d3fd0 commit b243c6f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install SonarScanner for .NET
2727
run: |
2828
dotnet tool install --global dotnet-sonarscanner
29-
dotnet tool install --global dotnet-reportgenerator-globaltool
29+
dotnet tool install --global dotnet-coverage
3030
3131
- name: Restore dependencies
3232
run: dotnet restore SLNX-validator.slnx
@@ -40,16 +40,13 @@ jobs:
4040
/o:"304notmodified" \
4141
/d:sonar.token="${SONAR_TOKEN}" \
4242
/d:sonar.host.url="https://sonarcloud.io" \
43-
/d:sonar.coverageReportPaths="coverage/SonarQube.xml"
43+
/d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml"
4444
4545
- name: Build
4646
run: dotnet build SLNX-validator.slnx --no-restore -c Release
4747

4848
- name: Test with coverage
49-
run: dotnet test --solution SLNX-validator.slnx --no-build -c Release --verbosity normal -- --coverage --coverage-output-format cobertura
50-
51-
- name: Convert coverage to SonarQube format
52-
run: reportgenerator -reports:"**/TestResults/**/*.cobertura.xml" -targetdir:coverage -reporttypes:SonarQube
49+
run: dotnet-coverage collect "dotnet test --solution SLNX-validator.slnx --no-build -c Release --verbosity normal" -f xml -o coverage.xml
5350

5451
- name: End SonarCloud analysis
5552
env:

0 commit comments

Comments
 (0)