Skip to content

Commit 7f1fb4c

Browse files
committed
Add .NET 10 support to test project and fix CI workflow
Root cause: Test project only targeted net8/9 while main library targets net8/9/10. This meant NET10-specific code paths were never tested, causing coverage gaps. Changes: - Add net10.0 to test project TargetFrameworks - Add Microsoft.AspNetCore.Mvc.Testing 10.0.0 package for net10 - Disable Microsoft Testing Platform (xunit compatibility issue with .NET 10) - Update CI to collect coverage from both net9 (fallback) and net10 (native) - Merge coverage reports to get complete picture of both code paths
1 parent 51381fa commit 7f1fb4c

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/tests.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,35 @@ jobs:
3838
dotnet test SWEN3.Paperless.RabbitMq.sln --no-build --configuration Release \
3939
--logger:"console;verbosity=detailed"
4040
41-
- name: Run tests with coverage (net9.0 only for reporting)
41+
- name: Run tests with coverage on net9.0 (fallback path)
4242
run: |
4343
dotnet test SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj \
4444
--no-build \
4545
--configuration Release \
4646
--framework net9.0 \
4747
--collect:"XPlat Code Coverage" \
48-
--results-directory ./coverage
48+
--results-directory ./coverage-net9
49+
50+
- name: Run tests with coverage on net10.0 (NET10 path)
51+
run: |
52+
dotnet test SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj \
53+
--no-build \
54+
--configuration Release \
55+
--framework net10.0 \
56+
--collect:"XPlat Code Coverage" \
57+
--results-directory ./coverage-net10
58+
59+
- name: Merge coverage reports
60+
run: |
61+
dotnet tool install -g dotnet-reportgenerator-globaltool
62+
reportgenerator \
63+
-reports:"./coverage-net9/**/coverage.cobertura.xml;./coverage-net10/**/coverage.cobertura.xml" \
64+
-targetdir:./coverage-merged \
65+
-reporttypes:Cobertura
4966
5067
- name: Upload coverage to Codecov
5168
uses: codecov/codecov-action@v5
5269
with:
5370
token: ${{ secrets.CODECOV_TOKEN }}
54-
files: ./coverage/**/coverage.cobertura.xml
71+
files: ./coverage-merged/Cobertura.xml
5572
fail_ci_if_error: false

SWEN3.Paperless.RabbitMq.Tests/SWEN3.Paperless.RabbitMq.Tests.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>latestMajor</LangVersion>
88
<IsPackable>false</IsPackable>
99
<IsTestProject>true</IsTestProject>
10+
<IsTestingPlatformApplication>false</IsTestingPlatformApplication>
1011
</PropertyGroup>
1112

1213
<ItemGroup>
@@ -34,6 +35,10 @@
3435
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
3536
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0"/>
3637
</ItemGroup>
38+
39+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
40+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0"/>
41+
</ItemGroup>
3742
<ItemGroup>
3843
<ProjectReference Include="..\SWEN3.Paperless.RabbitMq\SWEN3.Paperless.RabbitMq.csproj"/>
3944
</ItemGroup>

0 commit comments

Comments
 (0)