dist: trusty
language: go
go_import_path: github.com/coreos/etcd
sudo: false

go:
  - 1.9.x
  - tip

notifications:
  on_success: never
  on_failure: never

env:
  matrix:
   - TARGET=amd64
   - TARGET=darwin-amd64
   - TARGET=windows-amd64
   - TARGET=arm64
   - TARGET=arm
   - TARGET=386
   - TARGET=ppc64le

matrix:
  fast_finish: true
  allow_failures:
    - go: tip
  exclude:
  - go: tip
    env: TARGET=darwin-amd64
  - go: tip
    env: TARGET=windows-amd64
  - go: tip
    env: TARGET=arm
  - go: tip
    env: TARGET=arm64
  - go: tip
    env: TARGET=386
  - go: tip
    env: TARGET=ppc64le

addons:
  apt:
    sources:
    - debian-sid
    packages:
    - libaspell-dev
    - libhunspell-dev
    - hunspell-en-us
    - aspell-en
    - shellcheck

before_install:
 - go get -v -u -tags spell github.com/chzchzchz/goword
 - go get -v -u github.com/coreos/license-bill-of-materials
 - go get -v -u honnef.co/go/tools/cmd/gosimple
 - go get -v -u honnef.co/go/tools/cmd/unused
 - go get -v -u honnef.co/go/tools/cmd/staticcheck
 - go get -v -u github.com/gordonklaus/ineffassign
 - ./scripts/install-marker.sh amd64
 - export GOROOT=$(go env GOROOT)

# disable godep restore override
install:
 - pushd cmd/etcd && go get -t -v ./... && popd

script:
 - >
    case "${TARGET}" in
      amd64)
        GOARCH=amd64 ./test
        ;;
      darwin-amd64)
        GO_BUILD_FLAGS="-a -v"  GOPATH="" GOOS=darwin GOARCH=amd64 ./build
        ;;
      windows-amd64)
        GO_BUILD_FLAGS="-a -v"  GOPATH="" GOOS=windows GOARCH=amd64 ./build
        ;;
      386)
        GOARCH=386 PASSES="build unit" ./test
        ;;
      *)
        # test building out of gopath
        GO_BUILD_FLAGS="-a -v" GOPATH="" GOARCH="${TARGET}" ./build
        ;;
    esac
