add script to create coverage report manually
Some checks failed
Build and test / build (pull_request) Successful in 1m56s
Build and test / check (pull_request) Failing after 1m2s
Build and test / test (pull_request) Failing after 21s
Build and test / docs (pull_request) Has been cancelled

This commit is contained in:
Oystein Kristoffer Tveit 2024-05-01 22:22:11 +02:00
parent d43f1018de
commit c2c23af4d7
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 24 additions and 1 deletions

View File

@ -26,9 +26,10 @@
devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell {
packages = [
(toolchain.withComponents [
"cargo" "rustc" "rustfmt" "clippy"
"cargo" "rustc" "rustfmt" "clippy" "llvm-tools"
])
pkgs.mpv
pkgs.grcov
];
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/";
});

22
scripts/coverage.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
mkdir -p target/coverage
echo "Running tests"
RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="target/coverage/%p-%m.profraw" cargo test --all-features --release --no-fail-fast --lib --bins
echo "Generating coverage report"
grcov \
--source-dir . \
--binary-path ./target/release/deps/ \
--excl-start 'mod test* \{' \
--ignore 'tests/*' \
--ignore "*test.rs" \
--ignore "*tests.rs" \
--ignore "*github.com*" \
--ignore "*libcore*" \
--ignore "*rustc*" \
--ignore "*liballoc*" \
--ignore "*cargo*" \
-t html \
-o ./target/coverage/html \
target/coverage/