-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.yml
93 lines (73 loc) · 2.24 KB
/
config.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
version: 2.1
orbs:
codecov: codecov/[email protected]
executors:
go:
docker:
- image: cimg/go:1.21
jobs:
build:
environment:
TEST_RESULTS: /tmp/test-results
executor: go
steps:
- checkout
- run: mkdir -p $TEST_RESULTS
- run:
name: Generate code
command: |
set -ux
find . -name moq_\*.go -delete
go build -o $GOPATH/bin/moqueries moqueries.org/cli/moqueries
export MOQ_BULK_STATE_FILE=$(mktemp --tmpdir= moq-XXXXXX)
moqueries bulk-initialize
go generate ./...
MOQ_DEBUG=true moqueries bulk-finalize
- run:
name: Run tests
command: |
set -ux
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- \
-v -race -covermode=atomic -coverprofile=coverage.out $PACKAGE_NAMES
# go install golang.org/x/vuln/cmd/govulncheck@latest
# govulncheck ./...
- run:
name: Check generated code
command: |
set -ux
# fail if working directory is dirty
# Note: We check after Generate code *and* Run tests because some
# tests generate mocks too.
git status --short
if [[ -n $(git status --short) ]]; then
echo "Working directory dirty"
exit 1
fi
- codecov/upload
- run:
name: Run code linters
command: |
set -ux
# Installs the latest version each time. This may impact build
# repeatability but only mildly.
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
sh -s -- -b $(go env GOPATH)/bin
golangci-lint run
- run:
name: Check for dirty working directory
command: |
set -ux
git status
git diff
[[ -z $(git status --short) ]] || (echo 'Untracked changes' && exit 1)
- store_artifacts:
path: /tmp/test-results
destination: raw-test-output
- store_test_results:
path: /tmp/test-results
workflows:
version: 2
build-workflow:
jobs:
- build