Last active
August 28, 2016 11:25
-
-
Save emersion/49d4dda535497002639626bd9e16480c to your computer and use it in GitHub Desktop.
Codecov for all Go packages in a repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| echo "" > coverage.txt | |
| retval=0 | |
| for d in $(find . -maxdepth 10 \( -path ./vendor -o -path './.*' -o -name '_*' \) -prune -o -type d -print); do | |
| if ls $d/*.go &> /dev/null; then | |
| go test -v -coverprofile=profile.out -covermode=atomic $d | |
| pkgretval=$? | |
| if [ $pkgretval -ne 0 ]; then | |
| retval=$pkgretval | |
| fi | |
| if [ -f profile.out ]; then | |
| cat profile.out >> coverage.txt | |
| rm profile.out | |
| fi | |
| fi | |
| done | |
| exit $retval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use: add this to the
scriptsection of your.travis.ymlbash <(curl -sL https://gist.github.com/emersion/49d4dda535497002639626bd9e16480c/raw/codecov-go.sh)