Skip to content

ci: add codecov#510

Open
skevetter wants to merge 2 commits intomainfrom
setup-code-test-coverage
Open

ci: add codecov#510
skevetter wants to merge 2 commits intomainfrom
setup-code-test-coverage

Conversation

@skevetter
Copy link
Copy Markdown
Owner

@skevetter skevetter commented Feb 18, 2026

Signed-off-by: Samuel K skevetter@pm.me

Summary by CodeRabbit

  • Chores
    • Added automated code coverage collection and reporting infrastructure for pull requests via GitHub Actions workflow.
    • Configured code coverage targets and exclusion rules for enhanced quality tracking.

Signed-off-by: Samuel K <skevetter@pm.me>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow for running code coverage tests on pull requests and a corresponding Codecov configuration file that defines coverage targets and ignores e2e test paths.

Changes

Cohort / File(s) Summary
Coverage CI/CD Setup
.github/workflows/coverage.yml, codecov.yml
Adds GitHub Actions workflow that runs tests with coverage collection (excluding e2e/test paths) and uploads results to Codecov in dry-run mode. Codecov config sets project coverage target to auto with 1% threshold and patch coverage target to 70%, both non-blocking; ignores e2e paths.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: add codecov' is directly related to the main changes—adding Codecov configuration (codecov.yml) and a coverage workflow (.github/workflows/coverage.yml).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch setup-code-test-coverage

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Samuel K <skevetter@pm.me>
@skevetter skevetter marked this pull request as ready for review February 19, 2026 16:48
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/coverage.yml:
- Line 18: The workflow run command uses xargs without the "no-run-if-empty"
option, so if the package list is empty it will run "go test" against the repo
root; update the run command string to pass xargs the option to not run when
stdin is empty (e.g., add "-r" or "--no-run-if-empty" to the xargs invocation in
the run: line so the pipeline fails/short-circuits instead of unintentionally
testing the root package).
- Line 25: The workflow is configured with the codecov action using dry_run:
true which prevents any coverage from being uploaded; remove or set dry_run to
false in the codecov/codecov-action step so the action actually sends coverage
to Codecov, and then verify codecov.yml’s informational settings (the
informational: false entries) are adjusted if you want status checks to report —
ensure the step that calls the Codecov action no longer includes dry_run and
that the action runs with the proper token and environment to upload results.
- Around line 20-25: Add the missing Codecov token input and a push trigger for
baseline uploads: update the codecov step that uses codecov/codecov-action@v5 to
include token: ${{ secrets.CODECOV_TOKEN }} alongside existing inputs
(fail_ci_if_error, verbose, dry_run) so private repo uploads authenticate, and
modify the workflow triggers to also run on push to the default branch (so
baseline coverage is uploaded on merges) in addition to pull_request.

go-version-file: go.mod

- name: Run tests with coverage
run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

xargs without -r will run go test against the current directory if all packages are filtered.

If grep -v -e /test -e /e2e produces empty output (e.g., in a repo where all packages match the excluded paths), xargs go test ... receives no stdin and runs go test -race -coverprofile=coverage.out -covermode=atomic with no arguments — testing only the root package instead of failing clearly.

🔧 Proposed fix
-        run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
+        run: go list ./... | grep -v -e /test -e /e2e | xargs -r go test -race -coverprofile=coverage.out -covermode=atomic
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
run: go list ./... | grep -v -e /test -e /e2e | xargs -r go test -race -coverprofile=coverage.out -covermode=atomic
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml at line 18, The workflow run command uses
xargs without the "no-run-if-empty" option, so if the package list is empty it
will run "go test" against the repo root; update the run command string to pass
xargs the option to not run when stdin is empty (e.g., add "-r" or
"--no-run-if-empty" to the xargs invocation in the run: line so the pipeline
fails/short-circuits instead of unintentionally testing the root package).

Comment on lines +20 to +25
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
dry_run: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add token input to Codecov action; add a push trigger for baseline coverage.

Two related gaps:

  1. Missing token: For private repositories, codecov/codecov-action requires token: ${{ secrets.CODECOV_TOKEN }}. Without it, uploads will fail silently or with auth errors, and fail_ci_if_error: true will break CI.

  2. No baseline uploads: The workflow only fires on pull_request. The project.default: target: auto in codecov.yml compares against the base commit's coverage, but if coverage is never uploaded on pushes to the default branch, there is no baseline to compare against. Add a push trigger (restricted to the default branch) so merged commits populate Codecov's history.

🛡️ Proposed fix
 on:
   pull_request:
+  push:
+    branches:
+      - main

 ...

       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v5
         with:
+          token: ${{ secrets.CODECOV_TOKEN }}
           fail_ci_if_error: true
           verbose: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml around lines 20 - 25, Add the missing Codecov
token input and a push trigger for baseline uploads: update the codecov step
that uses codecov/codecov-action@v5 to include token: ${{ secrets.CODECOV_TOKEN
}} alongside existing inputs (fail_ci_if_error, verbose, dry_run) so private
repo uploads authenticate, and modify the workflow triggers to also run on push
to the default branch (so baseline coverage is uploaded on merges) in addition
to pull_request.

with:
fail_ci_if_error: true
verbose: true
dry_run: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

dry_run: true prevents any coverage data from ever being uploaded — remove it.

With dry_run: true, the codecov/codecov-action processes coverage locally but never sends anything to Codecov. This completely defeats the purpose of this PR. Combined with informational: false on both checks in codecov.yml, this also means every PR will have permanently-pending (or missing) Codecov status checks that can block merges.

🐛 Proposed fix
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v5
         with:
           fail_ci_if_error: true
           verbose: true
-          dry_run: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
dry_run: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml at line 25, The workflow is configured with
the codecov action using dry_run: true which prevents any coverage from being
uploaded; remove or set dry_run to false in the codecov/codecov-action step so
the action actually sends coverage to Codecov, and then verify codecov.yml’s
informational settings (the informational: false entries) are adjusted if you
want status checks to report — ensure the step that calls the Codecov action no
longer includes dry_run and that the action runs with the proper token and
environment to upload results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant