From cbb1d9c5f6d68bf6bbee6789f757800861598c12 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 13 Jan 2017 19:11:10 +0000 Subject: [PATCH] Update code coverage workflow --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index ab5935f8..c1105995 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,16 @@ deps: tests: $(GO) test `glide novendor` +# The `make cover` command runs all +# tests, and produces and uploads a +# coverage profile to coveralls. + +.PHONY: cover +cover: + echo 'mode: atomic' > main.cover + glide novendor | cut -d '/' -f-2 | xargs -I % sh -c 'touch temp.cover; go test -covermode=count -coverprofile=temp.cover %; tail -n +2 temp.cover >> main.cover; rm temp.cover;' + goveralls -coverprofile=./main.cover -service=circle-ci -repotoken=${COVERALLS} + # The `make glide` command ensures that # all imported dependencies are synced # and located within the vendor folder. @@ -75,6 +85,7 @@ clean: rm -rf vendor $(GO) clean -i `glide novendor` find . -name '*.test' -type f -exec rm -f {} \; + find . -name '*.cover' -type f -exec rm -f {} \; find . -name '*.gen.go' -type f -exec rm -f {} \; # The `make setup` command runs the