File tree Expand file tree Collapse file tree 1 file changed +8
-21
lines changed Expand file tree Collapse file tree 1 file changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -3,28 +3,29 @@ version: 2.1
3
3
references :
4
4
images :
5
5
go : &GOLANG_IMAGE circleci/golang:latest
6
+ environments :
7
+ tmp : &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved
6
8
7
9
# reusable 'executor' object for jobs
8
10
executors :
9
11
go :
10
12
docker :
11
13
- image : *GOLANG_IMAGE
12
14
environment :
13
- - TEST_RESULTS : /tmp/test-results # path to where test results are saved
15
+ - TEST_RESULTS : *TEST_RESULTS_PATH
14
16
15
17
jobs :
16
- go-fmt-and-vet :
18
+ go-fmt-and-test :
17
19
executor : go
18
20
steps :
19
21
- checkout
22
+ - run : mkdir -p $TEST_RESULTS
20
23
21
24
# Restore go module cache if there is one
22
25
- restore_cache :
23
26
keys :
24
27
- go-getter-modcache-v1-{{ checksum "go.mod" }}
25
28
26
- - run : go mod download
27
-
28
29
# Save go module cache if the go.mod file has changed
29
30
- save_cache :
30
31
key : go-getter-modcache-v1-{{ checksum "go.mod" }}
@@ -41,32 +42,18 @@ jobs:
41
42
echo "$files"
42
43
exit 1
43
44
fi
44
- - run : go vet ./...
45
-
46
- go-test :
47
- executor : go
48
- steps :
49
- - checkout
50
- - run : mkdir -p $TEST_RESULTS
51
-
52
- - restore_cache : # restore cache from dev-build job
53
- keys :
54
- - go-getter-modcache-v1-{{ checksum "go.mod" }}
55
45
56
46
# run go tests with gotestsum
57
47
- run : |
58
48
PACKAGE_NAMES=$(go list ./...)
59
49
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
60
50
- store_test_results :
61
- path : /tmp/test-results
51
+ path : *TEST_RESULTS_PATH
62
52
- store_artifacts :
63
- path : /tmp/test-results
53
+ path : *TEST_RESULTS_PATH
64
54
65
55
workflows :
66
56
version : 2
67
57
test-and-build :
68
58
jobs :
69
- - go-fmt-and-vet
70
- - go-test :
71
- requires :
72
- - go-fmt-and-vet
59
+ - go-fmt-and-test
You can’t perform that action at this time.
0 commit comments