1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
version: 2.1
# reusable 'executor' object for jobs
executors:
go:
docker:
- image: circleci/golang:1.12.1
environment:
- TEST_RESULTS: /tmp/test-results # path to where test results are saved
jobs:
go-fmt-and-vet:
executor: go
steps:
- checkout
# check go fmt output because it does not report non-zero when there are fmt changes
- run:
name: check go fmt
command: |
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
- run: go vet ./...
test:
executor: go
environment:
TEST_RESULTS: /tmp/test-results
steps:
- checkout
- run: mkdir -p $TEST_RESULTS
# run go tests with gotestsum
- run: make test-ci
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
workflows:
version: 2
test-and-build:
jobs:
- go-fmt-and-vet
- test:
requires:
- go-fmt-and-vet
|