os:
  - linux
  - windows
language: go
go:
  - 1.13.x
  - 1.14.x
git:
  depth: false
env:
  - V=
  - V=v2
install:
  - go get -t ./...
  - go get -u honnef.co/go/tools/cmd/staticcheck
  - go get -u github.com/client9/misspell/cmd/misspell
  - go get github.com/mattn/goveralls
  - go get github.com/wadey/gocovmerge
before_script:
  - cd $TRAVIS_BUILD_DIR/${V}
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then EXCLUDE_VENDOR=$(go list ./... | grep -v "/vendor/") && $(exit $(go fmt $EXCLUDE_VENDOR | wc -l)) && go vet $EXCLUDE_VENDOR; fi
  - go vet ./...
  - misspell -error -locale US .
  - staticcheck ./...
script:
  - mkdir cov
  - go test -v -race -covermode=atomic -coverprofile=./cov/coverage.out -coverpkg=github.com/nats-io/jwt .
  - gocovmerge ./cov/*.out > coverage.out

deploy:
- provider: script
  skip_cleanup: true
  script: $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service travis-ci
  on:
    condition: ${V} = "" && $TRAVIS_OS_NAME = linux && $TRAVIS_GO_VERSION =~ ^1.14



