machine:
  environment:
    PROJECT_GOPATH: "${HOME}/.go_project"
    PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
    PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
    GOPATH: "${HOME}/.go_workspace:/usr/local/go_workspace:${PROJECT_GOPATH}"

dependencies:
  pre:
    - sudo add-apt-repository -y ppa:masterminds/glide && sudo apt-get update
    - sudo apt-get install -y glide
    - curl -sSL -o go1.7.3.linux-amd64.tar.gz https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
    - sudo rm -rf /usr/local/go
    - sudo tar -C /usr/local -xzf go1.7.3.linux-amd64.tar.gz
  override:
    - mkdir -p "${PROJECT_PARENT_PATH}"
    - rsync -av "${HOME}/${CIRCLE_PROJECT_REPONAME}/" "${PROJECT_PATH}"

test:
  override:
    - cd "${PROJECT_PATH}" && glide install && go test -race -coverprofile=coverage.txt -covermode=atomic
  post:
    - bash <(curl -s https://codecov.io/bash)
machine:
  environment:
    PROJECT_GOPATH: "${HOME}/.go_project"
    PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
    PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
    GOPATH: "${HOME}/.go_workspace:/usr/local/go_workspace:${PROJECT_GOPATH}"

dependencies:
  pre:
    - sudo add-apt-repository -y ppa:masterminds/glide && sudo apt-get update
    - sudo apt-get install -y glide
    - curl -sSL -o go1.7.3.linux-amd64.tar.gz https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
    - sudo rm -rf /usr/local/go
    - sudo tar -C /usr/local -xzf go1.7.3.linux-amd64.tar.gz
  override:
    - mkdir -p "${PROJECT_PARENT_PATH}"
    - rsync -av "${HOME}/${CIRCLE_PROJECT_REPONAME}/" "${PROJECT_PATH}"

test:
  override:
    - cd "${PROJECT_PATH}" && glide install && go test -race -coverprofile="${CIRCLE_ARTIFACTS}/coverage.txt" -covermode=atomic
  post:
    - bash <(curl -s https://codecov.io/bash)
Add coverage report to CircleCI artifacts.
Add coverage report to CircleCI artifacts.
