Skip to content

ci: replace grcov by cargo-llvm-cov#1986

Merged
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
nymius:ci/replace-grcov-by-cargo-llvm-cov
Jul 29, 2025
Merged

ci: replace grcov by cargo-llvm-cov#1986
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
nymius:ci/replace-grcov-by-cargo-llvm-cov

Conversation

@nymius
Copy link
Copy Markdown
Contributor

@nymius nymius commented Jul 2, 2025

Description

As explained in #1984 , I discovered some misreportings in the coverage information given by grcov.

Fixes #1984

Notes to the reviewers

The discussion about the tool to use is open, but I'm adding this PR to showcase how a change from grcov to cargo-llvm-cov would look like and the improvements in reporting this change will bring. Look the report in coveralls to get a better perspective of them.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo +nightly fmt and cargo clippy before committing

Copy link
Copy Markdown
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

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

ACK d6a19fc

Thank you for looking into this and describing the problem in detail.

@nymius nymius force-pushed the ci/replace-grcov-by-cargo-llvm-cov branch from d6a19fc to 1b1dade Compare July 10, 2025 16:01
@nymius nymius force-pushed the ci/replace-grcov-by-cargo-llvm-cov branch from 1b1dade to 066c4cd Compare July 11, 2025 12:32
@nymius
Copy link
Copy Markdown
Contributor Author

nymius commented Jul 11, 2025

I replaced (example-crates/*|crates/testenv/*) by (example*|crates/testenv/*)as with the former one the file chain/src/example_utils.rs (used in doctests) wasn't being excluded, and contributed to the final score.

@nymius nymius requested a review from evanlinjin July 11, 2025 12:40
@notmandatory notmandatory moved this to In Progress in BDK Chain Jul 15, 2025
@notmandatory notmandatory added this to the Wallet 2.1.0 milestone Jul 15, 2025
Copy link
Copy Markdown
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

ACK 066c4cd

110CodingP added a commit to 110CodingP/bdk_redb that referenced this pull request Jul 22, 2025
Stolen from nymius's [pr](bitcoindevkit/bdk#1986)
on bitcoindevkit/bdk regarding the same.
110CodingP added a commit to 110CodingP/bdk_redb that referenced this pull request Jul 22, 2025
Stolen from nymius's [pr](bitcoindevkit/bdk#1986)
on bitcoindevkit/bdk regarding the same.
@notmandatory notmandatory moved this from In Progress to Needs Review in BDK Chain Jul 29, 2025
@ValuedMammal
Copy link
Copy Markdown
Collaborator

ACK 066c4cd

@ValuedMammal ValuedMammal merged commit 1074a86 into bitcoindevkit:master Jul 29, 2025
18 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in BDK Chain Jul 29, 2025
@nymius nymius deleted the ci/replace-grcov-by-cargo-llvm-cov branch July 30, 2025 12:27
@oleonardolima oleonardolima mentioned this pull request Jul 31, 2025
16 tasks
kwsantiago pushed a commit to kwsantiago/bdk that referenced this pull request Aug 5, 2025
066c4cd ci: replace grcov by cargo-llvm-cov (nymius)

Pull request description:

  ### Description

  As explained in bitcoindevkit#1984 , I discovered some misreportings in the coverage information given by grcov.

  Fixes bitcoindevkit#1984

  ### Notes to the reviewers

  The discussion about the tool to use is open, but I'm adding this PR to showcase how a change from `grcov` to `cargo-llvm-cov` would look like and the improvements in reporting this change will bring. [Look the report in `coveralls`](https://coveralls.io/github/nymius/bdk?branch=ci/replace-grcov-by-cargo-llvm-cov) to get a better perspective of them.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK 066c4cd
  oleonardolima:
    ACK 066c4cd

Tree-SHA512: d237fcc36efb6a4d3ccfaa371c2c70fc18ee40b48ca48f1230c5df6dca093f57bc1096927ddb15f9cae59a4640d9e34bf3ef1a309037e21fe0e8348e132bf38d
ValuedMammal added a commit to bitcoindevkit/bdk_wallet that referenced this pull request Feb 24, 2026
527037c ci(coverage): Switch to cargo-llvm-cov for code coverage (copilot-swe-agent[bot])

Pull request description:

  ### Description

  Replaces `grcov` with `cargo-llvm-cov` for coverage generation. `grcov` lacks branch coverage support and has other limitations.

  **Workflow changes:**
  - Use nightly toolchain with `cargo-llvm-cov`
  - Set `RUSTFLAGS="--cfg coverage_nightly"` during coverage runs only
  - Remove `lcov` tools and old coverage environment variables
  - Enable branch coverage with `--branch` flag
  - Add `--quiet` flag to reduce output verbosity

  **Code changes:**
  - Enable `coverage_attribute` feature via `#[cfg_attr(coverage_nightly, feature(coverage_attribute))]` in `lib.rs`
  - Exclude test modules from coverage with `#[cfg_attr(coverage_nightly, coverage(off))]` on 13 test modules
  - Add `coverage_nightly` to `[lints.rust]` in `Cargo.toml` to declare the custom cfg

  Stable builds are unaffected. Coverage exclusions only activate when the cfg is set.

  ### Notes to the reviewers

  The `coverage_nightly` cfg is only set during coverage generation in CI. Regular builds and tests use stable toolchain without this cfg.

  Branch coverage is now explicitly enabled, providing more detailed coverage metrics than the previous grcov setup.

  ### Changelog notice

  - ci: Switch to `cargo-llvm-cov` for code coverage

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  <!-- START COPILOT ORIGINAL PROMPT -->

  <details>

  <summary>Original prompt</summary>

  >
  > ----
  >
  > *This section details on the original issue you should resolve*
  >
  > <issue_title>[coverage] Consider using `cargo-llvm-cov`</issue_title>
  > <issue_description>**Describe the enhancement**
  >
  > Switch to using [`llvm-cov`](https://crates.io/crates/cargo-llvm-cov) in `.github/workflows/code_coverage.yml` for generating coverage data. For example see bitcoindevkit/bdk#1986.
  >
  > **Impact**
  > - [ ] Blocking production usage
  > - [ ] Nice-to-have / UX improvement
  > - [x] Developer experience / maintainability
  >
  > **Additional context**
  >
  > - `grcov` has some limitations including lacking support for branch coverage which makes it a less appealing option.
  > - bitcoindevkit/bdk#1984</issue_description>
  >
  > ## Comments on the Issue (you are @copilot in this section)
  >
  > <comments>
  > </comments>
  >

  </details>

  <!-- START COPILOT CODING AGENT SUFFIX -->

  - Fixes #366

  <!-- START COPILOT CODING AGENT TIPS -->
  ---

  💡 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](https://gh.io/copilot-coding-agent-tips) in the docs.

ACKs for top commit:
  ValuedMammal:
    ACK 527037c
  notmandatory:
    ACK 527037c
  luisschwab:
    ACK 527037c

Tree-SHA512: c5dc740c3e5b90b12b92ccff0581f9ca21ae45f3b08b486b58d6f9bdcc54865999b48a1eeef1349a0fd81727bdba18b5de615e60cc9e0e41cdda6d96bc50cc13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Noise in coverage scores

5 participants