-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
164 lines (126 loc) · 3.6 KB
/
justfile
File metadata and controls
164 lines (126 loc) · 3.6 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
# justfile — local CI parity for rust_template
# Run `just` to list all available recipes.
set shell := ["bash", "-euo", "pipefail", "-c"]
# List available recipes
default:
@just --list
# === Core Development ===
# Full CI check: fmt, clippy, test, doc, deny
check: fmt-check lint test doc-build deny
# Build in debug mode
build:
cargo build
# Build in release mode
build-release:
cargo build --release
# Run the binary
run *ARGS:
cargo run -- {{ ARGS }}
# Run all tests
test:
cargo test --all-features
# Run tests with stdout visible
test-verbose:
cargo test --all-features -- --nocapture
# Run a specific test by name
test-single NAME:
cargo test {{ NAME }}
# Build and open documentation
doc:
cargo doc --no-deps --all-features --open
# Build documentation without opening
doc-build:
cargo doc --no-deps --all-features
# Watch for changes and re-run tests
watch:
cargo watch -x 'test --all-features'
# === Linting & Formatting ===
# Format code
fmt:
cargo fmt
# Check formatting without modifying files
fmt-check:
cargo fmt -- --check
# Run clippy with CI-equivalent flags
lint:
cargo clippy --all-targets --all-features -- -D warnings
# Run clippy and auto-fix what it can
lint-fix:
cargo clippy --all-targets --all-features --fix --allow-dirty
# === Security & Audit ===
# Run cargo-deny supply chain checks
deny:
cargo deny check
# Run cargo-audit advisory database check
audit:
cargo audit --deny warnings
# Generate SBOM in SPDX format
sbom:
cargo sbom --output-format spdx_json_2_3
# === Coverage ===
# Generate LCOV coverage report
coverage:
cargo llvm-cov --all-features --lcov --output-path lcov.info
# Generate HTML coverage report
coverage-html:
cargo llvm-cov --all-features --html --output-dir coverage-html
# Print coverage summary to stdout
coverage-summary:
cargo llvm-cov --all-features --summary-only
# === Advanced Testing ===
# Check against minimum supported Rust version
msrv:
cargo +1.92 check --all-features
# Run tests under Miri for undefined behavior detection
miri:
cargo +nightly miri test
# Run benchmarks
bench:
cargo bench --workspace
# Run a fuzz target for a given duration (seconds)
fuzz TARGET DURATION="60":
cargo fuzz run {{ TARGET }} -- -max_total_time={{ DURATION }}
# Run mutation testing
mutants:
cargo mutants --output mutants.out --json
# === Template Sync ===
# Template upstream repository
template_repo := "zircote/rust-template"
template_branch := "main"
# Sync shared tooling from the rust-template upstream
template-sync:
#!/usr/bin/env bash
set -euo pipefail
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
echo "Fetching latest template from {{ template_repo }}..."
git clone --depth 1 --branch {{ template_branch }} \
"https://github.com/{{ template_repo }}.git" "$TMPDIR/template" 2>/dev/null
SYNC_PATHS=( \
".claude/commands/spec-orchestrator.md" \
"clippy.toml" \
"rustfmt.toml" \
"deny.toml" \
)
for p in "${SYNC_PATHS[@]}"; do
src="$TMPDIR/template/$p"
if [ -e "$src" ]; then
mkdir -p "$(dirname "$p")"
if [ -d "$src" ]; then
cp -R "$src/." "$p/"
else
cp "$src" "$p"
fi
echo " synced: $p"
else
echo " skip (not in template): $p"
fi
done
echo "Done. Review changes with: git diff"
# === Release ===
# Dry-run a crates.io publish
publish-dry:
cargo publish --dry-run
# Generate changelog for the latest release
changelog:
git-cliff --latest --strip header