## Circle CI configuration
machine:
  services:
    - docker

  timezone:
    America/Los_Angeles

  # Override /etc/hosts
  hosts:
    circlehost: 127.0.0.1

  # Add some environment variables
  environment:
    GOPATH: $HOME/go
    PATH: $GOPATH/bin:$PATH
    CIRCLE_ENV: test
    DOCKER_ACCOUNT: infradash
    DOCKER_EMAIL: docker@infradash.com
    DOCKER_AUTH: aW5mcmFkYXNoOnd1YzR5NmxiUFpHNA==
    BUILD_LABEL: $CIRCLE_BUILD_NUM
    BUILD_DIR: build/bin

## Customize dependencies
dependencies:
  pre:
    - go version
    # Set up authentication to Docker Registry
    - sed "s/<EMAIL>/$DOCKER_EMAIL/;s/<AUTH>/$DOCKER_AUTH/" < ./docker/dockercfg.template > ~/.dockercfg
  override:
    - source ./hack/env.sh

  post:
    - source ./hack/env.sh && make GODEP=godep all

## Customize test commands
test:
  override:
    - echo "Running tests."
    - godep go test ./pkg/... -v -check.vv -logtostderr


## Customize deployment commands
deployment:
   docker:
     branch: /release\/.*/
     commands:
      - cp $BUILD_DIR/dash $CIRCLE_ARTIFACTS
      - cp $BUILD_DIR/dash docker/dash
      - cd docker/dash && make push && cd ..
      - make deploy-git

## Circle CI configuration
machine:
  services:
    - docker

  timezone:
    America/Los_Angeles

  # Override /etc/hosts
  hosts:
    circlehost: 127.0.0.1

  # Add some environment variables
  environment:
    GOPATH: $HOME/go
    PATH: $GOPATH/bin:$PATH
    CIRCLE_ENV: test
    DOCKER_ACCOUNT: infradash
    DOCKER_EMAIL: docker@infradash.com
    DOCKER_AUTH: aW5mcmFkYXNoOnd1YzR5NmxiUFpHNA==
    BUILD_LABEL: $CIRCLE_BUILD_NUM
    BUILD_DIR: build/bin

## Customize dependencies
dependencies:
  pre:
    - go version
    # Set up authentication to Docker Registry
    - sed "s/<EMAIL>/$DOCKER_EMAIL/;s/<AUTH>/$DOCKER_AUTH/" < ./docker/dockercfg.template > ~/.dockercfg
  override:
    - source ./hack/env.sh

  post:
    - source ./hack/env.sh && make GODEP=godep all
    - cp $BUILD_DIR/dash $CIRCLE_ARTIFACTS
    - source ./hack/env.sh && make deploy-git

## Customize test commands
test:
  override:
    - echo "Running tests."
    - godep go test ./pkg/... -v -check.vv -logtostderr

## Customize deployment commands
deployment:
   docker:
     branch: /v[0-9]+(\\.[0-9]+)*/
     commands:
      - cp $BUILD_DIR/dash docker/dash
      - cd docker/dash && make push && cd ..

Build docker image only in v* branches
Build docker image only in v* branches
