Skip to content

Instantly share code, notes, and snippets.

@mschoch
Last active August 29, 2015 14:00
Show Gist options
  • Save mschoch/11018712 to your computer and use it in GitHub Desktop.
Save mschoch/11018712 to your computer and use it in GitHub Desktop.
submit multi-package code coverage reports to coveralls - modified from https://github.com/gopns/gopns/blob/master/test-coverage.sh
#!/bin/bash
echo "mode: set" > acc.out
for Dir in . $(find ./* -maxdepth 10 -type d );
do
if ls $Dir/*.go &> /dev/null;
then
returnval=`go test -coverprofile=profile.out $Dir`
echo ${returnval}
if [[ ${returnval} != *FAIL* ]]
then
if [ -f profile.out ]
then
cat profile.out | grep -v "mode: set" >> acc.out
fi
else
exit 1
fi
fi
done
if [ -n "$COVERALLS" ]
then
goveralls -service drone.io -coverprofile=acc.out -repotoken $COVERALLS
fi
rm -rf ./profile.out
rm -rf ./acc.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment