env:
  global:
    # CodeClimate
    - CC_TEST_REPORTER_ID=f23f4d159f580cb3c3b44cda538d176938257143cd88c7b39f26a3029d562246

language: go

go:
  - 1.8
  - 1.9
  - 1.x
  - master

install: go get -t ./...

before_script:
  # CodeClimate
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build

after_script:
  # CodeClimate
  - cp coverage.out c.out  # The coverage file is assumed to be called `c.out`.
  - ./cc-test-reporter after-build -t gocov --exit-code $TRAVIS_TEST_RESULT

matrix:
  allow_failures:
    - go: master
  fast_finish: true

env:
  global:
    # CodeClimate
    - CC_TEST_REPORTER_ID=f23f4d159f580cb3c3b44cda538d176938257143cd88c7b39f26a3029d562246

language: go

go:
  - 1.8
  - 1.9
  - 1.x
  - master

before_install:
  # Make CI work for forks.
  - export OBJECTHASH_PATH="${GOPATH}/src/github.com/deepmind/objecthash-proto"
  - if [ "${TRAVIS_BUILD_DIR}" != "${OBJECTHASH_PATH}" ]; then
      mkdir -p "$(dirname "${OBJECTHASH_PATH}")";
      mv "${TRAVIS_BUILD_DIR}" "${OBJECTHASH_PATH}";
      export TRAVIS_BUILD_DIR="${OBJECTHASH_PATH}";
      cd "${TRAVIS_BUILD_DIR}";
    fi

install: go get -t ./...

before_script:
  # CodeClimate
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build

after_script:
  # CodeClimate
  - cp coverage.out c.out  # The coverage file is assumed to be called `c.out`.
  - ./cc-test-reporter after-build -t gocov --exit-code $TRAVIS_TEST_RESULT

matrix:
  allow_failures:
    - go: master
  fast_finish: true

Make CI work for forks.
Make CI work for forks.

This is done by moving the code from the forked repo path to the
correct path, and then updating `TRAVIS_BUILD_DIR` as well as the
current working directory.
