From 3069f64a3560f207cf030f667980ca523e96b8a7 Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Thu, 6 Aug 2026 18:32:42 +0000 Subject: [PATCH] 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. --- .github/workflows/unitsnet-modular-ci.yml | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unitsnet-modular-ci.yml b/.github/workflows/unitsnet-modular-ci.yml index 6b262610e0..d137f91bc0 100644 --- a/.github/workflows/unitsnet-modular-ci.yml +++ b/.github/workflows/unitsnet-modular-ci.yml @@ -49,6 +49,9 @@ on: permissions: contents: read + # Codecov uploads with use_oidc, which needs a token. This workflow declares its + # permissions explicitly, so id-token stays none unless it is named here. + id-token: write concurrency: group: unitsnet-modular-ci-${{ github.ref }} @@ -80,11 +83,29 @@ jobs: - name: Restore run: dotnet restore UnitsNet.Modular.slnx -p:Platform=ProjectReferences + - name: Restore local tools + run: dotnet tool restore + - name: Build run: dotnet build UnitsNet.Modular.slnx --configuration Release --no-restore --no-incremental -p:Platform=ProjectReferences - - name: Test - run: dotnet test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences + - name: Test with coverage + run: | + mkdir -p Artifacts/Coverage + dotnet tool run dotCover -- cover-dotnet \ + --Output "Artifacts/Coverage/UnitsNet.Modular.coverage.xml" \ + --ReportType DetailedXML \ + --Filters '+:module=UnitsNet.Modular;+:module=UnitsNet.Modular.Generator;-:module=*Tests;-:module=*Fixture' \ + --ReturnTargetExitCode \ + -- test UnitsNet.Modular.slnx --configuration Release --no-build -p:Platform=ProjectReferences + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v6 + with: + directory: Artifacts/Coverage + fail_ci_if_error: false + plugins: noop + use_oidc: true - name: Native AOT smoke test run: |