pulumi/scripts/gocover.sh
joeduffy fc1cd2c01e Make a publish script; fix sed for multi-OS compat
This change creates a scripts/ folder, moves our existing shell
script, gocover.sh, underneath it, and factors the publish logic
out of the Makefile and into the publish.sh file.

The syntax for sed differs between Mac OS X and GNU versions of
the tool, which is rather annoying.  This fixes it by leveraging
the fact that `sed -i.bak ...` works, although we now need to
clean up the *.bak file left behind.  (No big deal and way better
than maintaining OS-dependent logic.)
2017-07-21 09:37:14 -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