Skip to content

Commit 3069f64

Browse files
committed
Collect and report coverage for UnitsNet.Modular
The Modular test projects are absent from Build/test-projects.psm1, and this workflow ran plain dotnet test, so nothing in the repository measured Modular coverage. codecov.yml targets the 80-100 range, but that target only ever saw the legacy projects. Wraps the existing test run in the dotCover tool the repository already depends on, and uploads the report the same way pr.yml does. The filter is narrower than the legacy '+:module=UnitsNet*;-:module=*Tests'. The compatibility suite compiles the current UnitsNet project and generates a large fixture assembly, so the broad filter reports legacy UnitsNet at 24% and a 19k-statement generated test fixture at 37%, dragging the headline to 31% and measuring things this workflow does not own. Restricting it to the two product assemblies reports what Modular is actually responsible for. id-token is granted because this workflow, unlike pr.yml, declares its permissions explicitly, so Codecov's use_oidc would otherwise have no token.
1 parent 3bf1ef4 commit 3069f64

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

.github/workflows/unitsnet-modular-ci.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ on:
4949

5050
permissions:
5151
contents: read
52+
# Codecov uploads with use_oidc, which needs a token. This workflow declares its
53+
# permissions explicitly, so id-token stays none unless it is named here.
54+
id-token: write
5255

5356
concurrency:
5457
group: unitsnet-modular-ci-${{ github.ref }}
@@ -80,11 +83,29 @@ jobs:
8083
- name: Restore
8184
run: dotnet restore UnitsNet.Modular.slnx -p:Platform=ProjectReferences
8285

86+
- name: Restore local tools
87+
run: dotnet tool restore
88+
8389
- name: Build
8490
run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:Platform=ProjectReferences
8591

86-
- name: Test
87-
run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences
92+
- name: Test with coverage
93+
run: |
94+
mkdir -p Artifacts/Coverage
95+
dotnet tool run dotCover -- cover-dotnet \
96+
--Output "Artifacts/Coverage/UnitsNet.Modular.coverage.xml" \
97+
--ReportType DetailedXML \
98+
--Filters '+:module=UnitsNet.Modular;+:module=UnitsNet.Modular.Generator;-:module=*Tests;-:module=*Fixture' \
99+
--ReturnTargetExitCode \
100+
-- test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences
101+
102+
- name: Upload coverage to Codecov
103+
uses: codecov/codecov-action@v6
104+
with:
105+
directory: Artifacts/Coverage
106+
fail_ci_if_error: false
107+
plugins: noop
108+
use_oidc: true
88109

89110
- name: Native AOT smoke test
90111
run: |

0 commit comments

Comments
 (0)