-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
418 lines (350 loc) · 14.8 KB
/
Copy pathTaskfile.yml
File metadata and controls
418 lines (350 loc) · 14.8 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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
version: "3"
vars:
PYTHON: uv run --no-sync python
MATURIN: uv run --no-sync maturin
# On NixOS, maturin's hard-link install can silently leave the old .so in
# site-packages. SO_CP copies the freshly-built .so to the correct location.
PY_SO_DST: uv run --no-sync python -c "import sysconfig,os; print(os.path.join(sysconfig.get_path('platlib'),'object_storage_proxy','object_storage_proxy'+sysconfig.get_config_var('EXT_SUFFIX')))"
tasks:
# ── setup ──────────────────────────────────────────────────────────────────
setup:
desc: "Install Python dev dependencies and install git hooks"
cmds:
- uv sync
- uv run pre-commit install
- echo "✅ pre-commit hooks installed"
hooks:install:
desc: "Install (or re-install) the pre-commit git hooks"
cmds:
- uv run pre-commit install
hooks:run:
desc: "Run pre-commit checks against all files"
cmds:
- uv run pre-commit run --all-files
hooks:update:
desc: "Bump pre-commit hook revisions to latest"
cmds:
- uv run pre-commit autoupdate
# ── changelog ─────────────────────────────────────────────────────────────
changelog:
desc: "Regenerate CHANGELOG.md from git history (all tags)"
cmds:
- git cliff --config cliff.toml -o CHANGELOG.md
changelog:unreleased:
desc: "Preview unreleased changes since the last tag"
cmds:
- git cliff --config cliff.toml --unreleased
changelog:tag:
desc: "Generate changelog for a specific tag range, e.g. task changelog:tag -- v0.5.3..v0.5.4"
cmds:
- git cliff --config cliff.toml {{.CLI_ARGS}}
# ── release ────────────────────────────────────────────────────────────────
# Usage: bump version in Cargo.toml, then run `task release`
release:
desc: "Read version from Cargo.toml, update CHANGELOG, commit, and tag"
cmds:
- |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/version = "//;s/"//')
TAG="v${VERSION}"
echo "Releasing ${TAG}"
# 1. Regenerate CHANGELOG.md for the new tag
git cliff --config cliff.toml --tag "${TAG}" -o CHANGELOG.md
# 2. Stage and commit
git add Cargo.toml CHANGELOG.md
# Run pre-commit; if it auto-fixes files, stage again and retry
git diff --cached --quiet && echo "Nothing to commit" || \
git commit -m "chore: release ${TAG}" || \
{ git add Cargo.toml CHANGELOG.md && git commit -m "chore: release ${TAG}"; }
# 3. Create the annotated tag
git tag -a "${TAG}" -m "Release ${TAG}"
# 4. Push commit and tag
git push
git push origin "${TAG}"
echo "✅ Released ${TAG}"
# ── build ──────────────────────────────────────────────────────────────────
build:
desc: "Compile the Rust extension and install it into .venv (dev build)"
cmds:
- cargo build
- cp target/debug/libobject_storage_proxy.so $({{.PY_SO_DST}})
build:release:
desc: "Compile with release optimisations and install into .venv"
cmds:
- cargo build --release
- cp target/release/libobject_storage_proxy.so $({{.PY_SO_DST}})
wheel:
desc: "Build a debug wheel into target/wheels/"
cmds:
- uv run maturin build
wheel:release:
desc: "Build a release wheel into target/wheels/"
cmds:
- "{{.MATURIN}} build --release"
# ── run ────────────────────────────────────────────────────────────────────
run:
desc: "Build (dev) and start the proxy test server"
deps: [build]
cmds:
- "{{.PYTHON}} test_server.py"
run:release:
desc: "Build (release) and start the proxy test server"
deps: [build:release]
cmds:
- "{{.PYTHON}} test_server.py"
# ── test ───────────────────────────────────────────────────────────────────
test:rust:
desc: "Run Rust unit tests with cargo nextest (falls back to cargo test)"
cmds:
- cargo nextest run
ignore_error: false
test:rust:cargo:
desc: "Run Rust unit tests with plain cargo test"
cmds:
- cargo test
test:integration:
desc: "Run the integration test shell script"
cmds:
- bash test_integration.sh
test:
desc: "Run all tests (Rust + integration)"
deps: [build]
cmds:
- task: test:rust
- task: test:integration
# ── integration environment ────────────────────────────────────────────────
# Lifecycle is intentionally split so you can keep Garage running for
# manual dev/testing while restarting just the proxy (or vice-versa).
#
# Quick reference:
# task integration:up # full stack (garage + bootstrap + proxy)
# task integration:down # tear everything down
# task integration:test # run tests against whatever is running
# task integration:run # automated: up -> test -> down
#
# task integration:garage:up # just Garage (stays running)
# task integration:garage:bootstrap # create bucket + key, write .env
# task integration:server:start # just the OSP proxy (background)
# task integration:server:stop # kill the proxy
#
# task integration:minio:up # start MinIO container
# task integration:minio:bootstrap # create bucket, write .env.minio
# task integration:minio:down # stop MinIO container
# task integration:minio:destroy # stop MinIO AND remove volumes
# task integration:test:spark # Spark tests against all backends
# task integration:test:spark:garage # Spark tests (Garage only)
# task integration:test:spark:minio # Spark tests (MinIO only)
# task integration:test:duckdb # DuckDB tests against all backends
# task integration:test:duckdb:fast # DuckDB tests, stop on first failure
integration:setup:
desc: "Install Python deps for the integration test project"
dir: integration/test_server
cmds:
- uv sync
integration:garage:up:
desc: "Start the Garage S3 container (stays running)"
dir: integration/test_server
cmds:
- docker compose up -d
- echo "Garage starting — waiting for healthy status …"
- |
for i in $(seq 1 30); do
status=$(docker inspect --format='{{"{{"}}{{".State.Health.Status"}}{{"}}"}}' osp-garage 2>/dev/null)
if [ "$status" = "healthy" ]; then echo "Garage is healthy"; exit 0; fi
echo " waiting… ($i/30) status=$status"; sleep 2
done
echo "Garage did not become healthy in time" >&2; exit 1
integration:garage:down:
desc: "Stop and remove the Garage container"
dir: integration/test_server
cmds:
- docker compose down
integration:garage:destroy:
desc: "Stop Garage AND remove its data volumes"
dir: integration/test_server
cmds:
- docker compose down -v
integration:garage:logs:
desc: "Follow Garage container logs"
dir: integration/test_server
cmds:
- docker compose logs -f
integration:garage:status:
desc: "Show Garage cluster status via admin API"
cmds:
- |
curl -sf -H "Authorization: Bearer osp-integration-admin-token" \
http://localhost:3903/v1/status | python3 -m json.tool
integration:garage:bootstrap:
desc: "Create bucket + HMAC key in Garage, write integration/test_server/.env"
dir: integration/test_server
cmds:
- uv run python bootstrap.py
integration:minio:up:
desc: "Start the MinIO container (stays running)"
dir: integration/test_server
cmds:
- docker compose up -d minio
- echo "MinIO starting — waiting for healthy status …"
- |
for i in $(seq 1 30); do
status=$(docker inspect --format='{{"{{"}}{{".State.Health.Status"}}{{"}}"}}' osp-minio 2>/dev/null)
if [ "$status" = "healthy" ]; then echo "MinIO is healthy"; exit 0; fi
echo " waiting… ($i/30) status=$status"; sleep 2
done
echo "MinIO did not become healthy in time" >&2; exit 1
integration:minio:bootstrap:
desc: "Create MinIO bucket and write integration/test_server/.env.minio"
dir: integration/test_server
cmds:
- uv run python minio_bootstrap.py
integration:minio:down:
desc: "Stop and remove the MinIO container"
dir: integration/test_server
cmds:
- docker compose stop minio
- docker compose rm -f minio
integration:minio:destroy:
desc: "Stop MinIO AND remove its data volumes"
dir: integration/test_server
cmds:
- docker compose down -v minio
integration:server:start:
desc: "Start the OSP proxy in the background (logs -> integration/test_server/proxy.log)"
cmds:
- |
nohup uv run --no-sync python integration/test_server/server.py \
> integration/test_server/proxy.log 2>&1 &
sleep 2
pgrep -f "server\.py" | head -1 > integration/test_server/.proxy.pid
if kill -0 $(cat integration/test_server/.proxy.pid) 2>/dev/null; then
echo "✅ Proxy started (PID=$(cat integration/test_server/.proxy.pid))"
echo " logs: integration/test_server/proxy.log"
echo " http://localhost:6190 metrics: http://localhost:9091/metrics"
else
echo "❌ Proxy failed to start — check integration/test_server/proxy.log"
exit 1
fi
integration:server:stop:
desc: "Stop the background OSP proxy"
cmds:
- |
PID_FILE=integration/test_server/.proxy.pid
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
kill "$PID" 2>/dev/null && echo "Proxy (PID=$PID) stopped." || echo "Process not found."
rm -f "$PID_FILE"
else
echo "No .proxy.pid file found — proxy may not be running."
fi
integration:server:logs:
desc: "Tail the proxy log"
cmds:
- tail -f integration/test_server/proxy.log
integration:bootstrap:
desc: "Bootstrap both backends: create Garage bucket+key and MinIO bucket, write .env files"
cmds:
- task: integration:garage:bootstrap
- task: integration:minio:bootstrap
integration:up:
desc: "Full environment: Garage + MinIO up -> bootstrap both -> proxy start"
cmds:
- task: integration:garage:up
- task: integration:minio:up
- task: integration:bootstrap
- task: integration:server:start
integration:down:
desc: "Tear down: stop proxy -> stop Garage + MinIO"
cmds:
- task: integration:server:stop
- task: integration:garage:down
- task: integration:minio:down
integration:test:
desc: "Run integration tests against the running environment (excludes Spark and DuckDB)"
dir: integration/test_server
cmds:
- uv run pytest tests/ -q -m 'not spark and not spark_minio and not duckdb'
integration:test:fast:
desc: "Run integration tests, stop on first failure (excludes Spark and DuckDB)"
dir: integration/test_server
cmds:
- uv run pytest tests/ -q -x -m 'not spark and not spark_minio and not duckdb'
integration:test:spark:
desc: "Run Spark s3a tests against all backends (Garage + MinIO)"
cmds:
- task: integration:test:spark:garage
- task: integration:test:spark:minio
integration:test:spark:garage:
desc: "Run only the Spark s3a tests (Garage backend)"
dir: integration/test_server
cmds:
- uv run pytest tests/test_spark.py -q -m spark
integration:test:spark:garage:fast:
desc: "Run Spark tests (Garage), stop on first failure"
dir: integration/test_server
cmds:
- uv run pytest tests/test_spark.py -q -m spark -x
integration:test:spark:fast:
desc: "Run Spark tests against all backends, stop on first failure"
dir: integration/test_server
cmds:
- uv run pytest tests/test_spark.py tests/test_spark_minio.py -q -m 'spark or spark_minio' -x
integration:test:spark:minio:
desc: "Run only the Spark s3a tests (MinIO backend)"
dir: integration/test_server
cmds:
- uv run pytest tests/test_spark_minio.py -q -m spark_minio
integration:test:spark:minio:fast:
desc: "Run Spark tests (MinIO), stop on first failure"
dir: integration/test_server
cmds:
- uv run pytest tests/test_spark_minio.py -q -m spark_minio -x
integration:test:duckdb:
desc: "Run DuckDB httpfs tests against all backends (Garage + MinIO)"
dir: integration/test_server
cmds:
- uv run pytest tests/test_duckdb.py -q -m duckdb
integration:test:duckdb:fast:
desc: "Run DuckDB httpfs tests, stop on first failure"
dir: integration/test_server
cmds:
- uv run pytest tests/test_duckdb.py -q -m duckdb -x
integration:test:all:
desc: "Run full test suite including Spark and DuckDB tests"
cmds:
- task: integration:test
- task: integration:test:spark
- task: integration:test:duckdb
integration:run:
desc: "Automated: up -> test -> down (tears down even on failure)"
cmds:
- task: integration:up
- defer: {task: integration:down}
- task: integration:test
# ── lint / fmt ─────────────────────────────────────────────────────────────
fmt:
desc: "Format Rust code"
cmds:
- cargo fmt
lint:rust:
desc: "Run clippy on the Rust code"
cmds:
- cargo clippy -- -D warnings
lint:
desc: "Lint everything (Rust clippy)"
cmds:
- task: lint:rust
# ── clean ──────────────────────────────────────────────────────────────────
clean:
desc: "Remove Rust build artefacts and the Python virtual environment"
cmds:
- cargo clean
- rm -rf .venv
clean:wheels:
desc: "Remove built wheels only"
cmds:
- rm -rf target/wheels
# ── default ────────────────────────────────────────────────────────────────
default:
desc: "Show available tasks"
cmds:
- task --list