-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
executable file
路94 lines (77 loc) 路 2.14 KB
/
Copy pathTaskfile.yml
File metadata and controls
executable file
路94 lines (77 loc) 路 2.14 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
version: '3'
vars:
GOBIN: $(pwd)/bin
tasks:
mock:
cmds:
# kafka
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/sync.go -source=kafka/sync.go"
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/async.go -source=kafka/async.go"
- "{{.GOBIN}}/mockgen -package=mock -destination=kafka/mock/consumer_group.go -source=kafka/consumer_group.go"
format:
cmds:
- task: go_files
vars: { COMMAND: 'gofmt -w {} +'}
- task: go_files
vars: { COMMAND: '{{.GOBIN}}/goimports -w {} +'}
test:
cmds:
- task: test-kafka
- task: test-redis
- task: test-cache
- task: test-postgres
test-kafka:
cmds:
- task: test-directory
vars: { DIR: kafka }
test-redis:
cmds:
- task: test-directory
vars: { DIR: redis }
test-postgres:
cmds:
- task: test-directory
vars: { DIR: postgres }
test-cache:
cmds:
- task: test-directory
vars: { DIR: cache }
lint:
cmds:
- "{{.GOBIN}}/revive
-config revive.toml
-formatter friendly
-exclude ./**/mock
./..."
commit:
cmds:
- task: format
- task: lint
- task: test
deps:
- GOBIN={{.GOBIN}} go install golang.org/x/tools/cmd/goimports@v0.19.0
- GOBIN={{.GOBIN}} go install github.com/mgechev/revive@v1.3.7
- GOBIN={{.GOBIN}} go install github.com/golang/mock/mockgen@v1.6.0
- GOBIN={{.GOBIN}} go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0
## docker
docker-up:
cmds:
- docker compose -f docker/docker-compose.yml up
docker-down:
cmds:
- docker compose -f docker/docker-compose.yml down
## internal
go_files:
desc: "Return all .go files and run .COMMAND on them"
internal: true
cmds:
- find .
-name "*.go"
-not -path ./mock
-exec {{.COMMAND}};
test-directory:
dir: "{{.DIR}}"
internal: true
cmds:
- go test -v -race -cover -json -coverprofile=coverage.txt ./... > coverage.json && cd .. && {{.GOBIN}}/gotestfmt -input={{.DIR}}/coverage.json
- defer: rm coverage.json