Skip to content

Commit

Permalink
More travis updates
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Mar 16, 2023
1 parent 11a9d13 commit d84c64e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
27 changes: 18 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ language: go
sudo: false
go:
- 1.20.x
- 1.18.x
- 1.19.x
go_import_path: github.com/nats-io/graft

install:
- go get -t ./...
- go get github.com/nats-io/nats-server/v2
- go get github.com/mattn/goveralls
- go get github.com/wadey/gocovmerge
- if [[ "$TRAVIS_GO_VERSION" =~ 1.20 ]]; then
go install github.com/mattn/goveralls@latest;
go install github.com/wadey/gocovmerge@latest;
go install honnef.co/go/tools/cmd/staticcheck@latest;
go install github.com/client9/misspell/cmd/misspell@latest;
fi

before_script:
- $(exit $(go fmt ./... | wc -l))
- go vet ./...
- if [[ "$TRAVIS_GO_VERSION" =~ 1.20 ]]; then
find . -type f -name "*.go" | xargs misspell -error -locale US;
staticcheck ./...;
fi

script:
- go fmt ./...
- go vet ./...
- go test -i -race ./...
- go test -v -race ./...
- ./scripts/cov.sh TRAVIS
- if [[ "$TRAVIS_GO_VERSION" =~ 1.20 ]]; then ./scripts/cov.sh TRAVIS; else go test -race -v -p=1 ./... --failfast -vet=off; fi
after_success:
- if [[ "$TRAVIS_GO_VERSION" =~ 1.20 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi
11 changes: 5 additions & 6 deletions scripts/cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

rm -rf ./cov
mkdir cov
go test -v -covermode=count -coverprofile=./cov/graft.out
go test -v -covermode=atomic -coverprofile=./cov/graft.out
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 d84c64e

Please sign in to comment.