-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
43 lines (41 loc) · 1.31 KB
/
Taskfile.yml
File metadata and controls
43 lines (41 loc) · 1.31 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
version: 3
vars:
GEN_OUT_DIR: handler
MOCKERY_VERSION: v3.5.5
tasks:
fmt-imports:
# macOS requires to install GNU sed first. Use `brew install gnu-sed` to install it.
# It has to be added to PATH as `sed` command, to replace default BSD sed.
# See `brew info gnu-sed` for more details on how to add it to PATH.
# /^import ($$/: starts with "import ("
# /^)/: ends with ")"
# /^[[:space:]]*$$/: empty lines
cmds:
- find . -type f -name '*.go' -exec sed -i '/^import ($$/,/^)/ {/^[[:space:]]*$$/d}' {} +
- goimports -local "github.com/aiven/go-client-codegen" -w .
get-openapi-spec:
cmds:
- curl -s -o openapi.json https://api.aiven.io/doc/openapi.json
go-generate:
cmds:
- rm -rf {{.GEN_OUT_DIR}} client_mock.go
- GEN_OUT_DIR={{.GEN_OUT_DIR}} go run -tags=generator ./generator/...
- task: fmt-imports
requires:
vars:
- GEN_OUT_DIR
generate-mocks:
preconditions:
- sh: command -v mockery
msg: "mockery is not installed. Install it with: go install github.com/vektra/mockery/v3@{{.MOCKERY_VERSION}}"
cmds:
- mockery
generate:
cmds:
- task: get-openapi-spec
- task: go-generate
- task: generate-mocks
- task: fmt-imports
test:
cmds:
- go test -race -count=1 -v ./...