Skip to content

ci: add Codecov integration for code coverage reporting#42

Merged
miclle merged 1 commit intofox-gonic:mainfrom
miclle:main
Dec 7, 2025
Merged

ci: add Codecov integration for code coverage reporting#42
miclle merged 1 commit intofox-gonic:mainfrom
miclle:main

Conversation

@miclle
Copy link
Copy Markdown
Member

@miclle miclle commented Dec 7, 2025

Summary

This PR adds Codecov integration to automatically track and report code coverage metrics.

Changes

1. Added .codecov.yml configuration

  • Coverage precision: 2 decimal places
  • Coverage range: 70-100%
  • Project coverage: Auto target with 1% threshold
  • Patch coverage: Auto target with 1% threshold
  • PR comments: Enabled with layout showing reach, diff, flags, and tree
  • Ignores: Test files, examples, and testdata

2. Updated GitHub Actions workflow

  • Added codecov/codecov-action@v5 step after test execution
  • Upload coverage.txt generated by make test
  • Only upload from ubuntu-latest to avoid duplicate reports
  • Uses CODECOV_TOKEN secret for authentication
  • Set fail_ci_if_error: false to not block CI on upload issues

Benefits

  • ✅ Automatic coverage tracking on every commit
  • ✅ Coverage reports on pull requests
  • ✅ Visual diff showing coverage changes
  • ✅ Historical coverage trends
  • ✅ Badge in README already present and will now work

Setup Required

The repository maintainer needs to:

  1. Sign up for Codecov at https://codecov.io/ (if not already done)
  2. Add the repository to Codecov
  3. Add CODECOV_TOKEN secret to GitHub repository settings:
    • Go to repository Settings → Secrets and variables → Actions
    • Add new secret named CODECOV_TOKEN
    • Get the token from Codecov dashboard

Testing

Once the secret is added, the workflow will:

  • Run tests and generate coverage report
  • Upload to Codecov automatically
  • Display coverage on Codecov dashboard
  • Add coverage comments to PRs

References

- Add .codecov.yml configuration file
  - Set coverage precision and range (70-100%)
  - Configure project and patch coverage thresholds
  - Enable coverage comments on PRs
  - Ignore test files and examples

- Update GitHub Actions workflow
  - Add codecov/codecov-action@v5 step
  - Upload coverage.txt after tests
  - Only upload from ubuntu-latest to avoid duplicates
  - Use CODECOV_TOKEN secret for authentication

This enables automatic coverage reporting on PRs and commits,
making it easier to track test coverage changes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 7, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@miclle miclle merged commit d58c31a into fox-gonic:main Dec 7, 2025
10 checks passed
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