2024-05-07 07:21:30 -04:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu
|
2022-05-11 18:47:31 -04:00
|
|
|
|
2024-05-07 07:21:30 -04:00
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
2023-07-26 22:38:35 -04:00
|
|
|
|
2024-05-07 07:21:30 -04:00
|
|
|
if ! command -v go-test-coverage &>/dev/null; then
|
|
|
|
go install github.com/vladopajic/go-test-coverage/v2@latest
|
|
|
|
fi
|
|
|
|
if ! command -v tparse &>/dev/null; then
|
|
|
|
go install github.com/mfridman/tparse@latest
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f "$DIR/coverage.html"
|
|
|
|
|
|
|
|
trap cleanup EXIT
|
|
|
|
cleanup() {
|
|
|
|
rm -f "$DIR/coverage.out"
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "Running go test suite ..."
|
|
|
|
go test -json -cover ./... -coverprofile="$DIR/coverage.out" | tparse
|
|
|
|
go tool cover -html="$DIR/coverage.out" -o "$DIR/coverage.html"
|
|
|
|
go-test-coverage -c "$DIR/.testcoverage.yml"
|