From 4e24d49ab20812caddbd7ba9cc71ff249b3320f8 Mon Sep 17 00:00:00 2001 From: Ying Li Date: Tue, 20 Oct 2015 14:20:41 -0700 Subject: [PATCH] Use the makefile targets for running the test in CircleCI. Push coverage output to codecov. Signed-off-by: Ying Li --- Makefile | 3 +-- circle.yml | 22 +++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 0f3bce59eb..f2e4d4cc84 100644 --- a/Makefile +++ b/Makefile @@ -87,9 +87,9 @@ gen-cover: @rm -rf "$(COVERDIR)" @mkdir -p "$(COVERDIR)" $(foreach PKG,$(PKGS),$(call gocover,$(PKG))) - @echo "mode: $(COVERMODE)" > "$(COVERPROFILE)" cover: gen-cover + @echo "mode: $(COVERMODE)" > "$(COVERPROFILE)" @grep -h -v "^mode:" "$(COVERDIR)"/*.cover >> "$(COVERPROFILE)" @go tool cover -func="$(COVERPROFILE)" @go tool cover -html="$(COVERPROFILE)" @@ -100,7 +100,6 @@ define formatcov endef ci: OPTS = race test.short - GO_EXC = godep go ci: gen-cover aggregate-cover: diff --git a/circle.yml b/circle.yml index e176092749..ad6a1bdb71 100644 --- a/circle.yml +++ b/circle.yml @@ -38,7 +38,7 @@ dependencies: # For the stable go version, additionally install linting tools - > gvm use stable && - go get github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/golang/lint/golint + go get github.com/axw/gocov/gocov github.com/golang/lint/golint test: pre: # Output the go versions we are going to test @@ -58,18 +58,14 @@ test: override: # Test stable, and report - # Preset the goverall report file - - echo "$CIRCLE_PAIN" > ~/goverage.report - - gvm use stable; go list ./... | xargs -L 1 -I{} rm -f $GOPATH/src/{}/coverage.out: - pwd: $BASE_STABLE - - - gvm use stable; go list ./... | xargs -L 1 -I{} godep go test -race -test.short -coverprofile=$GOPATH/src/{}/coverage.out {}: + - gvm use stable && make ci: timeout: 600 pwd: $BASE_STABLE - # post: - # Aggregate and report to coveralls - # - gvm use stable; go list ./... | xargs -L 1 -I{} cat "$GOPATH/src/{}/coverage.out" | grep -v "$CIRCLE_PAIN" >> ~/goverage.report: - # pwd: $BASE_STABLE - # - gvm use stable; goveralls -service circleci -coverprofile=/home/ubuntu/goverage.report -repotoken $COVERALLS_TOKEN: - # pwd: $BASE_STABLE + post: + # Aggregate and report to codecov.io + - make aggregate-cover: + pwd: $BASE_STABLE + + - bash <(curl -s https://codecov.io/bash): + pwd: $BASE_STABLE