Skip to content

Commit 918e36d

Browse files
committed
Feedback from aaron 👍
1 parent 06069fb commit 918e36d

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

.circleci/config.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@ version: 2.1
33
references:
44
images:
55
go: &GOLANG_IMAGE circleci/golang:latest
6+
environments:
7+
tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved
68

79
# reusable 'executor' object for jobs
810
executors:
911
go:
1012
docker:
1113
- image: *GOLANG_IMAGE
1214
environment:
13-
- TEST_RESULTS: /tmp/test-results # path to where test results are saved
15+
- TEST_RESULTS: *TEST_RESULTS_PATH
1416

1517
jobs:
16-
go-fmt-and-vet:
18+
go-fmt-and-test:
1719
executor: go
1820
steps:
1921
- checkout
22+
- run: mkdir -p $TEST_RESULTS
2023

2124
# Restore go module cache if there is one
2225
- restore_cache:
2326
keys:
2427
- go-getter-modcache-v1-{{ checksum "go.mod" }}
2528

26-
- run: go mod download
27-
2829
# Save go module cache if the go.mod file has changed
2930
- save_cache:
3031
key: go-getter-modcache-v1-{{ checksum "go.mod" }}
@@ -41,32 +42,18 @@ jobs:
4142
echo "$files"
4243
exit 1
4344
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" }}
5545
5646
# run go tests with gotestsum
5747
- run: |
5848
PACKAGE_NAMES=$(go list ./...)
5949
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
6050
- store_test_results:
61-
path: /tmp/test-results
51+
path: *TEST_RESULTS_PATH
6252
- store_artifacts:
63-
path: /tmp/test-results
53+
path: *TEST_RESULTS_PATH
6454

6555
workflows:
6656
version: 2
6757
test-and-build:
6858
jobs:
69-
- go-fmt-and-vet
70-
- go-test:
71-
requires:
72-
- go-fmt-and-vet
59+
- go-fmt-and-test

0 commit comments

Comments
 (0)