Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 25, 2025

Adds code coverage collection to PR CI workflow using stable Rust's source-based coverage (available since 1.60.0). Coverage reports are uploaded to Codecov on every PR.

Implementation

  • New codecov job in .github/workflows/ci.yaml runs Rust test coverage only
  • Uses cargo-llvm-cov with stable toolchain and rust-cache
  • Set fail_ci_if_error: false to avoid blocking PRs on Codecov service issues
  • 30-minute timeout, respects skip:ci label

Design

The PR job collects only Rust test coverage to minimize build time impact. The existing scheduled cron job continues to provide comprehensive coverage including Python snippets and full test suite.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add code coverage report to CI</issue_title>
<issue_description>https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html#source-based-code-coverage</issue_description>

Comments on the Issue (you are @copilot in this section)

@coolreader18 Yeah I saw that; that's exciting! @youknowone I was forgetting we had one in cron. Can we make report using codecov? https://about.codecov.io/language/rust/ @youknowone #3649 made the first report: https://app.codecov.io/gh/RustPython/RustPython @youknowone I looked at it and I like it. If it doesn't increase build time that much (because now we can do it with stable compiler), adding it to PR CI will be the final step.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copilot AI changed the title [WIP] Add code coverage report to CI Add code coverage reporting to PR CI Dec 25, 2025
Copilot AI requested a review from youknowone December 25, 2025 10:24
@youknowone youknowone force-pushed the copilot/add-code-coverage-report branch 4 times, most recently from c2b5586 to b7a0001 Compare December 28, 2025 00:10
@youknowone youknowone force-pushed the copilot/add-code-coverage-report branch from b7a0001 to 76ad42c Compare January 8, 2026 12:50
@youknowone youknowone force-pushed the copilot/add-code-coverage-report branch from 76ad42c to 6817d2a Compare January 9, 2026 10:58
youknowone and others added 7 commits January 9, 2026 20:48
- Use `cargo llvm-cov build` instead of `cargo build` to ensure
  proper coverage instrumentation
- Add `--target-dir target` to keep binaries in standard location
- Add `--no-report` since report is generated separately
- Update clean and report commands to use same target-dir

Co-Authored-By: Claude Opus 4.5 <[email protected]>
cargo llvm-cov doesn't have a build subcommand.
Use environment variables from show-env with regular cargo build.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Use heredoc format for RUSTFLAGS which contains spaces.
GitHub Actions requires this format for multiline/space-containing values:
  NAME<<EOF
  value
  EOF

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add Trim() to handle Windows line endings
- Change regex to not require end-of-line match
- Add debug output to verify env vars are being set

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Without --export-prefix, output is "RUSTFLAGS='...'" not "export RUSTFLAGS='...'"
so the regex didn't match.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- source <() (process substitution) not supported in sh
- Use eval "$(...)" which is POSIX compliant
- Add explicit shell: bash

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

Add code coverage report to CI

2 participants