Skip to content

Commit 06310f1

Browse files
committed
Merge #708: Change configs for source-base code coverage
0010ecd Add badge to README (wszdexdrf) 6904117 Change configs for source-base code coverage (wszdexdrf) Pull request description: ### Description This also changes the code coverage front end to coveralls instead of codecov, which had some issues with other changes in the PR. This will provide better and more accurate code coverage reports. ### Notes to the reviewers The tests run before generating the report are not exhaustive (not exhaustive earlier too, but I added as many as I could), and hence the report won't be 100% accurate. ### 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 fmt` and `cargo clippy` before committing ACKs for top commit: danielabrozzoni: ACK 0010ecd Tree-SHA512: 04a21b7481b80287cf8a31276238b0a5958871310664363f54d53779bb2dda6f49198baaf3b5471667fa6131443b022aabd86f2e3b1cfcf5d4aacadf137a166e
2 parents 8dd0209 + 0010ecd commit 06310f1

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed

.github/workflows/code_coverage.yml

+31-13
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,53 @@ on: [push]
33
name: Code Coverage
44

55
jobs:
6-
76
Codecov:
87
name: Code Coverage
98
runs-on: ubuntu-latest
109
env:
11-
CARGO_INCREMENTAL: '0'
12-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
13-
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
10+
RUSTFLAGS: "-Cinstrument-coverage"
11+
RUSTDOCFLAGS: "-Cinstrument-coverage"
12+
LLVM_PROFILE_FILE: "report-%p-%m.profraw"
1413

1514
steps:
1615
- name: Checkout
1716
uses: actions/checkout@v2
17+
- name: Install lcov tools
18+
run: sudo apt-get install lcov -y
1819
- name: Install rustup
1920
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
2021
- name: Set default toolchain
2122
run: rustup default nightly
2223
- name: Set profile
2324
run: rustup set profile minimal
25+
- name: Add llvm tools
26+
run: rustup component add llvm-tools-preview
2427
- name: Update toolchain
2528
run: rustup update
29+
- name: Cache cargo
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.cargo/bin/
34+
~/.cargo/registry/index/
35+
~/.cargo/registry/cache/
36+
~/.cargo/git/db/
37+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
38+
- name: Install grcov
39+
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
2640
- name: Test
27-
run: cargo test --features all-keys,compiler,esplora,ureq,compact_filters --no-default-features
28-
29-
- id: coverage
30-
name: Generate coverage
31-
uses: actions-rs/[email protected]
41+
run: cargo test --features default,minimal,all-keys,compact_filters,key-value-db,compiler,sqlite,sqlite-bundled,test-electrum,verify,test-rpc
42+
- name: Run grcov
43+
run: mkdir coverage; grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o ./coverage/lcov.info
44+
- name: Generate HTML coverage report
45+
run: genhtml -o coverage-report.html ./coverage/lcov.info
3246

33-
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v2
47+
- name: Coveralls upload
48+
uses: coverallsapp/github-action@master
49+
with:
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Upload artifact
52+
uses: actions/upload-artifact@v2
3553
with:
36-
file: ${{ steps.coverage.outputs.report }}
37-
directory: ./coverage/reports/
54+
name: coverage-report
55+
path: coverage-report.html

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://crates.io/crates/bdk"><img alt="Crate Info" src="https://img.shields.io/crates/v/bdk.svg"/></a>
1212
<a href="https://github.com/bitcoindevkit/bdk/blob/master/LICENSE"><img alt="MIT or Apache-2.0 Licensed" src="https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg"/></a>
1313
<a href="https://github.com/bitcoindevkit/bdk/actions?query=workflow%3ACI"><img alt="CI Status" src="https://github.com/bitcoindevkit/bdk/workflows/CI/badge.svg"></a>
14-
<a href="https://codecov.io/gh/bitcoindevkit/bdk"><img src="https://codecov.io/gh/bitcoindevkit/bdk/branch/master/graph/badge.svg"/></a>
14+
<a href="https://coveralls.io/github/bitcoindevkit/bdk?branch=master"><img src="https://coveralls.io/repos/github/bitcoindevkit/bdk/badge.svg?branch=master"/></a>
1515
<a href="https://docs.rs/bdk"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-bdk-green"/></a>
1616
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html"><img alt="Rustc Version 1.56.1+" src="https://img.shields.io/badge/rustc-1.56.1%2B-lightgrey.svg"/></a>
1717
<a href="https://discord.gg/d7NkDKm"><img alt="Chat on Discord" src="https://img.shields.io/discord/753336465005608961?logo=discord"></a>

codecov.yaml

-13
This file was deleted.

0 commit comments

Comments
 (0)