...

Text file src/cdr.dev/slog/ci/test.mk

Documentation: cdr.dev/slog/ci

     1test: gotest ci/out/coverage.html
     2ifdef CI
     3test: coveralls
     4endif
     5
     6ci/out/coverage.html: gotest
     7	go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
     8
     9coveralls: gotest
    10	# https://github.com/coverallsapp/github-action/blob/master/src/run.ts
    11	echo "--- coveralls"
    12	export GIT_BRANCH="$$GITHUB_REF"
    13	export BUILD_NUMBER="$$GITHUB_SHA"
    14	if [[ $$GITHUB_EVENT_NAME == pull_request ]]; then
    15	  export CI_PULL_REQUEST="$$(jq .number "$$GITHUB_EVENT_PATH")"
    16	  BUILD_NUMBER="$$BUILD_NUMBER-PR-$$CI_PULL_REQUEST"
    17	fi
    18	goveralls -coverprofile=ci/out/coverage.prof -service=github
    19
    20gotest:
    21	go test -covermode=count -coverprofile=ci/out/coverage.prof -coverpkg=./... $${GOTESTFLAGS-} ./...
    22	sed -i.bak '/internal\/assert/d' ci/out/coverage.prof

View as plain text