diff --git a/Makefile b/Makefile index 06fa0050..df4c3482 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,7 @@ container: generate-docker-version: echo latest $(VERSION) > versions + .PHONY: test test: vet ifndef CI @@ -147,9 +148,18 @@ ifndef CI else @mkdir -p .cover go test -v -mod=vendor -race $(LDFLAGS) -coverprofile=".cover/c.out" ./... - go tool cover -html ".cover/c.out" -o .cover/all.html endif +.PHONY: cover +cover: + @echo "" + @echo "=====> Total test coverage: <=====" + @echo "" + # Print the overall coverage here for quick access. + $Q go tool cover -func ".cover/c.out" | grep "total:" | awk '{print $$3}' + # Generate the HTML report that can be viewed from the browser in CI. + $Q go tool cover -html ".cover/c.out" -o .cover/all.html + .PHONY: test-ssh-server test-ssh-server: docker-compose -f ssh_server_tests/docker-compose.yml up diff --git a/cfsetup.yaml b/cfsetup.yaml index 45177dcb..1131c256 100644 --- a/cfsetup.yaml +++ b/cfsetup.yaml @@ -29,6 +29,12 @@ buster: &buster - export GOARCH=amd64 - export FIPS=true - make cloudflared + cover: + build_dir: *build_dir + builddeps: *build_deps + pre-cache: *build_pre_cache + post-cache: + - make cover # except FIPS (handled in github-fips-release-pkgs) and macos (handled in github-release-macos-amd64) github-release-pkgs: build_dir: *build_dir