sudo: required

language: go

# Versions of go that are explicitly supported by gonum.
go:
 - 1.5beta1
 - 1.3.3
 - 1.4.2

env:
  matrix:
  - BLAS_LIB=OpenBLAS
  - BLAS_LIB=gonum
  # at some point, when travis allows builds on darwin
  #- BLAS_LIB=Accellerate
  # at some point, when the issue with drotgm is resolved
  #- BLAS_LIB=ATLAS

# Required for coverage.
before_install:
 - go get golang.org/x/tools/cmd/cover
 - go get github.com/mattn/goveralls

# Install the appropriate blas library if we are using cgo.
install:
 - source .travis/$TRAVIS_OS_NAME/$BLAS_LIB/install.sh
 - go get github.com/gonum/floats

# Get deps, build, test, and ensure the code is gofmt'ed.
# Move into the native directory if we aren't using an external blas lib.
# If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well.
script:
 - if [[ "$BLAS_LIB" == "gonum" ]]; then pushd native; fi
 - go get -d -t -v ./...
 - go test -a -v ./...
 - go test -a -tags noasm -v ./...
 - diff <(gofmt -d .) <("")
 - if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then bash -c "${TRAVIS_BUILD_DIR}/.travis/test-coverage.sh"; fi
