Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Code Coverage

on: [push, pull_request]

permissions:
contents: read
pull-requests: write

jobs:
Coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2026-04-09
override: true
cache: true
components: llvm-tools-preview
- name: Install cargo-llvm-cov
run: if [[ ! -e ~/.cargo/bin/cargo-llvm-cov ]]; then cargo install cargo-llvm-cov; fi
- name: Make coverage directory
run: mkdir coverage
- name: Test and export lcov coverage
run: cargo llvm-cov -q --branch --all --ignore-filename-regex "(examples/|tests/)" --all-features --lcov --output-path ./coverage/lcov.info
env:
RUSTFLAGS: "--cfg coverage_nightly"
- name: Generate HTML coverage report
run: cargo llvm-cov -q --branch --all --ignore-filename-regex "(examples/|tests/)" --all-features --html
env:
RUSTFLAGS: "--cfg coverage_nightly"
- name: Codecov upload
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
files: ./coverage/lcov.info
flags: rust
name: codecov-bdk-tx
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: target/llvm-cov/html
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ description = "Bitcoin transaction building library."
license = "MIT OR Apache-2.0"
readme = "README.md"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }

[dependencies]
miniscript = { version = "12.3.5", default-features = false }
bdk_coin_select = "0.4.0"
Expand Down
1 change: 1 addition & 0 deletions src/finalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl FinalizeMap {
}
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use crate::{Finalizer, Output, PsbtParams, Selection, Signer};
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! `bdk_tx`
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]

Check warning on line 2 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Code Coverage

feature `coverage_attribute` is declared but not used

Check warning on line 2 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Code Coverage

feature `coverage_attribute` is declared but not used
#![warn(missing_docs)]
#![no_std]

Expand Down
1 change: 1 addition & 0 deletions src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl Selection {
}
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use super::*;
Expand Down
1 change: 1 addition & 0 deletions src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl GetKey for Signer {
}
}

#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod test {
use crate::bitcoin::bip32::ChildNumber;
Expand Down