sudo: false

language: go
go_import_path: gonum.org/v1/plot

# Versions of go that are explicitly supported by gonum.
go:
 - 1.14.x
 - 1.13.x
 - master
matrix:
  fast_finish: true
  allow_failures:
    - go: master

env:
  global:
   - GO111MODULE: "on"

# Get coverage tools, and start the virtual framebuffer.
before_install:
 # Required for format check.
 - go get golang.org/x/tools/cmd/goimports
 # Required for imports check.
 - go get gonum.org/v1/tools/cmd/check-imports
 # Required for copyright header check.
 - go get gonum.org/v1/tools/cmd/check-copyright
 # Required for coverage.
 - go get golang.org/x/tools/cmd/cover
 - go get github.com/mattn/goveralls

# Get deps, build, test, and ensure the code is gofmt'ed.
# If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well.
script:
 - ${TRAVIS_BUILD_DIR}/.travis/check-copyright.sh
 - ${TRAVIS_BUILD_DIR}/.travis/check-formatting.sh
 - go get -d -t -v ./...
 - go build -v ./...
 - go test -v ./...
 - test -z "$(gofmt -d .)"
 - if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then bash ./.travis/test-coverage.sh; fi
 - ${TRAVIS_BUILD_DIR}/.travis/check-imports.sh
