-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
268 lines (234 loc) · 6.43 KB
/
Taskfile.yml
File metadata and controls
268 lines (234 loc) · 6.43 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
version: '3'
tasks:
compose:
desc: Docker compose backend and frontend services
cmds:
- docker compose down
- docker compose up --build -d
#
# bot2 (python) tasks
#
bot2:install:
dir: bot2
desc: Install bot2 dependencies
cmds:
- uv sync --dev
bot2:lint:
dir: bot2
desc: Run bot2 linting with ruff
cmds:
- uv run ruff check --select I
- uv run ruff check .
deps:
- bot2:install
bot2:lint:fix:
dir: bot2
desc: Run bot2 linting with ruff and fix
cmds:
- uv run ruff check --select I --fix .
- uv run ruff check . --fix
deps:
- bot2:install
bot2:format:
dir: bot2
desc: Fix bot2 linting issues and format code
cmds:
- uv run ruff format .
deps:
- bot2:install
bot2:format:check:
dir: bot2
desc: Check bot2 code formatting (no fix)
cmds:
- uv run ruff format --check .
deps:
- bot2:install
bot2:typecheck:
dir: bot2
desc: Run bot2 type checking with ty
cmds:
- uv run ty check .
deps:
- bot2:install
bot2:test:unit:
dir: bot2
desc: Run bot2 unit tests only (no server required)
cmds:
- uv run pytest tests/unit/ -v
deps:
- bot2:install
bot2:test:integration:
dir: bot2
desc: Run bot2 integration tests (excluding slow tests, requires running server)
cmds:
- uv run pytest tests/integration/ -v
deps:
- bot2:install
bot2:test:integration:fast:
dir: bot2
desc: Run bot2 integration tests (excluding slow tests, requires running server)
cmds:
- uv run pytest tests/integration/ -v -m "not slow"
deps:
- bot2:install
bot2:test:integration:slow:
dir: bot2
desc: Run slow bot2 integration tests (requires running server)
cmds:
- uv run pytest tests/integration/ -v -m "slow"
deps:
- bot2:install
bot2:test:all:
dir: bot2
desc: Run all bot2 tests (including slow tests,requires running server)
cmds:
- uv run pytest tests/ -v
deps:
- bot2:install
bot2:check:
dir: bot2
desc: Run all bot2 checks (lint, format, typecheck, tests)
deps:
- bot2:lint
- bot2:format
- bot2:typecheck
bot2:service:
dir: bot2
desc: Run the Bot Service
cmds:
- uv run python -m bot.service
deps:
- bot2:install
bot2:service:dev:
dir: bot2
desc: Run the Bot Service with auto-reload for development
cmds:
- uv run uvicorn bot.service.bot_service:app --reload --host 0.0.0.0 --port 8080
deps:
- bot2:install
#
# backend (golang) tasks
#
be:build:
dir: backend
desc: Build the backend Go application
cmds:
- go build ./...
be:test:
dir: backend
desc: Run backend unit tests
cmds:
- go test ./... -v
be:test:short:
dir: backend
desc: Run backend unit tests (short mode)
cmds:
- go test ./... -short
be:lint:
dir: backend
desc: Run backend linting with golangci-lint
cmds:
- golangci-lint run
be:format:
dir: backend
desc: Format backend Go code
cmds:
- go fmt ./...
be:format:check:
dir: backend
desc: Check backend Go code formatting (no fix)
cmds:
- test -z "$(gofmt -l .)"
be:vet:
dir: backend
desc: Run go vet on backend code
cmds:
- go vet ./...
be:tidy:
dir: backend
desc: Tidy backend Go modules
cmds:
- go mod tidy
be:check:
dir: backend
desc: Run all backend checks (build, vet, test)
cmds:
- task: be:build
- task: be:vet
be:run:
dir: backend
desc: Run backend application
cmds:
- go run main.go
#
# kubernetes tasks
#
k8s:install-envsubst:
desc: Install envsubst for Windows (required for k8s manifest templating)
platforms: [windows]
cmds:
- go install github.com/a8m/envsubst/cmd/envsubst@latest
status:
- which envsubst
k8s:install-kind:
desc: Install kind (Kubernetes in Docker) for local cluster development
cmds:
- go install sigs.k8s.io/kind@latest
status:
- which kind
k8s:cluster-create:
desc: Create an empty kind cluster (use k8s:cluster-setup for full setup)
deps:
- k8s:install-kind
cmds:
- kind create cluster --name towerfall
- kubectl config use-context kind-towerfall
- echo "Cluster created! Run 'task k8s:build-load' then 'task k8s:deploy'"
status:
- kind get clusters | grep -q "^towerfall$"
k8s:cluster-destroy:
desc: Delete the kind cluster and all resources
cmds:
- kind delete cluster --name towerfall
status:
- '! kind get clusters | grep -q "^towerfall$"'
k8s:deploy:
dir: k8s
desc: Generate manifests and deploy to current cluster
preconditions:
- sh: test -f .env
msg: "k8s/.env file not found. Copy .env.example to .env and configure it."
cmds:
- cmd: bash install.sh --apply
platforms: [linux, darwin]
- cmd: powershell -ExecutionPolicy Bypass -File install.ps1 -Apply
platforms: [windows]
k8s:build-load:
desc: Rebuild all Docker images and load into kind cluster
cmds:
- docker build -t towerfall/backend:latest ./backend
- docker build -t towerfall/frontend:latest ./frontend
- docker build -t towerfall/bot2:latest ./bot2
- kind load docker-image towerfall/backend:latest --name towerfall
- kind load docker-image towerfall/frontend:latest --name towerfall
- kind load docker-image towerfall/bot2:latest --name towerfall
- cmd: kubectl rollout restart -n towerfall deployment/backend deployment/frontend deployment/bot2 2>/dev/null || echo "Note - Deployments not yet created, skipping restart"
ignore_error: true
k8s:cluster-setup:
desc: Create a kind cluster, build images, and deploy all services
cmds:
- task: k8s:cluster-create
- task: k8s:build-load
- task: k8s:deploy
- echo "Cluster ready! Use 'kubectl get pods -n towerfall' to check status"
k8s:logs:
desc: View logs from all towerfall pods
cmds:
- kubectl logs -n towerfall -l app=backend --tail=50
- kubectl logs -n towerfall -l app=frontend --tail=50
- kubectl logs -n towerfall -l app=bot2 --tail=50
- kubectl logs -n towerfall -l app=cloudflared --tail=50
k8s:status:
desc: Show status of all towerfall resources
cmds:
- kubectl get pods,svc,deployments,configmaps -n towerfall