Skip to content

Commit 5c42b9f

Browse files
committed
codecov: fix --ignore-filename-regex pattern + extend to CI
1 parent 24ff457 commit 5c42b9f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/coverage.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# script to run project tests and report code coverage
44
# uses llvm-cov (https://github.com/taiki-e/cargo-llvm-cov)
55

6+
# note: this is in addition to common ignore patterns llvm-cov appends on its own
7+
IGNORE_PATTERN='/rgb\-lib/(migration/src/main\.rs|src/database/entities|src/wallet/test|target/llvm\-cov\-target)($|/)'
8+
69
LLVM_COV_OPTS=()
710
CARGO_TEST_OPTS=("--")
8-
COV="cargo llvm-cov --workspace --all-features"
11+
COV="cargo llvm-cov --verbose --workspace --all-features --ignore-filename-regex $IGNORE_PATTERN"
912

1013
_die() {
1114
echo "err $*"
@@ -33,11 +36,11 @@ help() {
3336
# cmdline arguments
3437
while [ -n "$1" ]; do
3538
case $1 in
36-
-h|--help)
39+
-h | --help)
3740
help
3841
exit 0
3942
;;
40-
-t|--test)
43+
-t | --test)
4144
CARGO_TEST_OPTS+=("$2")
4245
shift
4346
;;
@@ -66,10 +69,7 @@ rustup component add llvm-tools-preview
6669
cargo install cargo-llvm-cov
6770

6871
_tit "generating coverage report"
69-
IGNORE_PATTERN="/rgb\-lib(/.*)?/(tests|examples|benches|migration/src/main.rs|src/database/entities|src/wallet/test)($|/)|/rgb\-lib/target/llvm\-cov\-target($|/)|^$HOME/\.cargo/(registry|git)/|^$HOME/\.rustup/toolchains($|/)"
70-
$COV --html \
71-
--ignore-filename-regex "$IGNORE_PATTERN" \
72-
"${LLVM_COV_OPTS[@]}" "${CARGO_TEST_OPTS[@]}" --include-ignored
72+
$COV --html "${LLVM_COV_OPTS[@]}" "${CARGO_TEST_OPTS[@]}" --include-ignored
7373

7474
## show html report location
7575
echo "generated html report: target/llvm-cov/html/index.html"

0 commit comments

Comments
 (0)