ci/cov.sh: Add
This commit is contained in:
parent
c9ef6ab9c9
commit
ef0e197a63
2 changed files with 20 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,3 +5,4 @@
|
|||
*.got.svg
|
||||
e2e_report.html
|
||||
bin
|
||||
out
|
||||
|
|
|
|||
19
ci/cov.sh
Executable file
19
ci/cov.sh
Executable 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 "$@"
|
||||
Loading…
Reference in a new issue