Skip to content

feat: add Codecov integration for unit test coverage#543

Open
ptomanRH wants to merge 1 commit into
guacsec:mainfrom
ptomanRH:add-codecov-coverage
Open

feat: add Codecov integration for unit test coverage#543
ptomanRH wants to merge 1 commit into
guacsec:mainfrom
ptomanRH:add-codecov-coverage

Conversation

@ptomanRH
Copy link
Copy Markdown

@ptomanRH ptomanRH commented Jun 2, 2026

Summary

  • Add lcov reporter to c8 config so Codecov can parse coverage output
  • Add Codecov upload step to test workflow using OIDC authentication (no secret needed)
  • Upload only from the Node 24 matrix run (matches MAIN_NODE_VER)
  • Add codecov.yml with informational status checks, unit-tests flag with carryforward

Changes

File Change
package.json Add lcov to c8 reporter list
.github/workflows/test.yml Add permissions: id-token: write + Codecov upload step
codecov.yml Coverage config: informational checks, flag setup, ignore patterns

Manual follow-up

After merging:

  1. Go to https://app.codecov.io/gh/guacsec/trustify-da-javascript-client
  2. Click the Flags tab
  3. Click Enable flag analytics

Ref: COVERPORT-254

Summary by Sourcery

Integrate Codecov coverage reporting into the project’s CI test workflow and configuration.

New Features:

  • Enable Codecov uploads from the CI test workflow using OIDC authentication and unit-test coverage flags.
  • Add Codecov configuration to control coverage status checks, flags, and comment layout.

Enhancements:

  • Extend test coverage reporting to generate lcov output consumable by external coverage tooling.

CI:

  • Grant OIDC token permissions and add a Codecov upload step to the test workflow, restricted to the main Node.js version matrix run.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 2, 2026

Reviewer's Guide

Adds Codecov coverage reporting by generating lcov output from c8, uploading coverage from the Node 24 CI job via OIDC, and configuring Codecov project/patch statuses, flags, and ignore patterns.

File-Level Changes

Change Details Files
Enable LCOV coverage output so Codecov can consume test coverage produced by c8.
  • Extend c8 reporter configuration to include lcov output alongside existing html, json, and text reporters.
package.json
Integrate Codecov upload into the GitHub Actions test workflow using OIDC and limit uploads to the main Node version.
  • Grant the workflow job id-token: write permission required for OIDC-based authentication.
  • Add a Codecov upload step that runs only when the matrix node version equals MAIN_NODE_VER.
  • Configure the Codecov action to use OIDC auth, upload lcov.info with the unit-tests flag, target the guacsec/trustify-da-javascript-client slug, and not fail CI on upload errors.
.github/workflows/test.yml
Define Codecov project configuration for coverage statuses, ignores, and flags.
  • Configure project and patch coverage statuses to be informational with auto targets and 1% thresholds.
  • Specify ignore patterns for node_modules, dist, and coverage directories.
  • Define a unit-tests flag with carryforward enabled for flag analytics and historical tracking.
  • Configure the Codecov PR comment layout to include reach, diff, flags, and files with default behavior.
codecov.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider relying on Codecov’s default slug (from GITHUB_REPOSITORY) instead of hardcoding guacsec/trustify-da-javascript-client in the upload step to avoid issues if the repository is renamed or the workflow is reused elsewhere.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider relying on Codecov’s default `slug` (from `GITHUB_REPOSITORY`) instead of hardcoding `guacsec/trustify-da-javascript-client` in the upload step to avoid issues if the repository is renamed or the workflow is reused elsewhere.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ptomanRH ptomanRH requested a review from ruromero June 2, 2026 12:06
@ptomanRH ptomanRH self-assigned this Jun 2, 2026
@codecov-commenter
Copy link
Copy Markdown

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 ☂️

use_oidc: true
flags: unit-tests
files: ./coverage/lcov.info
slug: guacsec/trustify-da-javascript-client
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Replace hardcoded slug with ${{ github.repository }}

- Add lcov reporter to c8 config for Codecov-compatible output
- Add Codecov upload step to test workflow with OIDC auth
- Add permissions: id-token: write for OIDC token
- Add codecov.yml with informational status checks and unit-tests flag

Ref: COVERPORT-254

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ptomanRH ptomanRH force-pushed the add-codecov-coverage branch from 70b822a to 291595e Compare June 3, 2026 10:58
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.

3 participants