pulumi/gocover.sh
Luke Hoban 1d266e38aa Add Go code coverage reports to nightly tests
Adds a make task to generate code coverage for all Go sources.

That make task re-runs the tests, and can be fairly expensive,
so it is enabled only in the nightly tests for now.

Part of #206.
2017-06-23 16:07:05 -07:00

11 lines
514 B
Bash
Executable file

#!/usr/bin/env bash
set -e
export PKGS='./pkg/... ./cmd/... ./lib/aws/provider/...'
export PKGS_COMMA='./pkg/...,./cmd/...,./lib/aws/provider/...'
go test -i $PKGS
go list -f '{{if gt (len .TestGoFiles) 0}}"go test -covermode count -coverprofile {{.Name}}.coverprofile -coverpkg $PKGS_COMMA {{.ImportPath}}"{{end}}' $PKGS | xargs -P100 -I {} bash -c {} 2>&1 | grep -v '^warning: no packages being tested depend on '
gocovmerge `ls *.coverprofile` > coverage.cov
go tool cover -func=coverage.cov
rm *.coverprofile