Skip to content

Commit

Permalink
Merge pull request #1212 from nats-io/travis_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 27f1d60 + 2c54f4d commit abca9ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -42,6 +42,10 @@ script:
go test -v -p=1 ./... -count=1 -sql=false -failfast;
fi
- set +e
after_success:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ ! $TRAVIS_TAG ]]; then if [[ "$TRAVIS_GO_VERSION" =~ 1.15 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi; fi;
fi

deploy:
provider: script
Expand Down
9 changes: 4 additions & 5 deletions scripts/cov.sh
Expand Up @@ -23,10 +23,9 @@ go test -v -failfast -covermode=atomic -coverprofile=./cov/util.out ./util
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
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 abca9ca

Please sign in to comment.