Skip to content

OPS-157454: Upload test coverage to Codacy from CI - #28

Merged
davidnmbond merged 1 commit into
mainfrom
ci/codacy-coverage
Sep 27, 2026
Merged

davidnmbond merged 1 commit into
mainfrom
ci/codacy-coverage

Conversation

@davidnmbond

Copy link
Copy Markdown
Contributor

What

Adds a coverage job to ci.yml that runs the tests with code coverage and uploads the Cobertura report to Codacy. It runs on pdl-public because the repository is public.

  • Runs the xunit v3 Microsoft.Testing.Platform test executable with --coverage (Microsoft.Testing.Extensions.CodeCoverage), using a coverage.config modelled on PanoramicData.NugetManagement.
  • Uploads with codacy/codacy-coverage-reporter-action@v1 using the CODACY_PROJECT_TOKEN secret. The upload has continue-on-error: true, and the report is also kept as a 7-day artifact.

The test project gains UseMicrosoftTestingPlatformRunner so the test executable accepts --coverage; it already referenced Microsoft.Testing.Extensions.CodeCoverage. The build job is unchanged and still runs every test, including the live ones.

Excluded tests

The existing [Trait("Category", "Integration")] class LegislationIntegrationTests (12 tests), which calls the live www.legislation.gov.uk API. The coverage job filters it out with Category!=Integration. The remaining 16 tests (LegislationApiUnitTests, Category=Unit) were confirmed to pass in a container with no network at all.

Coverage

Local line coverage in a clean Linux container (mcr.microsoft.com/dotnet/sdk:10.0.401, no user secrets) is 52.4%.

Jira: https://jira.panoramicdata.com/browse/OPS-157454

🤖 Generated with Claude Code

Adds a coverage job on pdl-public that runs the test executable with
Microsoft.Testing.Extensions.CodeCoverage and uploads the Cobertura report
to Codacy.

The test project gains UseMicrosoftTestingPlatformRunner so the test
executable accepts --coverage; it already referenced
Microsoft.Testing.Extensions.CodeCoverage. The build job is unchanged and
still runs every test, including the live ones.

Excluded: The existing [Trait("Category", "Integration")] class
LegislationIntegrationTests (12 tests), which calls the live
www.legislation.gov.uk API. The coverage job filters it out with
Category!=Integration. The remaining 16 tests (LegislationApiUnitTests,
Category=Unit) were confirmed to pass in a container with no network at
all.
Local line coverage (clean Linux container): 52.4%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for b74e6471
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b74e647) Report Missing Report Missing Report Missing
Head commit (d7b6d03) 309 162 52.43%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#28) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@davidnmbond
davidnmbond merged commit a19c5e0 into main Sep 27, 2026
7 of 9 checks passed
@davidnmbond
davidnmbond deleted the ci/codacy-coverage branch September 27, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant