Skip to content

Commit 7a2cb6c

Browse files
committed
ci: add code coverage job
Stolen from nymius's [pr](bitcoindevkit/bdk#1986) on bitcoindevkit/bdk regarding the same.
1 parent 1569f05 commit 7a2cb6c

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
on: [push, pull_request]
2+
3+
name: Code Coverage
4+
5+
permissions: {}
6+
7+
jobs:
8+
Codecov:
9+
name: Code Coverage
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
- name: Install lcov tools
17+
run: sudo apt-get install lcov -y
18+
- name: Install Rust toolchain
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: nightly
22+
override: true
23+
profile: minimal
24+
components: llvm-tools-preview
25+
- name: Rust Cache
26+
uses: Swatinem/rust-cache@v2.7.8
27+
- name: Install cargo-llvm-cov
28+
run: if [[ ! -e ~/.cargo/bin/cargo-llvm-cov ]]; then cargo install cargo-llvm-cov; fi
29+
- name: Make coverage directory
30+
run: mkdir coverage
31+
- name: Test and report coverage
32+
run: cargo +nightly llvm-cov -q --doctests --branch --all-features --lcov --output-path ./coverage/lcov.info
33+
- name: Generate HTML coverage report
34+
run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info
35+
- name: Coveralls upload
36+
uses: coverallsapp/github-action@master
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Upload artifact
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: coverage-report
43+
path: coverage-report.html

0 commit comments

Comments
 (0)