version: 2 jobs: build: docker: - image: circleci/golang:1.12 environment: GOFLAGS: -mod=readonly steps: - checkout - restore_cache: name: Restore build dependencies keys: - build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }} - restore_cache: name: Restore dependencies keys: - gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }} - gomod-v1-{{ .Branch }} - gomod-v1-master - gomod-v1 - run: name: Download Go module cache command: go mod download - save_cache: name: Save dependencies key: gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }} paths: - /go/pkg/mod - run: name: Run tests command: TEST_PKGS=$(echo `go list ./... | circleci tests split`) TEST_REPORT_NAME=results_${CIRCLE_NODE_INDEX}.xml make test - save_cache: name: Save build dependencies key: build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }} paths: - bin/ - store_test_results: path: build/test_results/