Skip to content

ci: collect + upload coverage with cargo-llvm-cov#64

Merged
nficano merged 1 commit into
mainfrom
chore/codecov-upload
May 25, 2026
Merged

ci: collect + upload coverage with cargo-llvm-cov#64
nficano merged 1 commit into
mainfrom
chore/codecov-upload

Conversation

@nficano
Copy link
Copy Markdown
Contributor

@nficano nficano commented May 25, 2026

Summary

  • Install cargo-llvm-cov via taiki-e/install-action (prebuilt binary, no source compile).
  • Run cargo llvm-cov --all-features --workspace --lcov on the stable matrix entry only — same coverage on MSRV.
  • Upload lcov.info to Codecov.
  • fail_ci_if_error: false so a Codecov outage cannot break CI.

Pre-merge action required

  • Add CODECOV_TOKEN as a repo secret (gh secret set CODECOV_TOKEN --repo agentruntimecontrolprotocol/rust-sdk).
  • Activate the repo at app.codecov.io.

Test plan

  • Merge, confirm coverage uploads on next push to main.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced code quality assurance processes with improved coverage reporting in the CI pipeline.

Review Change Stack

Run cargo-llvm-cov (prebuilt binary via taiki-e/install-action) on the
`stable` matrix entry to emit lcov.info, then upload to Codecov
non-blockingly. MSRV entry is unchanged.

Requires CODECOV_TOKEN to be set as a repo secret.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Walkthrough

This PR adds code coverage reporting to the continuous integration pipeline. The test workflow now installs the LLVM coverage tool, generates a coverage report, and uploads results to Codecov for the stable Rust version only.

Changes

Coverage Reporting Setup

Layer / File(s) Summary
LLVM coverage generation and Codecov upload
.github/workflows/test.yml
Workflow steps install cargo-llvm-cov, run coverage analysis to produce lcov.info, and upload the report to Codecov. Coverage execution and upload are conditional on the Rust matrix entry being stable, and upload failures do not block the job.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding CI coverage collection and upload using cargo-llvm-cov, which directly corresponds to the workflow modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/codecov-upload

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

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: 1

🧹 Nitpick comments (1)
.github/workflows/test.yml (1)

98-100: ⚡ Quick win

Use the repo coverage wrapper to avoid local/CI drift.

Line 100 bypasses scripts/coverage.sh, so CI may diverge from repo-default coverage flags (notably --ignore-filename-regex='src/bin/').

Proposed refactor
       - name: cargo llvm-cov (lcov)
         if: matrix.rust == 'stable'
-        run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
+        run: bash scripts/coverage.sh --workspace --lcov --output-path lcov.info
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 98 - 100, Replace the direct cargo
llvm-cov invocation in the GitHub Actions step with the repository coverage
wrapper script (scripts/coverage.sh) so CI uses the repo-default flags (e.g.,
--ignore-filename-regex='src/bin/') and avoids local/CI drift; keep the existing
step name and the matrix.rust conditional, and ensure the wrapper is invoked so
it still produces the lcov output (lcov.info) expected by downstream steps.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 91-100: The workflow currently runs the "Install cargo-llvm-cov"
and "cargo llvm-cov (lcov)" steps without adding the LLVM Rust toolchain
components; update the job to install llvm-tools-preview before invoking cargo
llvm-cov (or replace the direct run with a call to scripts/coverage.sh which
already handles the setup). Specifically, add a step (before the "cargo llvm-cov
(lcov)" step) that runs rustup component add llvm-tools-preview --toolchain
stable (or the appropriate ${{ matrix.rust }} value) so llvm-cov/llvm-profdata
are available, or change the "cargo llvm-cov (lcov)" step to run
scripts/coverage.sh which performs the component installation and error
handling.

---

Nitpick comments:
In @.github/workflows/test.yml:
- Around line 98-100: Replace the direct cargo llvm-cov invocation in the GitHub
Actions step with the repository coverage wrapper script (scripts/coverage.sh)
so CI uses the repo-default flags (e.g., --ignore-filename-regex='src/bin/') and
avoids local/CI drift; keep the existing step name and the matrix.rust
conditional, and ensure the wrapper is invoked so it still produces the lcov
output (lcov.info) expected by downstream steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bbc9e433-efa7-44e1-b6e2-b7210e0bfd0a

📥 Commits

Reviewing files that changed from the base of the PR and between bfb9732 and 7efba86.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

Comment on lines +91 to +100
- name: Install cargo-llvm-cov
if: matrix.rust == 'stable'
# taiki-e/install-action v2.79.7
uses: taiki-e/install-action@d9be7d8cda89035c9c843f78bd44d4f72d8403d4 # v2.79.7
with:
tool: cargo-llvm-cov

- name: cargo llvm-cov (lcov)
if: matrix.rust == 'stable'
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
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 | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking coverage prereq references..."
rg -n "cargo llvm-cov|llvm-tools-preview|components:" .github/workflows/test.yml scripts/coverage.sh

Repository: agentruntimecontrolprotocol/rust-sdk

Length of output: 774


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== test.yml relevant sections ==="
nl -ba .github/workflows/test.yml | sed -n '40,130p'

echo "=== coverage.sh relevant sections ==="
nl -ba scripts/coverage.sh | sed -n '1,120p'

Repository: agentruntimecontrolprotocol/rust-sdk

Length of output: 176


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== test.yml relevant sections ==="
cat -n .github/workflows/test.yml | sed -n '40,130p'

echo
echo "=== coverage.sh relevant sections ==="
cat -n scripts/coverage.sh | sed -n '1,120p'

Repository: agentruntimecontrolprotocol/rust-sdk

Length of output: 6250


Install llvm-tools-preview (or use scripts/coverage.sh) before cargo llvm-cov.

test.yml installs only rustfmt, clippy and then runs cargo llvm-cov for the stable matrix (lines 56, 98-100) without installing llvm-tools-preview. scripts/coverage.sh shows cargo llvm-cov needs llvm-cov/llvm-profdata and exits with an error instructing rustup component add llvm-tools-preview when they’re missing (lines 4-6, 42-46).

Proposed fix
       - name: Install cargo-llvm-cov
         if: matrix.rust == 'stable'
         # taiki-e/install-action v2.79.7
         uses: taiki-e/install-action@d9be7d8cda89035c9c843f78bd44d4f72d8403d4 # v2.79.7
         with:
           tool: cargo-llvm-cov

+      - name: Install llvm-tools-preview
+        if: matrix.rust == 'stable'
+        run: rustup component add llvm-tools-preview
+
       - name: cargo llvm-cov (lcov)
         if: matrix.rust == 'stable'
         run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
📝 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
- name: Install cargo-llvm-cov
if: matrix.rust == 'stable'
# taiki-e/install-action v2.79.7
uses: taiki-e/install-action@d9be7d8cda89035c9c843f78bd44d4f72d8403d4 # v2.79.7
with:
tool: cargo-llvm-cov
- name: cargo llvm-cov (lcov)
if: matrix.rust == 'stable'
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Install cargo-llvm-cov
if: matrix.rust == 'stable'
# taiki-e/install-action v2.79.7
uses: taiki-e/install-action@d9be7d8cda89035c9c843f78bd44d4f72d8403d4 # v2.79.7
with:
tool: cargo-llvm-cov
- name: Install llvm-tools-preview
if: matrix.rust == 'stable'
run: rustup component add llvm-tools-preview
- name: cargo llvm-cov (lcov)
if: matrix.rust == 'stable'
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 91 - 100, The workflow currently
runs the "Install cargo-llvm-cov" and "cargo llvm-cov (lcov)" steps without
adding the LLVM Rust toolchain components; update the job to install
llvm-tools-preview before invoking cargo llvm-cov (or replace the direct run
with a call to scripts/coverage.sh which already handles the setup).
Specifically, add a step (before the "cargo llvm-cov (lcov)" step) that runs
rustup component add llvm-tools-preview --toolchain stable (or the appropriate
${{ matrix.rust }} value) so llvm-cov/llvm-profdata are available, or change the
"cargo llvm-cov (lcov)" step to run scripts/coverage.sh which performs the
component installation and error handling.

@nficano nficano merged commit 32e4e6c into main May 25, 2026
3 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