From a85ee06d79cb1f4a23603df2bec6b480829de9c3 Mon Sep 17 00:00:00 2001 From: "chloe (@cotarg)" Date: Tue, 8 Oct 2019 14:41:04 -0400 Subject: [PATCH] updating config to consolidate jobs --- .circleci/config.yml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 75198de..7289c6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,8 @@ version: 2.1 references: images: go: &GOLANG_IMAGE circleci/golang:latest + environments: + tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved # reusable 'executor' object for jobs executors: @@ -10,16 +12,16 @@ executors: docker: - image: *GOLANG_IMAGE environment: - - TEST_RESULTS: /tmp/test-results # path to where test results are saved + - TEST_RESULTS: *TEST_RESULTS_PATH jobs: - go-fmt-and-vet: + go-test: executor: go steps: - checkout + - run: mkdir -p $TEST_RESULTS - # Restore go module cache if there is one - - restore_cache: + - restore_cache: # restore cache from dev-build job keys: - go-version-modcache-v1-{{ checksum "go.mod" }} @@ -41,32 +43,18 @@ jobs: echo "$files" exit 1 fi - - run: go vet ./... - - go-test: - executor: go - steps: - - checkout - - run: mkdir -p $TEST_RESULTS - - - restore_cache: # restore cache from dev-build job - keys: - - go-version-modcache-v1-{{ checksum "go.mod" }} # run go tests with gotestsum - run: | PACKAGE_NAMES=$(go list ./...) gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES - store_test_results: - path: /tmp/test-results + path: *TEST_RESULTS_PATH - store_artifacts: - path: /tmp/test-results + path: *TEST_RESULTS_PATH workflows: version: 2 test-and-build: jobs: - - go-fmt-and-vet - - go-test: - requires: - - go-fmt-and-vet + - go-test