mirror of
https://github.com/privacy-scaling-explorations/chiquito.git
synced 2026-01-11 06:57:54 -05:00
Adds test coverage reporting to the Chiquito project. ## Demo Check out the code coverage report on my fork https://app.codecov.io/github/nullbitx8/chiquito Check out my fork to see how the `Rust` workflow in the project's Github Actions now runs tests with coverage reporting. https://github.com/nullbitx8/chiquito/actions/runs/6653135943/job/18078525896 It looks like Chiquito already has a codecov access token, so we can already see the results here https://app.codecov.io/github/privacy-scaling-explorations/chiquito/tree/add-test-coverage-reporting
32 lines
1.1 KiB
Makefile
32 lines
1.1 KiB
Makefile
|
|
precommit:
|
|
cargo check --all-features
|
|
cargo clippy --all-targets --all-features -- -D warnings
|
|
cargo fmt --all -- --check
|
|
|
|
build:
|
|
cargo build
|
|
maturin develop
|
|
|
|
test:
|
|
# clean test coverage directory
|
|
rm -rf ./target/test_coverage
|
|
mkdir -p ./target/test_coverage
|
|
|
|
# install dependencies
|
|
rustup component add llvm-tools-preview
|
|
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "./target/test_coverage"
|
|
chmod +x ./target/test_coverage/grcov
|
|
|
|
# run tests
|
|
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='target/test_coverage/profraw/cargo-test-%p-%m.profraw' cargo test --verbose
|
|
|
|
# generate html coverage report
|
|
./target/test_coverage/grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/html
|
|
|
|
# generate lcov coverage report
|
|
./target/test_coverage/grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/tests.lcov
|
|
|
|
|
|
.PHONY: precommit build test
|