machine:
  environment:
    GOPATH: /home/ubuntu/.go_workspace
    REPO: ${GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
    #INTEGRATION_TESTS_BRANCH: develop
    #INTEGRATION_TESTS_PATH: $HOME/integration-tests
    DOCKER_VERSION: 1.8.2
    DOCKER_MACHINE_VERSION: 0.5.4
  post:
    - rm -rf $GOPATH/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
    - mkdir -p $GOPATH/src/github.com/${CIRCLE_PROJECT_USERNAME}
    - cp -r ${HOME}/${CIRCLE_PROJECT_REPONAME} $GOPATH/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
    - git config --global user.email "billings@erisindustries.com"
    - git config --global user.name "Billings the Bot"

dependencies:
  override:
    - sudo curl -L -o /usr/bin/docker http://s3-external-1.amazonaws.com/circle-downloads/docker-$DOCKER_VERSION-circleci; chmod 0755 /usr/bin/docker; true
    - sudo service docker start
    - "sudo apt-get update && sudo apt-get install -y libgmp3-dev"
    - sudo curl -sSL -o /usr/bin/docker-machine https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine_linux-amd64; sudo chmod 0755 /usr/bin/docker-machine
    # - git clone https://github.com/eris-ltd/integration-tests $INTEGRATION_TESTS_PATH
    - "cd ./cmd/erisdb && go get -d && go build"
    - "mv ~/eris-db/cmd/erisdb/erisdb ~/bin"
    - chmod +x ~/bin/erisdb

test:
  override:
    - go test -v ./...
    #- bash $INTEGRATION_TESTS_PATH/test.sh

deployment:
  master:
    branch: master
    commands:
      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS quay.io
      - DOCKER/build.sh
      - docker push quay.io/eris/erisdb
