-
Notifications
You must be signed in to change notification settings - Fork 451
Expand file tree
/
Copy pathTaskfile.yml
More file actions
142 lines (119 loc) · 3.4 KB
/
Taskfile.yml
File metadata and controls
142 lines (119 loc) · 3.4 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
version: "3"
tasks:
coverage:
deps: [test]
desc: run unit tests and create HTML coverage file
cmds:
- go tool cover -html=coverage.txt
fmt:
desc: auto-format all go files
sources:
- "**/*.go"
cmds:
- gofumpt -l -w .
mocks:
desc: generate new mocks from scratch
cmds:
- task: mocks.remove
- task: mocks.generate
mocks.remove:
desc: remove all mock files
deps:
- mocks.remove.windows
- mocks.remove.unix
mocks.remove.windows:
desc: remove all mock files on windows
platforms: ["windows"]
cmds:
- rm -f files.txt
- where /r . '*_mock.go' > files.txt || true
- where /r . 'mock_*_test.go' >> files.txt || true
- where /r . 'mocks_moq.go' >> files.txt || true
- where /r . 'mocks_test.go' >> files.txt || true
- where /r . 'mocks_*_test.go' >> files.txt || true
- where /r . 'mocks_matryer_*.go' >> files.txt || true
- where /r . 'mocks.go' >> files.txt || true
- powershell -Command 'foreach ($file in Get-Content "files.txt") { If (Test-Path $file) {Remove-Item $file} }'
- rm -rf mocks/
- rm -f files.txt
mocks.remove.unix:
desc: remove all mock files on unix
platforms: ["darwin", "linux"]
cmds:
- find . -name '*_mock.go' -o -name 'mock_*_test.go' -o -name "mocks_moq.go" -o -name 'mocks_test.go' -o -name 'mocks_*_test.go' -o -name 'mocks_matryer_*.go' -o -name 'mocks.go' | xargs -r rm
- rm -rf mocks/
mocks.generate.custom:
cmds:
- go run .
mocks.generate.testify:
desc: Generate testify mocks
cmds:
- MOCKERY_CONFIG=./.mockery_testify.yml go run .
mocks.generate.matryer:
desc: Generate matryer mocks
cmds:
- MOCKERY_CONFIG=./.mockery_matryer.yml go run .
mocks.generate:
desc: generate mocks
deps:
- mocks.generate.testify
- mocks.generate.matryer
git-state:
desc: Check for a dirty git git-state
cmds:
- git diff --exit-code
docker:
desc: build the mockery docker image
cmds:
- docker build -t vektra/mockery .
mkdocs.install:
desc: install mkdocs and plugins
sources:
- "docs/requirements.txt"
cmds:
- pip install -r docs/requirements.txt
mkdocs.serve:
desc: serve mkdocs locally
deps: [mkdocs.install]
cmds:
- mkdocs serve
lint:
desc: run all the defined linters
sources:
- "**/*.go"
cmds:
- go run github.com/golangci/golangci-lint/cmd/golangci-lint run
test:
cmds:
- go run gotest.tools/gotestsum --format testname -- -v -coverprofile=coverage.txt ./internal/... ./template_funcs/... ./template/...
desc: run unit tests
generates:
- coverage.txt
test.e2e:
desc: run end-to-end tests
cmds:
- bash ./e2e/run_all.sh
- go run gotest.tools/gotestsum --format testname -- -v -count=1 ./e2e/...
test.ci:
deps: [lint]
cmds:
- task: mocks
- task: git-state
- task: test
- task: mocks.remove
- task: test.e2e
default:
deps: [test.ci]
build-tools:
desc: Build tools directory
cmds:
- cd ./tools && go build -o tools .
tag:
desc: Tag the git repo with the version specified.
deps: [build-tools]
cmds:
- ./tools/tools tag --dry-run=false
tag.push:
desc: Push tags to origin
cmds:
- git push origin --tags --force