ci/cov.sh: Add

This commit is contained in:
Anmol Sethi 2023-01-08 09:02:21 -08:00
parent c9ef6ab9c9
commit ef0e197a63
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
2 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
*.got.svg
e2e_report.html
bin
out

19
ci/cov.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set -eu
cd -- "$(dirname "$0")/.."
. ./ci/sub/lib.sh
main() {
if [ "$*" = "" ]; then
set ./...
fi
mkdir -p out
capcode ./ci/test.sh -covermode=atomic -coverprofile=out/cov.prof "$@"
go tool cover -html=out/cov.prof -o=out/cov.html
go tool cover -func=out/cov.prof | grep '^total:' \
| sed 's#^total:.*(statements)[[:space:]]*\([0-9.%]*\)#TOTAL:\t\1#'
return "$code"
}
main "$@"