-
Notifications
You must be signed in to change notification settings - Fork 1
/
Taskfile.yaml
177 lines (154 loc) · 3 KB
/
Taskfile.yaml
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
version: "3"
tasks:
up:
desc: starts docker compose services
cmds:
- docker compose up -d
down:
desc: stops docker compose services
cmds:
- docker compose down
install-deps:
desc: install dependencies
run: once
cmds:
- go get ./...
sources:
- go.mod
- go.sum
build:app:
desc: builds app
deps:
- install-deps
cmds:
- go build -o bin/app cmd/app/app.go
sources:
- ./**/*.go
generates:
- bin/app
build:worker:
desc: builds worker
deps:
- install-deps
cmds:
- go build -o bin/worker cmd/worker/worker.go
sources:
- ./**/*.go
generates:
- bin/worker
build:migrate:
desc: builds migrate
deps:
- install-deps
cmds:
- go build -o bin/migrate cmd/migrate/migrate.go
sources:
- ./cmd/migrate/migrate.go
- ./cmd/migrate/migrations/*.sql
generates:
- bin/migrate
migrate-up:
desc: run migrations
deps:
- build:migrate
cmds:
- bin/migrate up
sources:
- /bin/migrate
status:
- bin/migrate status 2>&1 | grep -q "Pending" && exit 1 || exit 0
build:
desc: builds app, worker and migrate
cmds:
- task: build:app
- task: build:worker
- task: build:migrate
clean:
desc: cleans generated binaries and caches
cmds:
- rm -f bin/*
- go clean -cache -testcache -fuzzcache
format:
desc: runs all formatters
deps:
- format:go
- format:mise
- format:taskfile
- format:sql
format:go:
desc: formats go files
cmds:
- goimports -w .
sources:
- ./**/*.go
format:mise:
desc: format mise config
cmds:
- mise fmt
sources:
- .mise.toml
format:taskfile:
desc: format taskfile
cmds:
- yamlfmt -formatter indent=2,retain_line_breaks=true ./**/*.yaml ./.github/workflows/*.yaml
sources:
- Taskfile.yaml
format:sql:
desc: formats sql files
cmds:
- sqruff fix
sources:
- ./cmd/migrate/migrations/*.sql
lint:
desc: runs all linters
deps:
- lint:go
- lint:dockerfile
lint:go:
desc: lints go code
deps:
- install-deps
cmds:
- golangci-lint run
sources:
- ./**/*.go
lint:dockerfile:
desc: lints Dockerfile
cmds:
- hadolint Dockerfile
sources:
- Dockerfile
lint:sql:
desc: lints sql files
cmds:
- sqruff lint .
sources:
- ./cmd/migrate/migrations/*.sql
test:
desc: runs tests
deps:
- install-deps
cmds:
- go test ./...
test-load:
desc: runs load tests
cmds:
- k6 run test/k6/load-test.js
gitleaks:
desc: runs gitleaks
cmds:
- gitleaks detect .
setup:
desc: sets up the project
cmds:
- task: up
- task: install-deps
- task: migrate-up
ci:
desc: runs standard checks
deps:
- gitleaks
- lint
- migrate-up
cmds:
- task: test