-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
167 lines (138 loc) · 5.89 KB
/
Copy pathjustfile
File metadata and controls
167 lines (138 loc) · 5.89 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
# yamlrocks task runner. See every recipe with `just --list`.
#
# First time: uv sync && source .venv/bin/activate (then `just <recipe>`)
# Or without activating, prefix any recipe: `uv run --no-sync just <recipe>`.
# After Rust changes, rebuild the extension with `just develop`.
#
# Recipes use the uv-managed environment and assume `just setup` (or `just
# develop`) has run once. Versions live only in pyproject.toml / uv.lock.
# Show the list of recipes.
default:
@just --list
# Install all development dependencies into the uv-managed environment.
setup:
uv sync --no-install-project
# Build the extension in release mode (rerun after Rust changes; bootstraps deps).
develop:
uv sync --no-install-project
uv run --no-sync maturin develop --release
# Faster debug build for tight iteration loops.
develop-debug:
uv sync --no-install-project
uv run --no-sync maturin develop
# Run the Python test suite. Extra args pass through, e.g. `just test -k anchors`.
test *args:
uv run --no-sync pytest {{args}}
# Run the Rust unit tests (the pure engine: scanner, resolver, decode, encode, ...).
test-rust *args:
cargo test --lib {{args}}
# Lint and format-check Python (read-only; use `just fmt` to fix).
lint:
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
# Auto-format Python and Rust in place.
fmt:
uv run --no-sync ruff check --fix .
uv run --no-sync ruff format .
cargo fmt
# Type-check with both mypy and ty.
typecheck:
uv run --no-sync mypy pysrc/yamlrocks
uv run --no-sync ty check pysrc/yamlrocks
# Lint the Rust crate.
clippy:
cargo clippy --all-targets -- -D warnings
# Spell-check the codebase (codespell; config in pyproject.toml).
spellcheck:
uv run --no-sync codespell
# Audit the GitHub Actions workflows for security issues (zizmor, pedantic).
zizmor:
uv run --no-sync zizmor .github/workflows/ --persona=pedantic
# Run every pre-commit hook via prek (the exact set CI runs): ruff, mypy, ty,
# codespell, zizmor, cargo fmt/clippy, actionlint, prettier, taplo, file hygiene.
# Pass a hook id to run just one, e.g. `just precommit actionlint`.
precommit *args:
uvx prek run {{args}} --all-files
# Audit every dependency ecosystem for advisories and supply-chain integrity.
audit: audit-rust audit-python audit-docs
# Scan Cargo.lock against the RustSec advisory database (needs cargo-audit).
audit-rust:
cargo audit
# Audit the locked Python dependencies against the PyPI advisory database.
audit-python:
#!/usr/bin/env bash
set -euo pipefail
trap 'rm -f requirements-audit.txt' EXIT
uv export --frozen --no-emit-project --all-groups --format requirements-txt > requirements-audit.txt
uvx pip-audit --requirement requirements-audit.txt
# Verify npm registry signatures and provenance for the docs dependencies.
audit-docs:
cd docs && npm ci && npm audit signatures
# Regenerate THIRD_PARTY_LICENSES.md from the crate graph (needs cargo-about).
# Fails if a dependency uses a license not allow-listed in about.toml.
licenses:
cargo about generate about.hbs -o THIRD_PARTY_LICENSES.md
# Rust line coverage measured through the Python suite (needs cargo-llvm-cov).
coverage:
#!/usr/bin/env bash
set -euo pipefail
uv sync --no-install-project
source <(cargo llvm-cov show-env --sh)
cargo llvm-cov clean --workspace
cargo test --lib
uv run --no-sync maturin develop
uv run --no-sync python -m pytest
cargo llvm-cov report --summary-only
# Comparison benchmark report vs PyYAML, ruamel.yaml, and yamlium.
bench *args:
uv sync --inexact --no-install-project --group bench
uv run --no-sync python bench/bench.py {{args}}
# Throughput over the real-world config corpus (tests/data/realworld), the honest
# signal for parser speed and profiling on the shapes real YAML has. Auto-skips
# when the corpus submodule is absent.
bench-corpus *args:
uv sync --inexact --no-install-project --group bench
uv run --no-sync python bench/corpus_bench.py {{args}}
# Builds a release extension first (a debug build is several times slower, so it
# would understate YAMLRocks against the other libraries' release wheels), then
# renders the cross-library comparison charts into the docs assets.
charts:
uv sync --inexact --no-install-project --group charts
uv run --no-sync maturin develop --release
cd bench && uv run --no-sync python charts.py
# Run the CodSpeed benchmarks locally (walltime mode).
codspeed:
uv sync --inexact --no-install-project --group codspeed
uv run --no-sync pytest bench --codspeed
# Fuzz a target; optional seconds time-box and target, e.g. `just fuzz 60` or
# `just fuzz 60 differential` (targets: parse, decode, roundtrip, differential).
fuzz seconds="" target="parse":
#!/usr/bin/env bash
set -euo pipefail
# libFuzzer's own -rss_limit_mb is the memory guard here; `ulimit -v` cannot
# be used because AddressSanitizer reserves its shadow memory virtually.
if [ -n "{{seconds}}" ]; then
cargo +nightly fuzz run {{target}} -- -max_total_time={{seconds}} -rss_limit_mb=4096
else
cargo +nightly fuzz run {{target}} -- -rss_limit_mb=4096
fi
# Run every documented Python example and verify its output comments.
examples:
uv run --no-sync python docs/verify_examples.py
# Build the documentation site.
docs:
cd docs && npm ci && npm run build
# Serve the docs with live reload (astro dev, http://localhost:4321).
docs-dev:
cd docs && npm ci && npm run dev
# Run the full local gate, mirroring CI: build, every pre-commit hook (lint,
# format, types, spelling, workflows, actionlint, prettier, taplo, file hygiene),
# then the Rust and Python test suites and the documented examples.
check: develop precommit
cargo test --lib
uv run --no-sync pytest -q
uv run --no-sync python docs/verify_examples.py
# Remove build and fuzzing artifacts.
clean:
cargo clean
rm -rf fuzz/target fuzz/corpus fuzz/artifacts