-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTaskfile.yml
More file actions
286 lines (256 loc) · 8.87 KB
/
Taskfile.yml
File metadata and controls
286 lines (256 loc) · 8.87 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
version: '3'
vars:
LOCALSTACK_CONTAINER: claws-localstack
tasks:
build:
desc: Build the claws binary
cmds:
- go build -o claws ./cmd/claws
run:
desc: Run claws
deps: [build]
cmds:
- ./claws
test:
desc: Run all tests
cmds:
- go test ./...
test-race:
desc: Run tests with race detector (requires CGO and C compiler)
cmds:
- CGO_ENABLED=1 go test -race ./...
test-cover:
desc: Run tests with coverage report
cmds:
- go test ./... -cover -coverprofile=coverage.out
- go tool cover -func=coverage.out | tail -1
# LocalStack tasks
localstack:start:
desc: Start LocalStack container
cmds:
- docker start {{.LOCALSTACK_CONTAINER}} 2>/dev/null || docker run -d --name {{.LOCALSTACK_CONTAINER}} -p 4566:4566 localstack/localstack:4.12.0
- |
echo "Waiting for LocalStack to be ready..."
for i in $(seq 1 30); do
if curl -s --connect-timeout 2 --max-time 5 http://localhost:4566/_localstack/health 2>/dev/null | grep -qE '"s3": "(available|running)"'; then
echo "LocalStack started at http://localhost:4566"
exit 0
fi
sleep 1
done
echo "LocalStack failed to start within 30s"
exit 1
localstack:stop:
desc: Stop LocalStack container
cmds:
- docker stop {{.LOCALSTACK_CONTAINER}} || true
localstack:clean:
desc: Remove LocalStack container
cmds:
- docker rm -f {{.LOCALSTACK_CONTAINER}} || true
localstack:logs:
desc: Show LocalStack logs
cmds:
- docker logs -f {{.LOCALSTACK_CONTAINER}}
localstack:demo-setup:
desc: Create demo resources in LocalStack (VPCs, EC2, S3)
deps: [localstack:start]
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_EC2_METADATA_DISABLED: "true"
cmds:
- ./scripts/localstack-demo-setup.sh
localstack:demo-cleanup:
desc: Cleanup demo resources from LocalStack
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_EC2_METADATA_DISABLED: "true"
cmds:
- ./scripts/localstack-demo-cleanup.sh
localstack:demo:
desc: Run claws against LocalStack
deps: [build, localstack:start]
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_EC2_METADATA_DISABLED: "true"
cmds:
- ./claws
demo:record:
desc: Record all demos (gif + screenshots) using VHS + LocalStack
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- task: demo:record:gif
- task: demo:record:themes
- task: demo:record:theme-light
- task: demo:record:features
- task: demo:record:command-mode
demo:record:gif:
desc: Record demo.gif only
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs docs/tapes/demo.tape
demo:record:themes:
desc: Record theme screenshots only
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs docs/tapes/themes.tape
demo:record:features:
desc: Record feature screenshots only
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs docs/tapes/features.tape
demo:record:theme-light:
desc: Record light theme screenshot (requires white terminal background)
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs docs/tapes/theme-light.tape
demo:record:command-mode:
desc: Record command mode suggestion/completion test
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "demo:record requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs docs/tapes/command-mode.tape
test:vhs:
desc: Run all VHS tapes as integration tests
deps: [build, localstack:start, localstack:demo-setup]
preconditions:
- sh: '[ "$(uname -s)" = "Linux" ]'
msg: "test:vhs requires Linux (--network host not supported on macOS/Windows)"
cmds:
- |
set -e
for tape in docs/tapes/*.tape; do
echo "=========================================="
echo "Running: $tape"
echo "=========================================="
docker run --rm --network host \
-v "$(pwd)":/vhs \
-v "$(pwd)/scripts/demo-aws-config:/root/.aws:ro" \
-e AWS_ENDPOINT_URL=http://localhost:4566 \
-e AWS_EC2_METADATA_DISABLED=true \
ghcr.io/charmbracelet/vhs "$tape"
done
test-localstack:
desc: Run integration tests with LocalStack
deps: [localstack:start]
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
AWS_EC2_METADATA_DISABLED: "true"
cmds:
- go test -v ./... -tags=integration -timeout 60s
test-pty:
desc: Run PTY test (TUI test in headless environment)
cmds:
- go test -v ./internal/app/ -run TestPTY -timeout 60s
clean:
desc: Clean build artifacts
cmds:
- rm -f claws
- rm -f coverage.out
lint:
desc: Run linters (requires golangci-lint)
cmds:
- golangci-lint run
fmt:
desc: Format code
cmds:
- go fmt ./...
gen-imports:
desc: Regenerate cmd/claws/imports_custom.go from custom/**/register.go
cmds:
- go run ./scripts/gen-imports
release:
desc: "Create a new release (usage: task release -- v0.1.0)"
cmds:
- |
VERSION="{{.CLI_ARGS}}"
if [ -z "$VERSION" ]; then
echo "Usage: task release -- v0.x.x"
exit 1
fi
if ! echo "$VERSION" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: Version must be in format v0.x.x (e.g., v0.1.0)"
exit 1
fi
echo "Creating release $VERSION..."
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
echo "Release $VERSION created and pushed!"
echo "GitHub Actions will build and publish the release."
# EKS Integration Test tasks
eks-test-up:
desc: Deploy EKS test stack for integration testing (~15-20 min)
dir: custom/eks/test-fixtures/cloudformation
cmds:
- ./deploy.sh
eks-test-down:
desc: Clean up EKS test stack (~10-15 min)
dir: custom/eks/test-fixtures/cloudformation
cmds:
- ./cleanup.sh
eks-test:
desc: Full EKS integration test (deploy, test, cleanup)
cmds:
- task: eks-test-up
- |
echo "Stack deployed. Test with claws manually, then run 'task eks-test-down' to cleanup."
echo "Example: AWS_REGION=us-east-1 claws"