File tree 2 files changed +59
-12
lines changed
2 files changed +59
-12
lines changed Original file line number Diff line number Diff line change
1
+ version: 2.1
2
+
3
+ references :
4
+ images :
5
+ go: &GOLANG_IMAGE circleci/golang:latest
6
+ environments :
7
+ tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved
8
+
9
+ # reusable 'executor' object for jobs
10
+ executors :
11
+ go :
12
+ docker :
13
+ - image: *GOLANG_IMAGE
14
+ environment :
15
+ - TEST_RESULTS: *TEST_RESULTS_PATH
16
+
17
+ jobs :
18
+ go-test :
19
+ executor: go
20
+ steps :
21
+ - checkout
22
+ - run: mkdir -p $TEST_RESULTS
23
+
24
+ - restore_cache: # restore cache from dev-build job
25
+ keys :
26
+ - go-multierror-modcache-v1-{{ checksum "go.mod" }}
27
+
28
+ - run: go mod download
29
+
30
+ # Save go module cache if the go.mod file has changed
31
+ - save_cache :
32
+ key: go-multierror-modcache-v1-{{ checksum "go.mod" }}
33
+ paths :
34
+ - "/go/pkg/mod"
35
+
36
+ # check go fmt output because it does not report non-zero when there are fmt changes
37
+ - run :
38
+ name: check go fmt
39
+ command: |
40
+ files=$(go fmt ./...)
41
+ if [ -n "$files" ]; then
42
+ echo "The following file(s) do not conform to go fmt:"
43
+ echo "$files"
44
+ exit 1
45
+ fi
46
+ # run go tests with gotestsum
47
+ - run: |
48
+ PACKAGE_NAMES=$(go list ./...)
49
+ gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
50
+ - store_test_results :
51
+ path: *TEST_RESULTS_PATH
52
+ - store_artifacts :
53
+ path: *TEST_RESULTS_PATH
54
+
55
+ workflows :
56
+ version: 2
57
+ test-and-build :
58
+ jobs :
59
+ - go-test
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments