-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathTaskfile.yml
More file actions
467 lines (393 loc) · 13.9 KB
/
Taskfile.yml
File metadata and controls
467 lines (393 loc) · 13.9 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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
version: '3'
# Global variables
vars:
BUILD_TYPE: '{{.BUILD_TYPE | default "Release"}}'
RTMS_DEBUG: '{{.RTMS_DEBUG | default "OFF"}}'
NODE_VERSION: "22"
PYTHON_VERSION: "3.13"
CMAKE_VERSION: "3.25"
# Environment variables for all tasks
env:
CMAKE_BUILD_TYPE: '{{.BUILD_TYPE}}'
tasks:
# =============================================================================
# Setup & Verification
# =============================================================================
setup:
desc: "Initialize project (fetch SDK, install dependencies)"
cmds:
- node scripts/check-deps.js
- npm install
sources:
- package.json
- package-lock.json
generates:
- node_modules/.package-lock.json
doctor:
desc: "Verify system meets minimum requirements"
cmds:
- node scripts/doctor.js
# =============================================================================
# Node.js Build Tasks
# =============================================================================
build:js:
desc: "Build Node.js bindings (local platform)"
cmds:
- npx cmake-js compile --CDCMAKE_BUILD_TYPE={{.BUILD_TYPE}} --CDRTMS_DEBUG={{.RTMS_DEBUG}}
sources:
- src/**/*.cpp
- src/**/*.h
- lib/include/**/*.h
- CMakeLists.txt
- package.json
generates:
- build/{{.BUILD_TYPE}}/rtms.node
- build/{{.BUILD_TYPE}}/index.js
build:js:linux:
desc: "Build Node.js bindings for Linux (via Docker)"
cmds:
- docker compose run --rm build task build:js BUILD_TYPE={{.BUILD_TYPE}} RTMS_DEBUG={{.RTMS_DEBUG}}
build:js:darwin:
desc: "Build Node.js bindings for macOS"
cmds:
- task: build:js
# =============================================================================
# Python Build Tasks
# =============================================================================
build:py:
desc: "Build Python wheel (local platform)"
cmds:
- mkdir -p dist/py
# Remove any existing wheels for the current platform to avoid conflicts
- |
if [ "{{OS}}" = "darwin" ]; then
rm -f dist/py/*macosx*.whl
else
rm -f dist/py/*linux*.whl dist/py/*manylinux*.whl
fi
- python3 -m build --wheel -Ccmake.build-type={{.BUILD_TYPE}} --outdir dist/py
sources:
- src/**/*.cpp
- src/**/*.h
- src/**/*.py
- lib/include/**/*.h
- CMakeLists.txt
- pyproject.toml
generates:
- dist/py/*.whl
build:py:linux:
desc: "Build Python wheel for Linux (via Docker)"
cmds:
- docker compose run --rm build task build:py BUILD_TYPE={{.BUILD_TYPE}}
- docker compose run --rm build task repair:py
build:py:darwin:
desc: "Build Python wheel for macOS"
cmds:
- task: build:py
repair:py:
desc: "Repair Linux Python wheels with auditwheel (converts to manylinux)"
cmds:
- |
if [ "{{OS}}" = "linux" ] && ls dist/py/*linux*.whl 1> /dev/null 2>&1; then
echo "Repairing Linux wheels with auditwheel..."
for wheel in dist/py/*linux_x86_64*.whl; do
if [ -f "$wheel" ]; then
echo "Repairing: $wheel"
auditwheel repair "$wheel" --plat manylinux_2_34_x86_64 --exclude librtmsdk.so.0 -w dist/py
rm "$wheel"
echo "Wheel repaired successfully"
fi
done
else
echo "Skipping wheel repair (not Linux or no Linux wheels found)"
fi
# cibuildwheel tasks for multi-version Python wheel building
build:py:cibuildwheel:
desc: "Build Python wheels for all versions using cibuildwheel (auto-detect platform)"
deps: [doctor]
cmds:
- pip install cibuildwheel
- cibuildwheel --platform auto --output-dir dist/py
build:py:cibuildwheel:linux:
desc: "Build Python wheels for Linux (all versions via cibuildwheel's Docker)"
deps: [doctor]
cmds:
- pip install cibuildwheel
- cibuildwheel --platform linux --output-dir dist/py
build:py:cibuildwheel:darwin:
desc: "Build Python wheels for macOS (all versions)"
deps: [doctor]
cmds:
- pip install cibuildwheel
- cibuildwheel --platform macos --output-dir dist/py
# =============================================================================
# Go Build Tasks (Placeholder)
# =============================================================================
build:go:
desc: "Build Go bindings (placeholder)"
deps: [doctor]
cmds:
- echo "Go bindings not yet implemented"
- cmake-js configure --CDCMAKE_BUILD_TYPE={{.BUILD_TYPE}} --CDGO=true
build:go:linux:
desc: "Build Go bindings for Linux (placeholder)"
cmds:
- task: build:go
build:go:darwin:
desc: "Build Go bindings for macOS (placeholder)"
cmds:
- task: build:go
# =============================================================================
# Multi-Language Build Tasks
# =============================================================================
build:local:
desc: "Build all bindings for local platform"
cmds:
- task: build:js
- task: build:py
build:linux:
desc: "Build all bindings for Linux (via Docker)"
cmds:
- task: build:js:linux
- task: build:py:linux
build:all:
desc: "Build all bindings for all platforms"
cmds:
- task: build:local
- task: build:linux
# =============================================================================
# Prebuild & Packaging Tasks
# =============================================================================
prebuild:js:
desc: "Create Node.js prebuilds for all platforms"
deps: [build:js, build:js:linux]
cmds:
- node scripts/prebuild.js
prebuild:js:linux:
desc: "Create Node.js prebuilds for Linux only"
deps: [build:js:linux]
cmds:
- node scripts/prebuild.js --platform linux
prebuild:js:darwin:
desc: "Create Node.js prebuilds for macOS only"
deps: [build:js]
cmds:
- node scripts/prebuild.js --platform darwin
package:py:
desc: "Build Python sdist + wheels"
cmds:
- python3 -m build --outdir dist/py
# =============================================================================
# Testing Tasks
# =============================================================================
test:js:
desc: "Run Node.js tests (local)"
deps: [build:js]
cmds:
- npx jest tests/ts/rtms.test.ts tests/ts/rtms.wrapper.test.ts
test:js:integration:
desc: "Run npm pack → install → load integration test"
deps: [build:js]
cmds:
- npx jest tests/ts/pack-install.test.js --testTimeout=120000
test:js:linux:
desc: "Run Node.js tests in Linux Docker"
cmds:
- docker compose run --rm test-js
test:py:
desc: "Run Python tests (local darwin)"
deps: [build:py]
cmds:
- .venv/bin/pip install --force-reinstall --find-links=dist/py rtms --quiet
- .venv/bin/pytest tests/py/test_rtms.py -v
test:py:linux:
desc: "Run Python tests in Linux Docker"
cmds:
- docker compose run --rm test-py
test:cpp:
desc: "Build and run C++ unit tests (no SDK binary required)"
cmds:
- cmake -B build/tests -DRTMS_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
- cmake --build build/tests --target rtms_tests -j$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)
- cd build/tests && ctest --output-on-failure
test:local:
desc: "Run all tests locally"
cmds:
- task: test:js
- task: test:py
test:linux:
desc: "Run all tests in Linux Docker"
cmds:
- task: test:js:linux
- task: test:py:linux
test:all:
desc: "Run tests on all platforms (local + Docker)"
cmds:
- task: test:local
- task: test:linux
# =============================================================================
# Manual Testing Tasks
# =============================================================================
manual:js:
desc: "Run interactive Node.js manual test"
deps: [build:js]
cmds:
- NODE_ENV=test node --trace-deprecation --force-node-api-uncaught-exceptions-policy=true --env-file=.env test.js
manual:py:
desc: "Run interactive Python manual test"
deps: [build:py]
cmds:
# Install only the wheel matching the current platform
- |
if [ "{{OS}}" = "darwin" ]; then
python3 -m pip install --force-reinstall dist/py/*macosx*.whl
else
python3 -m pip install --force-reinstall dist/py/*manylinux*.whl
fi
- python3 test.py
manual:js:linux:
desc: "Run interactive Node.js manual test in Linux Docker"
cmds:
- docker compose run --rm -it --service-ports test-js sh -c "task build:js RTMS_DEBUG={{.RTMS_DEBUG}} && NODE_ENV=test node --trace-deprecation --force-node-api-uncaught-exceptions-policy=true --env-file=.env test.js"
manual:py:linux:
desc: "Run interactive Python manual test in Linux Docker"
cmds:
- docker compose run --rm -it --service-ports test-py sh -c "task build:py && task repair:py && pip install --force-reinstall dist/py/*manylinux*.whl && python3 test.py"
# =============================================================================
# Documentation Tasks
# =============================================================================
docs:js:
desc: "Generate Node.js API documentation"
cmds:
- mkdir -p docs
- cp .github/docs-template/index.html docs/
- npx --yes typedoc rtms.d.ts --highlightLanguages py --highlightLanguages js --highlightLanguages sh --highlightLanguages ts --plugin typedoc-plugin-missing-exports --out docs/js
sources:
- rtms.d.ts
- src/**/*.cpp
generates:
- docs/js/index.html
docs:py:
desc: "Generate Python API documentation"
cmds:
- mkdir -p docs
- pdoc3 -o docs/ --force --html rtms
# pdoc3 creates docs/rtms/, rename to docs/py/ for clean URL
- rm -rf docs/py
- mv docs/rtms docs/py
sources:
- src/**/*.py
- src/**/*.pyi
generates:
- docs/py/index.html
docs:all:
desc: "Generate all documentation"
cmds:
- task: docs:js
- task: docs:py
docs:serve:
desc: "Serve documentation locally (port 8000)"
deps: [docs:all]
cmds:
- python3 -m http.server 8000 --directory docs
# =============================================================================
# Publishing Tasks
# =============================================================================
publish:js:
desc: "Upload Node.js prebuilds to GitHub Releases (assumes prebuilds exist)"
cmds:
- node scripts/publish.js --node
publish:js:full:
desc: "Build and upload Node.js prebuilds to GitHub Releases"
deps: [prebuild:js]
cmds:
- node scripts/publish.js --node
publish:js:linux:
desc: "Upload Node.js prebuilds for Linux to GitHub Releases (assumes prebuilds exist)"
cmds:
- node scripts/publish.js --node --platform linux
publish:js:darwin:
desc: "Upload Node.js prebuilds for macOS to GitHub Releases (assumes prebuilds exist)"
cmds:
- node scripts/publish.js --node --platform darwin
publish:py:
desc: "Upload Python wheels to PyPI (assumes wheels exist in dist/py)"
cmds:
- node scripts/publish.js --python --prod
publish:py:test:
desc: "Upload Python wheels to TestPyPI (assumes wheels exist in dist/py)"
cmds:
- node scripts/publish.js --python --test
publish:py:full:
desc: "Build and upload Python wheels to PyPI"
deps: [build:py, build:py:linux]
cmds:
- node scripts/publish.js --python --prod
publish:py:test:full:
desc: "Build and upload Python wheels to TestPyPI"
deps: [build:py, build:py:linux]
cmds:
- node scripts/publish.js --python --test
# =============================================================================
# Utility Tasks
# =============================================================================
clean:
desc: "Remove all build artifacts"
cmds:
- rm -rf build dist docs prebuilds node_modules
- rm -rf **/__pycache__ **/*.egg-info
- rm -rf .pytest_cache .coverage htmlcov
- echo "Clean completed successfully"
clean:build:
desc: "Remove only build outputs (keep dependencies)"
cmds:
- rm -rf build dist docs prebuilds
- rm -rf **/__pycache__ **/*.egg-info
format:
desc: "Format code (placeholder)"
cmds:
- echo "Code formatting not yet configured"
lint:
desc: "Lint code (placeholder)"
cmds:
- echo "Code linting not yet configured"
# =============================================================================
# CI/CD Helper Tasks
# =============================================================================
ci:test:
desc: "Run CI test matrix"
cmds:
- task: test:all
ci:build:
desc: "Build for CI (all platforms)"
cmds:
- task: build:all
ci:docs:
desc: "Generate and verify documentation"
cmds:
- task: docs:all
- echo "Documentation generated successfully"
# =============================================================================
# Development Helper Tasks
# =============================================================================
dev:watch:
desc: "Watch for changes and rebuild (requires watchexec)"
cmds:
- watchexec -w src -w lib/include -e cpp,h -- task build:js
dev:shell:
desc: "Open interactive shell in Docker build environment"
cmds:
- docker compose run --rm -it build bash
# =============================================================================
# Legacy Compatibility (optional, for transition period)
# =============================================================================
npm:install:
desc: "npm install compatibility (calls setup)"
cmds:
- task: setup
# Default task - show help
default:
desc: "Show available tasks"
cmds:
- task --list
silent: true