Skip to content

Commit d050929

Browse files
ANcpLuaclaude
andcommitted
Fix coverage reporting for multi-framework fallback blocks
- Split test runs per TFM (net8, net9, net10) with explicit coverlet output - Add verification step to list coverage files before merge - Update ReportGenerator to use explicit file paths instead of glob - Enable verbose Codecov upload for better diagnostics This ensures Codecov ingests coverage from all target frameworks, capturing conditional compilation blocks like #if NET10_0_OR_GREATER. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 48da886 commit d050929

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

.github/workflows/tests.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,39 @@ jobs:
3030
run: |
3131
dotnet build SWEN3.Paperless.RabbitMq.sln --no-restore --configuration Release
3232
33-
- name: Run tests with coverage
33+
- name: Run tests for .NET 8 with coverage
3434
run: |
35-
dotnet test SWEN3.Paperless.RabbitMq.sln --no-build --configuration Release \
36-
--collect:"XPlat Code Coverage" \
37-
--logger:"console;verbosity=detailed"
35+
dotnet test SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj \
36+
-f net8.0 --no-build --configuration Release \
37+
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura \
38+
/p:CoverletOutput=TestResults/coverage-net8.cobertura.xml
39+
40+
- name: Run tests for .NET 9 with coverage
41+
run: |
42+
dotnet test SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj \
43+
-f net9.0 --no-build --configuration Release \
44+
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura \
45+
/p:CoverletOutput=TestResults/coverage-net9.cobertura.xml
46+
47+
- name: Run tests for .NET 10 with coverage
48+
run: |
49+
dotnet test SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj \
50+
-f net10.0 --no-build --configuration Release \
51+
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura \
52+
/p:CoverletOutput=TestResults/coverage-net10.cobertura.xml
53+
54+
- name: Verify coverage files exist
55+
run: |
56+
echo "Listing coverage files:"
57+
find . -name "coverage-net*.cobertura.xml" -print
3858
3959
- name: Install ReportGenerator
4060
run: dotnet tool install --global dotnet-reportgenerator-globaltool
4161

4262
- name: Merge coverage reports
4363
run: |
4464
reportgenerator \
45-
-reports:"**/coverage.cobertura.xml" \
65+
-reports:"SWEN3.Paperless.RabbitMq.Tests/TestResults/coverage-net8.cobertura.xml;SWEN3.Paperless.RabbitMq.Tests/TestResults/coverage-net9.cobertura.xml;SWEN3.Paperless.RabbitMq.Tests/TestResults/coverage-net10.cobertura.xml" \
4666
-targetdir:"./coverage-merged" \
4767
-reporttypes:"Cobertura"
4868
@@ -51,4 +71,5 @@ jobs:
5171
with:
5272
token: ${{ secrets.CODECOV_TOKEN }}
5373
files: ./coverage-merged/Cobertura.xml
74+
verbose: true
5475
fail_ci_if_error: false

0 commit comments

Comments
 (0)