From e3da2e4f80acc30427f5e169cb5db3a57df4e6b2 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 7 Oct 2019 14:58:21 -0700 Subject: [PATCH] Update make targets to require min test coverage --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 600fef1..f448b97 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,25 @@ default: test .PHONY: build build: + go build minitor-go: go build .PHONY: run -run: minitor-go +run: minitor-go build ./minitor-go -debug .PHONY: test test: go test -coverprofile=coverage.out + @echo go tool cover -func=coverage.out + @echo + @# Check min coverage percentage + @go tool cover -func=coverage.out | awk -v target=80.0% \ + '/^total:/ { print "Total coverage: " $$3 " Minimum coverage: " target; if ($$3+0.0 >= target+0.0) print "ok"; else { print "fail"; exit 1; } }' + .PHONY: clean clean: