Skip to content

Instantly share code, notes, and snippets.

@kevina
Last active November 16, 2017 23:54
Show Gist options
  • Save kevina/0b81bb07379138c37b65f785a88b13c0 to your computer and use it in GitHub Desktop.
Save kevina/0b81bb07379138c37b65f785a88b13c0 to your computer and use it in GitHub Desktop.
Standard script to run tests for ipfs projects.
set -e
display_and_run() {
echo "*** $@"
"$@"
}
# Vet
display_and_run go vet ./...
# Test
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
go list -f '{{if (len .TestGoFiles)}}{{.ImportPath}}{{end}}' ./... \
| grep -v /vendor/ \
| while read pkg; do
profile="coverage.$(echo "$pkg" | md5sum | head -c 16).txt"
display_and_run go test -v $TEST_FLAGS -coverprofile="$profile" -covermode=atomic "$pkg"
done
# Doesn't count as a failure.
echo "*** Processing coverage report"
bash <(curl -s https://codecov.io/bash) || true
else
display_and_run go test -v $TEST_FLAGS ./...
fi
@kevina
Copy link
Author

kevina commented Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment