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
43 changes: 43 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: [push, pull_request]

name: Code Coverage

permissions: {}

jobs:
Codecov:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install lcov tools
run: sudo apt-get install lcov -y
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: llvm-tools-preview
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.8
- 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 report coverage
run: cargo +nightly llvm-cov -q --doctests --branch --all-features --lcov --output-path ./coverage/lcov.info
- name: Generate HTML coverage report
run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report.html
50 changes: 50 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
alias b := build
alias c := check
alias f := fmt
alias t := test
alias p := pre-push

default:
@just --list

# Build the project
build:
cargo build
cargo build --no-default-features

# Check code: formatting, compilation, linting, and commit signature
check:
cargo +nightly fmt -- --check
cargo check --all-features
cargo clippy --all-features --all-targets -- -D warnings
@[ "$(git log --pretty='format:%G?' -1 HEAD)" = "N" ] && \
echo "\n⚠️ Unsigned commit: BDK requires that commits be signed." || \
true

# Format all code
fmt:
cargo +nightly fmt

# Run all tests with all, default and no-default features
test:
cargo test --all-features
cargo test
cargo test --no-default-features

# Generate doc
doc:
cargo doc --open --all-features
cargo doc --open
cargo doc --open --no-default-features

# Generate code coverage
code_cov:
mkdir coverage
touch coverage/lcov.info
cargo +nightly llvm-cov -q --doctests --branch --all-features --lcov --output-path ./coverage/lcov.info
@genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info
open ./coverage-report.html/index.html
rm -rf coverage

# Run pre-push suite: format, check, and test
pre-push: fmt check test
Loading