version: 2
jobs:
  build:
    working_directory: /go/src/k8s.io/helm
    parallelism: 3
    docker:
      - image: circleci/golang:1.10.0
    environment:
      - PROJECT_NAME: "kubernetes-helm"
      - GOCACHE: "/tmp/go/cache"
    steps:
      - checkout
      - restore_cache:
          key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
          paths:
              - /go/src/k8s.io/helm/vendor
      - run:
          name: install dependencies
          command: .circleci/bootstrap.sh
      - save_cache:
          key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
          paths:
              - /go/src/k8s.io/helm/vendor
      - restore_cache:
          keys:
              - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
          paths:
              - /tmp/go/cache
      - run:
          name: test
          command: .circleci/test.sh
      - save_cache:
          key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
          paths:
              - /tmp/go/cache
      - deploy:
          name: deploy
          command: .circleci/deploy.sh
workflows:
  version: 2
  build:
    jobs:
      - build:
          filters:
            tags:
              only: /.*/
