File tree Expand file tree Collapse file tree 4 files changed +33
-10
lines changed Expand file tree Collapse file tree 4 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ jobs:
3535 run : dotnet build -c Release --no-restore
3636 - name : Test & collect coverage
3737 run : |
38- dotnet test -c Release --no-restore --no-build -- \
39- --coverage -- coverage-output-format xml --coverage-output ${{ github.workspace }}/coverage.xml
38+ dotnet test -c Release --no-restore --no-build \
39+ --settings coverage.runsettings --results-directory ${{ github.workspace }}/test-results /coverage.xml
4040 env :
4141 USE_MOCKING : ${{ vars.USE_MOCKING }}
4242 SHOW_MOCKING_LOGS : ${{ vars.SHOW_MOCKING_LOGS }}
4343 - name : Find coverage files and generate report
4444 run : |
45- dotnet tool run reportgenerator -reports:"${{ github.workspace }}/**/coverage .xml" \
45+ dotnet tool run reportgenerator -reports:"${{ github.workspace }}/test-results/ **/*cobertura .xml" \
4646 -targetdir:"coverage-report" \
4747 -reporttypes:MarkdownSummaryGithub
4848 - name : Upload coverage report
Original file line number Diff line number Diff line change 2626[Ll ]ogs /
2727
2828# Coverage
29- [Cc ]overagereport
30- coverage. * .xml
29+ [Cc ]overage-report
30+ * coverage. * .xml
31+ * cobertura.xml
3132
3233# PDFs
3334* .pdf
Original file line number Diff line number Diff line change 1- dotnet test - c Debug -- no - restore -- no - build -- -- coverage -- coverage - output - format xml -- coverage - output coverage.xml
1+ dotnet test - c Release -- settings coverage.runsettings -- results - directory test-results
22
3- $coverageFiles = Get-ChildItem - Path " tests " - Recurse - Filter " coverage .xml"
3+ $coverageFiles = Get-ChildItem - Path " test-results " - Recurse - Filter " *cobertura .xml"
44
55if ($coverageFiles ) {
66 $reportFiles = ($coverageFiles | ForEach-Object { $_.FullName }) -join " ;"
7- dotnet tool run reportgenerator - reports:$reportFiles - targetdir:coveragereport
7+ dotnet tool run reportgenerator - reports:$reportFiles - targetdir:coverage - report
88
9- Start-Process " coveragereport /index.html"
9+ Start-Process " coverage-report /index.html"
1010} else {
1111 Write-Host " Coverage reports not found."
1212}
1313
14- Get-ChildItem - Path " tests " - Recurse - Filter " TestResults " | ForEach-Object { Remove-Item - Recurse - Force - Path $_.FullName }
14+ Get-ChildItem - Path " test-results " - Recurse | ForEach-Object { Remove-Item - Recurse - Force - Path $_.FullName }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <RunSettings >
3+ <DataCollectionRunSettings >
4+ <DataCollectors >
5+ <DataCollector friendlyName =" Code Coverage" >
6+ <Configuration >
7+ <Format >cobertura</Format >
8+ <Include >
9+ <ModulePath >.*[\\/]src[\\/].*\.dll$</ModulePath >
10+ </Include >
11+ <Exclude >
12+ <ModulePath >.*Microsoft.*</ModulePath >
13+ <ModulePath >.*System.*</ModulePath >
14+ <ModulePath >.*Docker.*</ModulePath >
15+ <ModulePath >.*Testcontainers.*</ModulePath >
16+ <ModulePath >.*xunit.*</ModulePath >
17+ </Exclude >
18+ </Configuration >
19+ </DataCollector >
20+ </DataCollectors >
21+ </DataCollectionRunSettings >
22+ </RunSettings >
You can’t perform that action at this time.
0 commit comments