diff --git a/.travis.yml b/.travis.yml index 075885b6d..a4a7914aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,8 @@ before_script: - git config --global url.https://github.com/.insteadOf ssh://git@github.com/ script: -- make test +- make fmtcheck generate +- bash scripts/travis.sh - go mod verify - make e2etest - GOOS=windows go build -mod=vendor diff --git a/Makefile b/Makefile index 0c3f2e553..143bc1ff7 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ plugin-dev: generate # we run this one package at a time here because running the entire suite in # one command creates memory usage issues when running in Travis-CI. test: fmtcheck generate - go list -mod=vendor $(TEST) | xargs -t -n4 go test $(TESTARGS) -mod=vendor -timeout=2m -parallel=4 -coverprofile=coverage.txt -covermode=atomic + go list -mod=vendor $(TEST) | xargs -t -n4 go test $(TESTARGS) -mod=vendor -timeout=2m -parallel=4 # testacc runs acceptance tests testacc: fmtcheck generate diff --git a/scripts/travis.sh b/scripts/travis.sh index 90e5cb9ff..dba7d036b 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -1,14 +1,12 @@ #!/bin/bash +set -e +echo "" > coverage.txt -# Consistent output so travis does not think we're dead during long running -# tests. -export PING_SLEEP=30 -bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" & -PING_LOOP_PID=$! - -make testacc -TEST_OUTPUT=$? - -kill $PING_LOOP_PID -exit $TEST_OUTPUT +for d in $(go list ./... | grep -v vendor); do + go test -mod=vendor -timeout=2m -parallel=4 -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done