2014-11-21 20:02:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "mode: count" > acc.out
|
2016-04-08 23:06:25 +02:00
|
|
|
for Dir in . $(find ./* -maxdepth 10 -type d | grep -v vendor);
|
2014-11-21 20:02:17 +01:00
|
|
|
do
|
|
|
|
if ls $Dir/*.go &> /dev/null;
|
|
|
|
then
|
|
|
|
returnval=`go test -coverprofile=profile.out -covermode=count $Dir`
|
|
|
|
echo ${returnval}
|
|
|
|
if [[ ${returnval} != *FAIL* ]]
|
|
|
|
then
|
|
|
|
if [ -f profile.out ]
|
|
|
|
then
|
2016-04-08 23:06:25 +02:00
|
|
|
cat profile.out | grep -v "mode: count" >> acc.out
|
2014-11-21 20:02:17 +01:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
exit 1
|
2016-04-08 23:06:25 +02:00
|
|
|
fi
|
2014-11-21 20:02:17 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# collect integration test coverage
|
|
|
|
echo "mode: count" > integration-acc.out
|
2016-08-31 19:52:19 +02:00
|
|
|
INTPACKS=`go list ./... | grep -v vendor | grep -v utils | grep -v 'store/test' | grep -v docs | xargs | sed 's/ /,/g'`
|
2014-11-21 20:02:17 +01:00
|
|
|
returnval=`go test -coverpkg=$INTPACKS -coverprofile=profile.out -covermode=count ./test`
|
|
|
|
if [[ ${returnval} != *FAIL* ]]
|
|
|
|
then
|
|
|
|
if [ -f profile.out ]
|
|
|
|
then
|
2016-04-08 23:06:25 +02:00
|
|
|
cat profile.out | grep -v "mode: count" >> integration-acc.out
|
2014-11-21 20:02:17 +01:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat acc.out integration-acc.out | go run docs/merge-coverprofile.go > merged.out
|
|
|
|
|
|
|
|
if [ -n "$COVERALLS" ]
|
|
|
|
then
|
2015-11-23 17:10:55 +01:00
|
|
|
export GIT_BRANCH=$TRAVIS_BRANCH
|
2014-12-29 19:26:59 +01:00
|
|
|
goveralls -service drone.io -coverprofile=merged.out -repotoken $COVERALLS
|
2014-11-25 22:23:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$COVERHTML" ]
|
|
|
|
then
|
|
|
|
go tool cover -html=merged.out
|
2016-04-08 23:06:25 +02:00
|
|
|
fi
|
2014-11-21 20:02:17 +01:00
|
|
|
|
|
|
|
rm -rf ./profile.out
|
|
|
|
rm -rf ./acc.out
|
|
|
|
rm -rf ./integration-acc.out
|
2016-04-08 23:06:25 +02:00
|
|
|
rm -rf ./merged.out
|