language: go

matrix:
  fast_finish: true
  allow_failures:
    - go: tip

go:
  - "1.13.x"
  - "1.14.x"
  - tip

before_script:
  - export PATH=$HOME/.local/bin:$PATH

before_install:
  - go get -u github.com/mattn/goveralls github.com/wadey/gocovmerge
  - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.18.0
  - pip install cram --user

script:
  - go test -v -covermode=count -coverprofile=profile.cov .
  - go test -v -covermode=count -coverprofile=cryptosigner/profile.cov ./cryptosigner
  - go test -v -covermode=count -coverprofile=cipher/profile.cov ./cipher
  - go test -v -covermode=count -coverprofile=jwt/profile.cov ./jwt
  - go test -v ./json  # no coverage for forked encoding/json package
  - golangci-lint run
  - cd jose-util && go build && PATH=$PWD:$PATH cram -v jose-util.t # cram tests jose-util
  - cd ..

after_success:
  - gocovmerge *.cov */*.cov > merged.coverprofile
  - goveralls -coverprofile merged.coverprofile -service=travis-ci
