Skip to content

Upload test coverage to Codecov#377

Merged
ptr727 merged 1 commit into
developfrom
feature/codecov
Jul 7, 2026
Merged

Upload test coverage to Codecov#377
ptr727 merged 1 commit into
developfrom
feature/codecov

Conversation

@ptr727

@ptr727 ptr727 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Collect Cobertura coverage during dotnet test and upload it to Codecov, best-effort (fail_ci_if_error: false, so a Codecov hiccup or an absent token never fails the gate).

Mirrors the proven PlexCleaner pattern:

  • validate-task.yml: dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage, then a codecov/codecov-action upload step.
  • test-pull-request.yml and publish-release.yml: pass secrets: inherit on the validate-task call so CODECOV_TOKEN threads through to the unit-test job.
  • Reference coverlet.collector in UtilitiesTests (and Directory.Packages.props).

Maintainer action required: add a CODECOV_TOKEN secret to the repo Actions secrets for uploads to authenticate. Until then, uploads are simply skipped and CI stays green.

Collect Cobertura coverage during dotnet test and upload it to Codecov
best-effort (fail_ci_if_error: false). Thread CODECOV_TOKEN to the reusable
validate-task via secrets: inherit, and reference coverlet.collector in the
test project.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 7, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Codecov coverage reporting to the repo’s CI pipeline by collecting Cobertura coverage during dotnet test and uploading it via the pinned codecov/codecov-action, designed to be best-effort (non-gating).

Changes:

  • Add coverlet.collector to the test project and central package versions to enable XPlat Code Coverage collection.
  • Update the reusable validate-task workflow to run tests with coverage collection and upload results to Codecov.
  • Thread Codecov credentials through workflow callers so coverage upload can authenticate when CODECOV_TOKEN is configured.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
UtilitiesTests/UtilitiesTests.csproj Adds coverlet.collector to enable coverage collection during test runs.
Directory.Packages.props Centrally pins coverlet.collector version for consistent restore/build.
.github/workflows/validate-task.yml Collects coverage in dotnet test and uploads coverage artifacts to Codecov.
.github/workflows/test-pull-request.yml Passes secrets through to the reusable validation workflow for coverage upload.
.github/workflows/publish-release.yml Passes secrets through to the reusable validation workflow for coverage upload during release validation.

Comment thread .github/workflows/publish-release.yml
Comment thread .github/workflows/validate-task.yml
Comment thread .github/workflows/test-pull-request.yml
@ptr727
ptr727 merged commit 17b9cbd into develop Jul 7, 2026
10 checks passed
@ptr727
ptr727 deleted the feature/codecov branch July 7, 2026 17:24
ptr727 added a commit that referenced this pull request Jul 18, 2026
Coverage has been uploaded to Codecov since the coverage workflow landed
(#377), but the README never surfaced it.

Adds a Coverage shield to the **Build Status** block, following the
badge pattern used in
[aiopurpleair](https://github.com/ptr727/aiopurpleair):

```markdown
[![Release Status][releasebuildstatus-shield]][actions-link]\
[![Last Commit][lastcommit-shield]][commits-link]\
[![Coverage][coverage-shield]][coverage-link]
```

Shield and link definitions were inserted in the file's existing
alphabetical order, between `commits-link` and `github-link`.

## Verification

- Shield URL returns HTTP 200 and renders real data (`coverage: 67%`),
not `unknown`
- markdownlint MD052 (undefined reference) clean -- both definitions
resolve
- CRLF preserved
- No `cspell.json` change needed: `codecov` is not flagged (aiopurpleair
carries the same badge with no dictionary entry), and README is in the
CI spell-check scope per CODESTYLE

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants