0
0
Fork 0
bleve/docs/project-code-coverage.sh

53 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2014-11-21 20:02:17 +01:00
#!/bin/bash
echo "mode: count" > acc.out
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
cat profile.out | grep -v "mode: count" >> acc.out
2014-11-21 20:02:17 +01:00
fi
else
exit 1
fi
2014-11-21 20:02:17 +01:00
fi
done
# collect integration test coverage
echo "mode: count" > integration-acc.out
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
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
fi
2014-11-21 20:02:17 +01:00
rm -rf ./profile.out
rm -rf ./acc.out
rm -rf ./integration-acc.out
rm -rf ./merged.out