From e061bc185588fe42b882dd5d4342e14a902f4d22 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 18 Mar 2019 13:27:08 -0700 Subject: [PATCH] ref(circleci): refactor ci setup * fix go dep cache * zip binary comes bundled already with image * remove branch name from cache key Signed-off-by: Adam Reese --- .circleci/bootstrap.sh | 19 ------------------- .circleci/config.yml | 31 ++++++++++++++++--------------- Makefile | 6 ++++++ 3 files changed, 22 insertions(+), 34 deletions(-) delete mode 100755 .circleci/bootstrap.sh diff --git a/.circleci/bootstrap.sh b/.circleci/bootstrap.sh deleted file mode 100755 index 30dc0b316..000000000 --- a/.circleci/bootstrap.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The Helm Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -euo pipefail - -apt-get update -y && apt-get install -yq zip -make bootstrap diff --git a/.circleci/config.yml b/.circleci/config.yml index c0807a893..7fdc3bab9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,41 +1,42 @@ +--- version: 2 + jobs: build: working_directory: /go/src/helm.sh/helm parallelism: 3 docker: - image: circleci/golang:1.12 + environment: - PROJECT_NAME: "kubernetes-helm" - GOCACHE: "/tmp/go/cache" + steps: - checkout - restore_cache: - key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }} - paths: - - /go/src/helm.sh/helm/vendor - - run: - name: install dependencies - command: .circleci/bootstrap.sh - - save_cache: - key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }} - paths: - - /go/src/helm.sh/helm/vendor + key: gopkg-{{ checksum "Gopkg.lock" }} - restore_cache: keys: - - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - paths: - - /tmp/go/cache + - build-cache-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - run: name: test - command: .circleci/test.sh + command: make test-coverage + + - save_cache: + key: gopkg-{{ checksum "Gopkg.lock" }} + paths: + - /go/src/helm.sh/helm/vendor + - /go/pkg/dep - save_cache: - key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }} + key: build-cache-{{ .Environment.CIRCLE_BUILD_NUM }} paths: - /tmp/go/cache + - deploy: name: deploy command: .circleci/deploy.sh + workflows: version: 2 build: diff --git a/Makefile b/Makefile index 0bf02a518..923becf05 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,12 @@ test-unit: vendor @echo "==> Running unit tests <==" HELM_HOME=/no_such_dir go test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS) +.PHONY: test-coverage +test-coverage: vendor + @echo + @echo "==> Running unit tests with coverage <==" + @ HELM_HOME=/no_such_dir ./scripts/coverage.sh + .PHONY: test-style test-style: vendor $(GOLANGCI_LINT) $(GOLANGCI_LINT) run