sudo: false
language: go
go:
  - "1.10.x"
  - "1.9.x"
  - "1.8.x"
  - master
matrix:
  allow_failures:
    - go: master
  fast_finish: true
env:
  secure: "IrnPmy/rkIP6Nrbqji+u7MCAibQlA6WvPLEllmDQ2yZP/uIe3wLwwYbTu9BOkgzoLA+f8PA6u3pp/RhY/rtaM4NzHAO2nVfGIv9UHUQ3NGq0DYS6rODjVKhq7vkhELoagRewyqFVN4rE0LnExkknRMgjQfRke6/DA7u7Xm8JyhY=" # COVERALLS_TOKEN
install:
  - go get golang.org/x/tools/cmd/cover
  - go get github.com/mattn/goveralls
  - # Do not install go-github yet, since we want it to happen inside the script step.
script:
  - go get -t -v ./...
  - diff -u <(echo -n) <(gofmt -d -s .)
  - go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) # Check that go generate ./... produces a zero diff; clean up any changes afterwards.
  - go tool vet .
  - go test -v -race ./...
  - go test -v -tags=integration -run=^$ ./test/integration # Check that integration test builds successfully, but don't run any of the tests (they hit live GitHub API).

  # Generate test coverage report. This must be after all other tests.
  #- rm github/github-accessors.go # exclude generated code
  #- go test -v -covermode=count -coverprofile=coverage.out ./github
  #- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
