Enables cross-package code coverage reporting
Signed-off-by: Brian Bland <brian.bland@docker.com>
This commit is contained in:
parent
c56d49b111
commit
aaab336edc
15
circle.yml
15
circle.yml
@ -48,9 +48,6 @@ dependencies:
|
|||||||
gvm use stable &&
|
gvm use stable &&
|
||||||
go get github.com/axw/gocov/gocov github.com/golang/lint/golint
|
go get github.com/axw/gocov/gocov github.com/golang/lint/golint
|
||||||
|
|
||||||
# Disabling goveralls for now
|
|
||||||
# go get github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/golang/lint/golint
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
pre:
|
pre:
|
||||||
# Output the go versions we are going to test
|
# Output the go versions we are going to test
|
||||||
@ -75,25 +72,17 @@ test:
|
|||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
override:
|
override:
|
||||||
|
|
||||||
# Test stable, and report
|
# Test stable, and report
|
||||||
# Preset the goverall report file
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
||||||
# - 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 -tags "$DOCKER_BUILDTAGS" ./... | xargs -L 1 -I{} godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/{}/coverage.out -covermode=count {}:
|
|
||||||
timeout: 600
|
timeout: 600
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
post:
|
post:
|
||||||
# Aggregate and report to coveralls
|
# Report to codecov
|
||||||
- bash <(curl -s https://codecov.io/bash):
|
- bash <(curl -s https://codecov.io/bash):
|
||||||
pwd: $BASE_STABLE
|
pwd: $BASE_STABLE
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
# Disabled coveralls reporting: build breaking sending coverage data to coveralls
|
|
||||||
# Disabled the -race detector due to massive memory usage.
|
# Disabled the -race detector due to massive memory usage.
|
||||||
# Do we want these as well?
|
# Do we want these as well?
|
||||||
# - go get code.google.com/p/go.tools/cmd/goimports
|
# - go get code.google.com/p/go.tools/cmd/goimports
|
||||||
|
7
coverpkg.sh
Executable file
7
coverpkg.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Given a subpackage and the containing package, figures out which packages
|
||||||
|
# need to be passed to `go test -coverpkg`: this includes all of the
|
||||||
|
# subpackage's dependencies within the containing package, as well as the
|
||||||
|
# subpackage itself.
|
||||||
|
DEPENDENCIES="$(go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}' ${1} | grep ${2})"
|
||||||
|
echo "${1} ${DEPENDENCIES}" | xargs echo -n | tr ' ' ','
|
Loading…
Reference in New Issue
Block a user