Skip to content

Commit c9dcfbb

Browse files
committed
chore: Add script to create the coverge report
1 parent 3f09cd4 commit c9dcfbb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/coverage.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
open_browser() {
5+
if command -v open >/dev/null; then
6+
open "$1"
7+
elif command -v xdg-open >/dev/null; then
8+
xdg-open "$1"
9+
elif command -v start >/dev/null; then
10+
start "$1"
11+
else
12+
echo "Open the report manually: $1"
13+
fi
14+
}
15+
16+
cabal clean
17+
cabal test all --enable-coverage
18+
19+
HPCDIRS=$(find . -type f -name '*.mix' -exec dirname {} \; | xargs dirname | sort -u | sed 's/^/--hpcdir=/')
20+
TIX=$(find . -name '*.tix' | head -n1)
21+
22+
hpc markup \
23+
$HPCDIRS \
24+
--exclude=dataframe:Dataframe \
25+
$TIX \
26+
--destdir=coverage-html \
27+
--reset
28+
29+
open_browser ./coverage-html/hpc_index.html

0 commit comments

Comments
 (0)