Skip to content

Commit

Permalink
Merge pull request #825 from nats-io/travis_and_coveralls
Browse files Browse the repository at this point in the history
Run coverage, but push to coverall only after_success
  • Loading branch information
kozlovic committed Sep 20, 2021
2 parents 9292154 + 7524084 commit 986d073
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -17,3 +17,5 @@ before_script:
script:
- go test -modfile=go_test.mod -v -run=TestNoRace -p=1 ./... --failfast -vet=off
- if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then ./scripts/cov.sh TRAVIS; else go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off; fi
after_success:
- if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi
9 changes: 4 additions & 5 deletions scripts/cov.sh
Expand Up @@ -10,10 +10,9 @@ go test -modfile=go_test.mod --failfast -vet=off -v -race -covermode=atomic -cov
gocovmerge ./cov/*.out > acc.out
rm -rf ./cov

# If we have an arg, assume travis run and push to coveralls. Otherwise launch browser results
if [[ -n $1 ]]; then
$HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci
rm -rf ./acc.out
else
# Without argument, launch browser results. We are going to push to coveralls only
# from Travis.yml and after success of the build (and result of pushing will not affect
# build result).
if [[ $1 == "" ]]; then
go tool cover -html=acc.out
fi

0 comments on commit 986d073

Please sign in to comment.