add coverage to travis

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-02-18 12:56:34 -05:00
parent ac2e616697
commit 3475db4ba4
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3
3 changed files with 18 additions and 1 deletions

4
.gitignore vendored
View file

@ -47,3 +47,7 @@ server/server
testreg
.certs
cross/
# Go coverage results
coverage.txt
profile.out

View file

@ -26,6 +26,8 @@
- test -z "$(gofmt -s -l . | grep -v vendor | tee /dev/stderr)"
- DOCKER_API_VERSION=1.35 make dind dtest
- make release
after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
provider: releases
api_key:

View file

@ -67,6 +67,17 @@ staticcheck: ## Verifies `staticcheck` passes
@echo "+ $@"
@staticcheck $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr
.PHONY: cover
cover: ## Runs go test with coverage
@echo "" > coverage.txt
@for d in $(shell go list ./... | grep -v vendor); do \
go test -coverprofile=profile.out -covermode=atomic "$d"; \
if [ -f profile.out ]; then \
cat profile.out >> coverage.txt; \
rm profile.out; \
fi; \
done;
.PHONY: install
install: ## Installs the executable or package
@echo "+ $@"
@ -174,7 +185,7 @@ dtest: ## Run the tests in a docker container
-e DOCKER_CERT_PATH=/etc/docker/ssl \
-e DOCKER_API_VERSION \
$(DOCKER_IMAGE) \
make test
make test cover
.PHONY: help
help: