Skip to content

Commit 8704898

Browse files
committed
hack/test-go.sh: generate coverage reports
1 parent 0ad119b commit 8704898

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hack/test-go.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ if [ -n "${JUNIT_REPORT-}" ]; then
1414
_V="-v"
1515
for i do [ "$i" != "-v" ] || _V=""; done
1616
RETCODE=0
17-
go test $_V -json "$@" >"$GO_TEST_JSON" || RETCODE=$?
17+
go test $_V -coverprofile=coverage.out "-outputdir=$ARTIFACT_DIR" -json "$@" >"$GO_TEST_JSON" || RETCODE=$?
18+
19+
go tool cover "-html=$ARTIFACT_DIR/coverage.out" "-o=$ARTIFACT_DIR/coverage.html"
1820

1921
! grep "^[^{]" "$GO_TEST_JSON" || exit $RETCODE
2022
go run "$(dirname "$0")/junitxml/junitxml.go" <"$GO_TEST_JSON" >"$REPORT_FILE"

0 commit comments

Comments
 (0)