-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
875 lines (738 loc) · 25.9 KB
/
Makefile.toml
File metadata and controls
875 lines (738 loc) · 25.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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
# fast-yaml cargo-make task definitions
# Version: 1.0.0
# Rust MSRV: 1.85.0 (Edition 2024)
# Python: 3.9+
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
skip_rust_env_info = false
skip_crate_env_info = false
[config.modify_core_tasks]
private = true
namespace = "core"
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_TERM_COLOR = "always"
CARGO_INCREMENTAL = "0"
RUST_BACKTRACE = "short"
RUSTFLAGS = "-D warnings"
# Python environment
PYTHON_DIR = "python"
PYTEST_ARGS = "-v"
# NodeJS environment
NODEJS_DIR = "nodejs"
# Coverage output
COVERAGE_OUTPUT = "lcov.info"
# ============================================================================
# Formatting Tasks
# ============================================================================
[tasks.format]
description = "Format all Rust, Python, and NodeJS code"
category = "Development"
dependencies = ["format-rust", "format-python", "format-nodejs"]
[tasks.format-rust]
description = "Format Rust code with nightly rustfmt (required for Edition 2024)"
category = "Development"
command = "cargo"
args = ["+nightly", "fmt", "--all"]
install_crate = { rustup_component_name = "rustfmt", binary = "rustfmt", test_arg = "--version" }
[tasks.format-python]
description = "Format Python code with ruff"
category = "Development"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "ruff", "format", "."]
[tasks.format-nodejs]
description = "Format NodeJS code with prettier"
category = "Development"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "format"]
[tasks.format-check]
description = "Check code formatting without modifying files"
category = "CI"
dependencies = ["format-check-rust", "format-check-python", "format-check-nodejs"]
[tasks.format-check-rust]
description = "Check Rust formatting with nightly rustfmt"
category = "CI"
command = "cargo"
args = ["+nightly", "fmt", "--all", "--", "--check"]
install_crate = { rustup_component_name = "rustfmt", binary = "rustfmt", test_arg = "--version" }
[tasks.format-check-python]
description = "Check Python formatting with ruff"
category = "CI"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "ruff", "format", "--check", "."]
[tasks.format-check-nodejs]
description = "Check NodeJS formatting with prettier"
category = "CI"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "format:check"]
# ============================================================================
# Linting Tasks
# ============================================================================
[tasks.clippy]
description = "Run Clippy linter on all Rust crates (excludes Python extension)"
category = "Development"
command = "cargo"
args = [
"clippy",
"--workspace",
"--all-targets",
"--all-features",
"--exclude", "fast-yaml",
"--",
"-D", "warnings"
]
install_crate = { rustup_component_name = "clippy", binary = "cargo-clippy", test_arg = "--version" }
[tasks.clippy-fix]
description = "Run Clippy with automatic fixes (excludes Python extension)"
category = "Development"
command = "cargo"
args = [
"clippy",
"--workspace",
"--all-targets",
"--all-features",
"--exclude", "fast-yaml",
"--fix",
"--allow-dirty",
"--allow-staged"
]
install_crate = { rustup_component_name = "clippy", binary = "cargo-clippy", test_arg = "--version" }
[tasks.lint-python]
description = "Lint Python code with ruff"
category = "Development"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "ruff", "check", "."]
[tasks.lint-nodejs]
description = "Lint NodeJS code with ESLint"
category = "Development"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "lint"]
[tasks.lint]
description = "Run all linters (Rust, Python, and NodeJS)"
category = "Development"
dependencies = ["clippy", "lint-python", "lint-nodejs"]
# ============================================================================
# Testing Tasks
# ============================================================================
[tasks.test]
description = "Run all Rust tests with nextest"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = ["nextest", "run", "--workspace", "--all-features", "--exclude", "fast-yaml"]
install_crate = { crate_name = "cargo-nextest", binary = "cargo-nextest", test_arg = "--version" }
[tasks.test-fast]
description = "Run Rust tests in fast mode (no doctests)"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = ["nextest", "run", "--workspace", "--all-features", "--no-fail-fast", "--exclude", "fast-yaml"]
install_crate = { crate_name = "cargo-nextest", binary = "cargo-nextest", test_arg = "--version" }
[tasks.test-doc]
description = "Run Rust documentation tests"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = ["test", "--doc", "--workspace", "--all-features", "--exclude", "fast-yaml"]
[tasks.test-rust]
description = "Run all Rust tests with nextest"
category = "Testing"
dependencies = ["test"]
[tasks.test-single]
description = "Run a single test by name (use: makers test-single -- test_name)"
category = "Testing"
command = "cargo"
args = ["nextest", "run", "--workspace", "${@}"]
install_crate = { crate_name = "cargo-nextest", binary = "cargo-nextest", test_arg = "--version" }
# ============================================================================
# Python Tasks
# ============================================================================
[tasks.python-build]
description = "Build Python extension with maturin"
category = "Python"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "maturin", "develop", "--release"]
[tasks.python-build-debug]
description = "Build Python extension in debug mode"
category = "Python"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "maturin", "develop"]
[tasks.python-test]
description = "Run Python test suite with pytest"
category = "Python"
dependencies = ["python-build"]
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "pytest", "../tests/", "-v"]
[tasks.python-test-verbose]
description = "Run Python tests with verbose output"
category = "Python"
dependencies = ["python-build"]
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "pytest", "../tests/", "-vv", "-s"]
[tasks.python-typecheck]
description = "Type check Python code with mypy"
category = "Python"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "mypy", "fast_yaml/"]
[tasks.python-coverage]
description = "Run Python tests with coverage"
category = "Python"
dependencies = ["python-build"]
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "pytest", "../tests/", "-v", "--cov=fast_yaml", "--cov-report=html", "--cov-report=xml"]
# ============================================================================
# NodeJS Tasks
# ============================================================================
[tasks.nodejs-deps]
description = "Install NodeJS dependencies"
category = "NodeJS"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["install"]
[tasks.nodejs-build]
description = "Build NodeJS native module with NAPI-RS (release mode)"
category = "NodeJS"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "build"]
[tasks.nodejs-build-debug]
description = "Build NodeJS native module in debug mode"
category = "NodeJS"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "build:debug"]
[tasks.nodejs-test]
description = "Run NodeJS test suite with Vitest"
category = "NodeJS"
dependencies = ["nodejs-build-debug"]
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["test"]
[tasks.nodejs-test-verbose]
description = "Run NodeJS tests with verbose output"
category = "NodeJS"
dependencies = ["nodejs-build-debug"]
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "test:verbose"]
[tasks.nodejs-typecheck]
description = "Type check NodeJS code with TypeScript"
category = "NodeJS"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "typecheck"]
[tasks.nodejs-bench]
description = "Run NodeJS benchmarks"
category = "NodeJS"
dependencies = ["nodejs-build"]
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "bench"]
[tasks.nodejs-coverage]
description = "Run NodeJS tests with coverage"
category = "NodeJS"
dependencies = ["nodejs-build-debug"]
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "test:coverage"]
# ============================================================================
# Documentation Tasks
# ============================================================================
[tasks.doc]
description = "Build Rust documentation (excludes Python extension)"
category = "Documentation"
command = "cargo"
args = ["doc", "--workspace", "--no-deps", "--all-features", "--exclude", "fast-yaml"]
[tasks.doc-open]
description = "Build and open documentation in browser"
category = "Documentation"
command = "cargo"
args = ["doc", "--workspace", "--no-deps", "--all-features", "--exclude", "fast-yaml", "--open"]
[tasks.doc-check]
description = "Check documentation for warnings (excludes Python extension)"
category = "CI"
command = "cargo"
args = ["doc", "--workspace", "--no-deps", "--all-features", "--exclude", "fast-yaml"]
env = { RUSTDOCFLAGS = "-D warnings" }
# ============================================================================
# Security Tasks
# ============================================================================
[tasks.deny]
description = "Run cargo-deny checks (advisories, licenses, bans)"
category = "Security"
command = "cargo"
args = ["deny", "check"]
install_crate = { crate_name = "cargo-deny", binary = "cargo-deny", test_arg = "--version" }
[tasks.deny-advisories]
description = "Check for security advisories with cargo-deny"
category = "Security"
command = "cargo"
args = ["deny", "check", "advisories"]
install_crate = { crate_name = "cargo-deny", binary = "cargo-deny", test_arg = "--version" }
[tasks.deny-licenses]
description = "Check license compliance with cargo-deny"
category = "Security"
command = "cargo"
args = ["deny", "check", "licenses"]
install_crate = { crate_name = "cargo-deny", binary = "cargo-deny", test_arg = "--version" }
[tasks.deny-bans]
description = "Check for banned dependencies with cargo-deny"
category = "Security"
command = "cargo"
args = ["deny", "check", "bans"]
install_crate = { crate_name = "cargo-deny", binary = "cargo-deny", test_arg = "--version" }
[tasks.semver-check]
description = "Check for SemVer compliance (requires published crate or git tag baseline)"
category = "Security"
script = '''
# Try to find the latest version tag for baseline comparison
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LATEST_TAG" ]; then
echo "Checking semver against baseline: $LATEST_TAG"
cargo semver-checks check-release --baseline-rev "$LATEST_TAG" --exclude fast-yaml
else
echo "No git tags found and crate not published - skipping semver check"
echo "To enable: create a version tag (e.g., v0.1.0) or publish to crates.io"
fi
'''
install_crate = { crate_name = "cargo-semver-checks", binary = "cargo-semver-checks", test_arg = "--version" }
# ============================================================================
# Code Coverage Tasks
# ============================================================================
[tasks.coverage]
description = "Generate Rust code coverage report (lcov format)"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = [
"llvm-cov",
"nextest",
"--workspace",
"--all-features",
"--exclude", "fast-yaml",
"--lcov",
"--output-path",
"${COVERAGE_OUTPUT}"
]
install_crate = { crate_name = "cargo-llvm-cov", binary = "cargo-llvm-cov", test_arg = "--version" }
[tasks.coverage-html]
description = "Generate HTML coverage report"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = [
"llvm-cov",
"nextest",
"--workspace",
"--all-features",
"--exclude", "fast-yaml",
"--html"
]
install_crate = { crate_name = "cargo-llvm-cov", binary = "cargo-llvm-cov", test_arg = "--version" }
[tasks.coverage-open]
description = "Generate and open HTML coverage report"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = [
"llvm-cov",
"nextest",
"--workspace",
"--all-features",
"--exclude", "fast-yaml",
"--html",
"--open"
]
install_crate = { crate_name = "cargo-llvm-cov", binary = "cargo-llvm-cov", test_arg = "--version" }
[tasks.coverage-summary]
description = "Display coverage summary in terminal"
category = "Testing"
command = "cargo"
# Exclude python crate (requires Python interpreter for linking)
args = [
"llvm-cov",
"nextest",
"--workspace",
"--all-features",
"--exclude", "fast-yaml"
]
install_crate = { crate_name = "cargo-llvm-cov", binary = "cargo-llvm-cov", test_arg = "--version" }
# ============================================================================
# Build Tasks
# ============================================================================
[tasks.build]
description = "Build all Rust crates in debug mode (excludes Python extension)"
category = "Build"
command = "cargo"
args = ["build", "--workspace", "--all-targets", "--exclude", "fast-yaml"]
[tasks.build-release]
description = "Build all Rust crates in release mode (excludes Python extension)"
category = "Build"
command = "cargo"
args = ["build", "--workspace", "--all-targets", "--release", "--exclude", "fast-yaml"]
[tasks.check]
description = "Quick check without building (excludes Python/NodeJS extensions)"
category = "Build"
command = "cargo"
args = ["check", "--workspace", "--all-targets", "--all-features", "--exclude", "fast-yaml", "--exclude", "fast-yaml-nodejs"]
[tasks.clean]
description = "Clean build artifacts"
category = "Build"
command = "cargo"
args = ["clean"]
# ============================================================================
# CI Composite Tasks
# ============================================================================
[tasks.ci-format]
description = "CI: Format checking (Rust + Python)"
category = "CI"
dependencies = ["format-check"]
[tasks.ci-lint]
description = "CI: Linting (Clippy + doc check)"
category = "CI"
dependencies = ["clippy", "doc-check"]
[tasks.ci-rust]
description = "CI: Rust checks (format, clippy, test, doc)"
category = "CI"
dependencies = ["format-check-rust", "clippy", "test-rust", "doc-check"]
[tasks.ci-python]
description = "CI: Python checks (build, test, typecheck)"
category = "CI"
dependencies = ["python-build", "python-test", "python-typecheck"]
[tasks.ci-nodejs]
description = "CI: NodeJS checks (build, test, typecheck)"
category = "CI"
dependencies = ["nodejs-build-debug", "nodejs-test", "nodejs-typecheck"]
[tasks.ci-security]
description = "CI: Security checks (cargo-deny)"
category = "CI"
dependencies = ["deny"]
[tasks.ci-coverage]
description = "CI: Generate coverage reports (Rust + Python)"
category = "CI"
dependencies = ["coverage", "python-coverage"]
[tasks.ci-all]
description = "CI: Run complete pipeline"
category = "CI"
dependencies = [
"format-check",
"clippy",
"test-rust",
"doc-check",
"deny",
"python-build",
"python-test",
"python-typecheck",
"nodejs-build-debug",
"nodejs-test",
"nodejs-typecheck"
]
# ============================================================================
# Developer Workflow Tasks
# ============================================================================
[tasks.dev]
description = "Developer workflow: format, lint, test"
category = "Development"
dependencies = ["format", "clippy-fix", "test-rust"]
[tasks.pre-commit]
description = "Pre-commit checks: format-check, clippy, test"
category = "Development"
dependencies = ["format-check", "clippy", "test-rust"]
[tasks.pre-push]
description = "Pre-push checks: full CI pipeline"
category = "Development"
dependencies = ["ci-all"]
[tasks.watch]
description = "Watch for changes and run tests (requires cargo-watch)"
category = "Development"
install_crate = { crate_name = "cargo-watch", binary = "cargo-watch", test_arg = "--version" }
command = "cargo"
args = ["watch", "-x", "nextest run"]
[tasks.watch-test]
description = "Watch specific test pattern (use: makers watch-test -- pattern)"
category = "Development"
install_crate = { crate_name = "cargo-watch", binary = "cargo-watch", test_arg = "--version" }
script = '''
cargo watch -x "nextest run ${@}"
'''
# ============================================================================
# Benchmarking Tasks
# ============================================================================
[tasks.bench]
description = "Run all benchmarks (excludes Python extension)"
category = "Performance"
command = "cargo"
args = ["bench", "--workspace", "--exclude", "fast-yaml"]
[tasks.bench-fast-yaml-core]
description = "Run benchmarks for fast-yaml-core"
category = "Performance"
command = "cargo"
args = ["bench", "-p", "fast-yaml-core"]
# ============================================================================
# Utility Tasks
# ============================================================================
[tasks.tree]
description = "Display dependency tree (excludes Python extension)"
category = "Utility"
command = "cargo"
args = ["tree", "--workspace", "--exclude", "fast-yaml"]
[tasks.outdated]
description = "Check for outdated dependencies (excludes Python extension)"
category = "Utility"
command = "cargo"
args = ["outdated", "--workspace", "--exclude", "fast-yaml"]
install_crate = { crate_name = "cargo-outdated", binary = "cargo-outdated", test_arg = "--version" }
[tasks.bloat]
description = "Analyze binary size bloat"
category = "Utility"
command = "cargo"
args = ["bloat", "--release", "--crates"]
install_crate = { crate_name = "cargo-bloat", binary = "cargo-bloat", test_arg = "--version" }
[tasks.update]
description = "Update dependencies"
category = "Utility"
command = "cargo"
args = ["update"]
[tasks.verify-project]
description = "Verify project structure and configuration"
category = "Utility"
script = '''
#!/bin/bash
set -e
echo "Verifying project structure..."
# Check Rust version
echo "Checking Rust version..."
rustc --version | grep -q "1.85" || echo "Warning: Expected Rust 1.85.0 or later"
# Check workspace structure
echo "Checking workspace members..."
cargo metadata --format-version 1 --no-deps | grep -q "fast-yaml-core" || { echo "Error: fast-yaml-core not found"; exit 1; }
cargo metadata --format-version 1 --no-deps | grep -q "fast-yaml-linter" || { echo "Error: fast-yaml-linter not found"; exit 1; }
cargo metadata --format-version 1 --no-deps | grep -q "fast-yaml-parallel" || { echo "Error: fast-yaml-parallel not found"; exit 1; }
# Check Python directory
if [ -d "python" ]; then
echo "Python bindings directory found"
else
echo "Warning: Python bindings directory not found"
fi
echo "Project structure verified successfully!"
'''
[tasks.help]
description = "Show available tasks"
category = "Utility"
script = '''
echo "fast-yaml cargo-make tasks"
echo ""
echo "Development:"
echo " format - Format Rust, Python, and NodeJS code"
echo " lint - Run all linters"
echo " test - Run Rust tests with nextest"
echo " dev - Format + lint + test"
echo " watch - Watch and run tests on changes"
echo ""
echo "Python:"
echo " python-build - Build Python extension"
echo " python-test - Run Python tests"
echo " python-typecheck - Type check Python code"
echo ""
echo "NodeJS:"
echo " nodejs-deps - Install NodeJS dependencies"
echo " nodejs-build - Build NodeJS native module"
echo " nodejs-test - Run NodeJS tests"
echo " nodejs-typecheck - Type check NodeJS code"
echo ""
echo "CI/CD:"
echo " ci-rust - Rust CI pipeline"
echo " ci-python - Python CI pipeline"
echo " ci-nodejs - NodeJS CI pipeline"
echo " ci-security - Security checks"
echo " ci-all - Complete CI pipeline"
echo ""
echo "Coverage:"
echo " coverage - Generate lcov coverage report"
echo " coverage-html - Generate HTML coverage report"
echo ""
echo "Security:"
echo " deny - Run cargo-deny checks"
echo ""
echo "Documentation:"
echo " doc - Build documentation"
echo " doc-open - Build and open documentation"
echo ""
echo "Release:"
echo " release-crates - Publish Rust crates to crates.io"
echo " release-crates-dry-run - Dry run: verify crates can be published"
echo " release-python-build - Build Python wheels for current platform"
echo " release-python-publish - Publish Python package to PyPI"
echo " release-nodejs-build - Build NodeJS native module for release"
echo " release-nodejs-publish - Publish NodeJS package to npm"
echo " release-check-version - Verify version consistency"
echo ""
echo "Utility:"
echo " clean - Clean build artifacts"
echo " tree - Show dependency tree"
echo " verify-project - Verify project structure"
echo ""
echo "Run 'cargo make <task>' to execute a task"
'''
# ============================================================================
# Release Tasks
# ============================================================================
[tasks.release-crates]
description = "Publish Rust crates to crates.io in dependency order"
category = "Release"
script = '''
#!/bin/bash
set -e
echo "Publishing Rust crates to crates.io in dependency order..."
# Check if CARGO_REGISTRY_TOKEN is set
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
echo "Error: CARGO_REGISTRY_TOKEN environment variable not set"
exit 1
fi
# Publish in dependency order (dependencies must be published first)
echo "Publishing fast-yaml-core..."
cd crates/fast-yaml-core && cargo publish --token "$CARGO_REGISTRY_TOKEN"
echo "Waiting 30 seconds for crates.io to index fast-yaml-core..."
sleep 30
echo "Publishing fast-yaml-linter..."
cd ../fast-yaml-linter && cargo publish --token "$CARGO_REGISTRY_TOKEN"
echo "Waiting 30 seconds for crates.io to index fast-yaml-linter..."
sleep 30
echo "Publishing fast-yaml-parallel..."
cd ../fast-yaml-parallel && cargo publish --token "$CARGO_REGISTRY_TOKEN"
echo "All crates published successfully!"
'''
[tasks.release-crates-dry-run]
description = "Dry run: verify crates can be published"
category = "Release"
script = '''
#!/bin/bash
set -e
echo "Dry-run: Publishing Rust crates to crates.io in dependency order..."
echo "Checking fast-yaml-core..."
cd crates/fast-yaml-core && cargo publish --dry-run
echo "Checking fast-yaml-linter..."
cd ../fast-yaml-linter && cargo publish --dry-run
echo "Checking fast-yaml-parallel..."
cd ../fast-yaml-parallel && cargo publish --dry-run
echo "All crates verified for publishing!"
'''
[tasks.release-python-build]
description = "Build Python wheels for current platform"
category = "Release"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "maturin", "build", "--release"]
[tasks.release-python-publish]
description = "Publish Python package to PyPI"
category = "Release"
cwd = "${PYTHON_DIR}"
script = '''
#!/bin/bash
set -e
if [ -z "$PYPI_API_TOKEN" ]; then
echo "Error: PYPI_API_TOKEN environment variable not set"
exit 1
fi
echo "Publishing Python package to PyPI..."
uv run maturin publish --username __token__ --password "$PYPI_API_TOKEN"
echo "Python package published successfully!"
'''
[tasks.release-python-publish-dry-run]
description = "Dry run: verify Python package can be published"
category = "Release"
cwd = "${PYTHON_DIR}"
command = "uv"
args = ["run", "maturin", "publish", "--dry-run"]
[tasks.release-nodejs-build]
description = "Build NodeJS native module for release"
category = "Release"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["run", "build"]
[tasks.release-nodejs-publish]
description = "Publish NodeJS package to npm"
category = "Release"
cwd = "${NODEJS_DIR}"
script = '''
#!/bin/bash
set -e
if [ -z "$NPM_TOKEN" ]; then
echo "Error: NPM_TOKEN environment variable not set"
exit 1
fi
# Configure npm authentication
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
echo "Publishing NodeJS package to npm..."
npm publish --access public
# Clean up
rm -f .npmrc
echo "NodeJS package published successfully!"
'''
[tasks.release-nodejs-publish-dry-run]
description = "Dry run: verify NodeJS package can be published"
category = "Release"
cwd = "${NODEJS_DIR}"
command = "npm"
args = ["publish", "--dry-run"]
[tasks.release-check-version]
description = "Verify version consistency across all packages"
category = "Release"
script = '''
#!/bin/bash
set -e
echo "Checking version consistency..."
# Extract version from workspace Cargo.toml
WORKSPACE_VERSION=$(grep -A1 '\[workspace.dependencies\]' Cargo.toml | grep 'fast-yaml-core' | sed 's/.*version = "\([^"]*\)".*/\1/')
# Check each crate version
for crate in crates/fast-yaml-core crates/fast-yaml-linter crates/fast-yaml-parallel; do
CRATE_VERSION=$(grep '^version = ' "$crate/Cargo.toml" | head -1 | sed 's/version = "\([^"]*\)".*/\1/')
CRATE_NAME=$(basename "$crate")
if [ "$CRATE_VERSION" != "$WORKSPACE_VERSION" ]; then
echo "Warning: $CRATE_NAME version ($CRATE_VERSION) differs from workspace version ($WORKSPACE_VERSION)"
else
echo "✓ $CRATE_NAME: $CRATE_VERSION"
fi
done
# Check Python package version
PYTHON_VERSION=$(grep '^version = ' python/pyproject.toml | sed 's/version = "\([^"]*\)".*/\1/')
echo "✓ Python package: $PYTHON_VERSION"
# Check NodeJS package version
NODEJS_VERSION=$(grep '"version":' nodejs/package.json | sed 's/.*"version": "\([^"]*\)".*/\1/')
echo "✓ NodeJS package: $NODEJS_VERSION"
echo ""
echo "Version check complete!"
'''
[tasks.release-tag-check]
description = "Check if current commit has a version tag"
category = "Release"
script = '''
#!/bin/bash
# Get current git tag (if any)
CURRENT_TAG=$(git describe --exact-match --tags 2>/dev/null || echo "")
if [ -z "$CURRENT_TAG" ]; then
echo "No version tag on current commit"
exit 1
fi
echo "Current tag: $CURRENT_TAG"
'''
# ============================================================================
# Default Task
# ============================================================================
[tasks.default]
description = "Default task: show help"
run_task = "help"