Skip to content

Commit a85ee06

Browse files
committed
updating config to consolidate jobs
1 parent bf36132 commit a85ee06

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

.circleci/config.yml

+9-21
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@ 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-test:
1719
executor: go
1820
steps:
1921
- checkout
22+
- run: mkdir -p $TEST_RESULTS
2023

21-
# Restore go module cache if there is one
22-
- restore_cache:
24+
- restore_cache: # restore cache from dev-build job
2325
keys:
2426
- go-version-modcache-v1-{{ checksum "go.mod" }}
2527

@@ -41,32 +43,18 @@ jobs:
4143
echo "$files"
4244
exit 1
4345
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-version-modcache-v1-{{ checksum "go.mod" }}
5546
5647
# run go tests with gotestsum
5748
- run: |
5849
PACKAGE_NAMES=$(go list ./...)
5950
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
6051
- store_test_results:
61-
path: /tmp/test-results
52+
path: *TEST_RESULTS_PATH
6253
- store_artifacts:
63-
path: /tmp/test-results
54+
path: *TEST_RESULTS_PATH
6455

6556
workflows:
6657
version: 2
6758
test-and-build:
6859
jobs:
69-
- go-fmt-and-vet
70-
- go-test:
71-
requires:
72-
- go-fmt-and-vet
60+
- go-test

0 commit comments

Comments
 (0)