Skip to content

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

Open
davidnmbond wants to merge 1 commit into
mainfrom
ci/codacy-coverage
Open

davidnmbond wants to merge 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 unit tests with code coverage and uploads the Cobertura report to Codacy. It runs on pdl-public because the repository is public.

  • Serilog.Sinks.LogicMonitor.Tests moves from xunit v2 on VSTest to xunit.v3 on Microsoft.Testing.Platform, plus Microsoft.Testing.Extensions.CodeCoverage. Coverage collection needs this. No test source changes were needed.
  • This also fixes the build job. Its dotnet test step has failed on main since global.json opted into MTP. The error was "The following test projects are using VSTest test runner: Serilog.Sinks.LogicMonitor.Tests.csproj".
  • Adds a coverage.config taken from 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.

Excluded tests

The Serilog.Sinks.LogicMonitor.IntegrationTests project is not run by the coverage job. It writes to a live LogicMonitor portal using credentials from appsettings.json, which CI does not have.

Coverage

Local line coverage of the 10 unit tests, in a clean Linux container (mcr.microsoft.com/dotnet/sdk:10.0.401), is 15.8%.

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

🤖 Generated with Claude Code

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

Serilog.Sinks.LogicMonitor.Tests moves from xunit v2 on VSTest to xunit.v3 on
Microsoft.Testing.Platform, which coverage collection needs. This also fixes
the build job's dotnet test step, which has failed on main since global.json
opted into MTP ("The following test projects are using VSTest test runner").
No test source changes were needed.

Excluded: the Serilog.Sinks.LogicMonitor.IntegrationTests project, which
writes to a live LogicMonitor portal using credentials CI does not have.
Local line coverage of the 10 unit tests (clean Linux container): 15.8%.

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

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

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

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