language: go
go_import_path: github.com/coreos/etcd

sudo: required

services: docker

go:
- 1.12.12

env:
- GO111MODULE=on

notifications:
  on_success: never
  on_failure: never

env:
  matrix:
  - TARGET=linux-amd64-integration-1-cpu
  - TARGET=linux-amd64-integration-4-cpu
  - TARGET=linux-amd64-functional
  - TARGET=linux-amd64-unit
  - TARGET=linux-amd64-e2e
  - TARGET=all-build
  - TARGET=linux-386-unit

matrix:
  fast_finish: true
  allow_failures:
  - go: 1.12.12
    env: TARGET=linux-386-unit

install:
- go get -t -v -d ./...

script:
 - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}"
 - >
    case "${TARGET}" in
      linux-amd64-integration-1-cpu)
        GOARCH=amd64 CPU=1 PASSES='integration' ./test
        ;;
      linux-amd64-integration-4-cpu)
        GOARCH=amd64 CPU=4 PASSES='integration' ./test
        ;;
      linux-amd64-functional)
        ./build && GOARCH=amd64 PASSES='functional' ./test
        ;;
      linux-amd64-unit)
        ./build && GOARCH=amd64 PASSES='unit' ./test
        ;;
      linux-amd64-e2e)
        GOARCH=amd64 PASSES='build release e2e' MANUAL_VER=v3.3.13 ./test
        ;;
      all-build)
        GOARCH=386 PASSES='build' ./test \
          && GO_BUILD_FLAGS='-v' GOOS=darwin GOARCH=amd64 ./build \
          && GO_BUILD_FLAGS='-v' GOARCH=arm ./build \
          && GO_BUILD_FLAGS='-v' GOARCH=arm64 ./build \
          && GO_BUILD_FLAGS='-v' GOARCH=ppc64le ./build
        ;;
      linux-386-unit)
        GOARCH=386 ./build && GOARCH=386 PASSES='unit' ./test
        ;;
    esac
