9fb98cfb33
CircleCI does everything but better.
28 lines
918 B
Bash
Executable File
28 lines
918 B
Bash
Executable File
#!/bin/bash
|
|
# Issue: https://github.com/mattn/goveralls/issues/20
|
|
# Source: https://github.com/uber/go-torch/blob/63da5d33a225c195fea84610e2456d5f722f3963/.test-cover.sh
|
|
|
|
cd ${GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
|
|
|
|
echo "mode: count" > profile.cov
|
|
FAIL=0
|
|
|
|
# Standard go tooling behavior is to ignore dirs with leading underscors
|
|
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d | grep -v '^./vendor/');
|
|
do
|
|
if ls $dir/*.go &> /dev/null; then
|
|
go test -v -covermode=count -coverprofile=profile.tmp $dir || FAIL=$?
|
|
if [ -f profile.tmp ]
|
|
then
|
|
tail -n +2 < profile.tmp >> profile.cov
|
|
rm profile.tmp
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# Failures have incomplete results, so don't send
|
|
[ "$FAIL" -ne 0 ] && exit 1
|
|
|
|
goveralls -service=circle-ci -v -coverprofile=profile.cov
|
|
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f profile.cov
|