sudo: false
language: go
go:
  - 1.7.x
  - 1.8.x
  - 1.9.x
  - 1.10.x
  - 1.11.x
  - tip

before_install:
  - go install -race std
  - go get golang.org/x/tools/cmd/cover
  - go get github.com/tebeka/go2xunit
  - go get github.com/t-yuki/gocover-cobertura
  - go get -v ./...

script:
  - go test -v -race ./... | tee gotest.out
  - $GOPATH/bin/go2xunit -fail -input gotest.out -output xunit.xml
  - go test -v -coverprofile=coverage.txt -covermode count .
  - $GOPATH/bin/gocover-cobertura < coverage.txt > coverage.xml
    
after_script:
  - npm install -g @zeus-ci/cli
  - zeus upload -t "application/x-cobertura+xml" coverage.xml
  - zeus upload -t "application/x-xunit+xml" xunit.xml

matrix:
  include:
    - name: "golint 1.9.x"
      go: 1.9.x
      script: ./scripts/lint.sh
    - name: "golint 1.10.x"
      go: 1.10.x
      script: ./scripts/lint.sh
    - name: "golint 1.11.x"
      go: 1.11.x
      script: ./scripts/lint.sh
  allow_failures:
    - go: tip

notifications:
  webhooks:
    urls:
      - https://zeus.ci/hooks/cd949996-d30a-11e8-ba53-0a580a28042d/public/provider/travis/webhook
    on_success: always
    on_failure: always
    on_start: always
    on_cancel: always
    on_error: always