Changes to tests that run on Travis

- Remove code coverage from Travis and add it to a GitHub Action
that will be run as a nightly.
- Use tag builds to exclude some tests, such as the "norace" or
JS tests. Since "go test" does not support "negative" regexs, there
is no other way.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2022-04-25 13:26:31 -06:00
parent 1a80b2e716
commit 0e2ab5eeea
14 changed files with 3457 additions and 3271 deletions

View File

@@ -9,31 +9,22 @@ language: go
go:
- 1.17.x
- 1.16.x
addons:
apt:
packages:
- rpm
env:
- GO111MODULE=on
go_import_path: github.com/nats-io/nats-server
install:
- go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
- go install github.com/client9/misspell/cmd/misspell@latest
before_script:
- GO_LIST=$(go list ./...)
- go build
- $(exit $(go fmt $GO_LIST | wc -l))
- go vet $GO_LIST
- find . -type f -name "*.go" | xargs misspell -error -locale US
- staticcheck $GO_LIST
script:
- set -e
- if [[ $TRAVIS_TAG ]]; then go test -v -run=TestVersionMatchesTag ./server; fi
- if [[ ! $TRAVIS_TAG ]]; then go test -v -run=TestNoRace --failfast -p=1 -timeout 30m ./...; fi
- if [[ ! $TRAVIS_TAG ]]; then if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then ./scripts/cov.sh TRAVIS; else go test -v -race -p=1 --failfast -timeout 30m ./...; fi; fi
- set +e
after_success:
- if [[ ! $TRAVIS_TAG ]]; then if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi; fi
env:
- TEST_SUITE=compile
- TEST_SUITE=no_race_tests
- TEST_SUITE=js_tests
- TEST_SUITE=js_cluster_tests
- TEST_SUITE=srv_pkg_non_js_tests
- TEST_SUITE=non_srv_pkg_tests
script: ./runTestsOnTravis.sh $TEST_SUITE
deploy:
provider: script
@@ -41,4 +32,4 @@ deploy:
script: curl -sL http://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_GO_VERSION =~ 1.17
condition: ($TRAVIS_GO_VERSION =~ 1.17) && ($TEST_SUITE = "compile")