Skip to content

Commit 27a134a

Browse files
Convert Cobertura to SonarQube generic coverage XML via reportgenerator
Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
1 parent fe4e000 commit 27a134a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
dotnet-version: 10.0.x
2525

2626
- name: Install SonarScanner for .NET
27-
run: dotnet tool install --global dotnet-sonarscanner
27+
run: |
28+
dotnet tool install --global dotnet-sonarscanner
29+
dotnet tool install --global dotnet-reportgenerator-globaltool
2830
2931
- name: Restore dependencies
3032
run: dotnet restore SLNX-validator.slnx
@@ -38,14 +40,17 @@ jobs:
3840
/o:"304notmodified" \
3941
/d:sonar.token="${SONAR_TOKEN}" \
4042
/d:sonar.host.url="https://sonarcloud.io" \
41-
/d:sonar.coverageReportPaths="**/TestResults/**/*.cobertura.xml"
43+
/d:sonar.coverageReportPaths="coverage/SonarQube.xml"
4244
4345
- name: Build
4446
run: dotnet build SLNX-validator.slnx --no-restore -c Release
4547

4648
- name: Test with coverage
4749
run: dotnet test --solution SLNX-validator.slnx --no-build -c Release --verbosity normal -- --coverage --coverage-output-format cobertura
4850

51+
- name: Convert coverage to SonarQube format
52+
run: reportgenerator -reports:"**/TestResults/**/*.cobertura.xml" -targetdir:coverage -reporttypes:SonarQube
53+
4954
- name: End SonarCloud analysis
5055
env:
5156
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)