language: go

go:
  - 1.12.x
  - 1.13.x
  - 1.14.x
  - master

env:
  - GO111MODULE=on GOFLAGS=-mod=readonly
  - GO111MODULE=off

jobs:
  include:
    - name: "Module support outside of GOPATH"
      go: stable
      before_script: >-
        mv $GOPATH/src/github.com/getsentry/sentry-go ~/sentry-go &&
        cd ~/sentry-go &&
        export GOPATH= &&
        go env GOPATH
      script: >-
        go test ./... &&
        go test ./... -race
  allow_failures:
    - go: master
  fast_finish: true

before_install:
  - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.19.1/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
  # Fetch origin/master. This is required for `git merge-base` when testing a
  # branch, since Travis clones only the target branch.
  - git fetch origin master:remotes/origin/master

script:
  - golangci-lint run --new-from-rev=$(git merge-base origin/master HEAD)
  - go build ./...
  - go test ./...
  - go test ./... -race

notifications:
  webhooks:
    urls:
      - https://zeus.ci/hooks/befe9810-9285-11e9-b01a-0a580a281808/public/provider/travis/webhook
    on_success: always
    on_failure: always
    on_start: always
    on_cancel: always
    on_error: always
