dependencies:
  pre:
    - echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json
    - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
    - sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
    - sudo /opt/google-cloud-sdk/bin/gcloud config set project $GCLOUD_PROJECT
    - go get -t -d -v ./...
    - go build -v

test:
  override:
    - go test -v -race ./...

deployment:
  prod:
    branch: master
    commands:
      - ssh -i ~/.ssh/id_circle-ci boomer@35.187.20.26 sudo service supervisor stop hal
      - sudo scp -i ~/.ssh/id_circle-ci Hal boomer@35.187.20.26:/var/www/go/bin
      - ssh -i ~/.ssh/id_circle-ci boomer@35.187.20.26 sudo service supervisor stop hal
      #- sudo scp -i ~/.ssh/id_mr-robot Hal chvckd@104.199.104.178:/var/www/go/bin
      #- ssh -i ~/.ssh/id_mr-robot chvckd@104.199.104.178 sudo service supervisor restart

general:
  branches:
    only:
    - master

dependencies:
  pre:
    - echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json
    - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
    - sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
    - sudo /opt/google-cloud-sdk/bin/gcloud config set project $GCLOUD_PROJECT
    - go get -t -d -v ./...
    - go build -v

test:
  override:
    - go test -v -race ./...

deployment:
  prod:
    branch: master
    commands:
      - ssh -i ~/.ssh/id_circle-ci boomer@35.187.20.26 sudo service supervisor stop hal
      - sudo scp -i ~/.ssh/id_circle-ci Hal boomer@35.187.20.26:/var/www/go/bin
      - ssh -i ~/.ssh/id_circle-ci boomer@35.187.20.26 sudo service supervisor start hal
      #- sudo scp -i ~/.ssh/id_mr-robot Hal chvckd@104.199.104.178:/var/www/go/bin
      #- ssh -i ~/.ssh/id_mr-robot chvckd@104.199.104.178 sudo service supervisor restart

Modify to run only master branch
Modify to run only master branch
