Run unit tests in circle and include their coverage in the report. Report coveralls.io from Circle.

This commit is contained in:
Tom Wilkie committed 2015-07-10 18:19:50 +00:00
1 parent ce5052305d
commit 32b2ec4038
5 files changed
+40 -19

No files matched your search

Executable
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
go get github.com/weaveworks/weave/testing/cover
if [ -n "$COVERDIR" ] ; then
coverdir="$COVERDIR"
else
coverdir=$(mktemp -d coverage.XXXXXXXXXX)
fi
mkdir -p $coverdir
fail=0
for dir in $(find . -type f -name '*_test.go' | xargs -n1 dirname | grep -v prog | sort -u); do
go get -t -tags netgo $dir
output=$(mktemp $coverdir/unit.XXXXXXXXXX)
if ! go test -cpu 4 -tags netgo -covermode=count -coverprofile=$output $dir ; then
fail=1
fi
done
if [ -z "$COVERDIR" ] ; then
cover $coverdir/* >profile.cov
rm -rf $coverdir
go tool cover -html=profile.cov -o=coverage.html
fi
exit $fail