Skip to content

Commit 45f4f98

Browse files
authored
fix: merge coverage reports for SonarCloud (#245)
Signed-off-by: Alan Brault <alan.brault@visus.io>
1 parent d611f5c commit 45f4f98

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
5757
run: dotnet tool update dotnet-sonarscanner --tool-path .sonar/scanner
5858

59+
- name: Install dotnet-coverage tool
60+
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
61+
run: dotnet tool update dotnet-coverage --global
62+
5963
- name: Begin SonarCloud analysis
6064
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
6165
run: |
@@ -64,19 +68,25 @@ jobs:
6468
/o:"visus" \
6569
/d:sonar.token="$SONAR_TOKEN" \
6670
/d:sonar.host.url="https://sonarcloud.io" \
67-
/d:sonar.cs.vscoveragexml.reportsPaths="**/TestResults/**/coverage.xml" \
71+
/d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" \
6872
/d:sonar.cs.vstest.reportsPaths="**/TestResults/**/*.trx"
6973
7074
- name: Build
7175
run: dotnet build -c Release --no-restore
7276

7377
- name: Run tests
7478
run: |
75-
dotnet test -c Release --no-build --no-restore \
79+
dotnet test -c Release --no-build --no-restore -- \
7680
--coverage \
77-
--coverage-output coverage.xml \
7881
--coverage-output-format xml \
79-
-- --report-trx
82+
--report-trx
83+
84+
- name: Merge coverage reports
85+
if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]'
86+
run: |
87+
dotnet-coverage merge "tests/**/TestResults/*.xml" \
88+
--output coverage.xml \
89+
--output-format xml
8090
8191
- name: Upload test results
8292
if: always()

0 commit comments

Comments
 (0)