-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
207 lines (164 loc) · 5.27 KB
/
justfile
File metadata and controls
207 lines (164 loc) · 5.27 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
#!/usr/bin/env just --justfile
# Common aliases for faster development
alias b := build
alias br := build-release
alias t := test
alias tf := test-fast
alias tv := test-verbose
alias l := lint
alias f := format
alias fc := fmt-check
alias a := audit
alias c := check
alias tc := test-coverage
alias d := docs
alias cl := change
alias i := install
alias wt := watch-test
alias wl := watch-lint
export RUST_BACKTRACE := "1"
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
# Default recipe - list available commands
default:
@just --list
# ============================================
# Build Commands
# ============================================
# Build the project in debug mode
build *ARGS='':
cargo build {{ARGS}}
# Build the project in release mode
build-release *ARGS='':
cargo build --release {{ARGS}}
# ============================================
# Test Commands
# ============================================
# Run all tests (builds binary first for CLI tests)
test *ARGS='':
cargo build
cargo test --all-features {{ARGS}}
# Run tests with nextest (faster parallel execution)
test-fast *ARGS='':
cargo nextest run {{ARGS}}
# Run tests with output shown
test-verbose:
cargo test -- --nocapture
# Run tests with coverage (generates lcov.info)
test-coverage:
#!/usr/bin/env bash
set -euo pipefail
# Set up llvm-cov environment and build/test with regular cargo commands
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
cargo build --all-features
# Run tests serially to avoid env var race conditions in config tests
cargo test --all-features -- --test-threads=1
cargo llvm-cov report --lcov --output-path lcov.info
# Generate HTML coverage report
coverage-html:
cargo llvm-cov nextest --all-features --html --output-dir coverage
# Open coverage report in browser
coverage-report: coverage-html
open coverage/html/index.html || xdg-open coverage/html/index.html 2>/dev/null || echo "Open coverage/html/index.html manually"
# ============================================
# Lint & Format Commands
# ============================================
# Run clippy lints
lint *ARGS='':
cargo clippy --all-targets --all-features {{ARGS}} -- -D warnings
# Format code
format *ARGS='':
cargo fmt --all -- {{ARGS}}
# Check formatting without changes
fmt-check:
cargo fmt --all -- --check
# Run all checks (format, lint, test)
check: fmt-check lint test
# ============================================
# Security Commands
# ============================================
# Security audit
audit:
cargo audit
cargo deny check
# ============================================
# Documentation Commands
# ============================================
# Generate CLI reference markdown
cli-reference:
cargo build --quiet && cargo run --quiet -- --markdown-help > docs/cli-reference.md
# Build documentation
docs: cli-reference
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
# Open documentation in browser
docs-open: docs
cargo doc --no-deps --all-features --open
# ============================================
# Changelog & Config Commands
# ============================================
# Create a new changelog entry
change:
changie new
# Preview the next version changelog
changelog-preview:
changie batch auto --dry-run
# ============================================
# Watch Commands
# ============================================
# Watch for changes and run tests
watch-test:
cargo watch -x test
# Watch for changes and run clippy
watch-lint:
cargo watch -x clippy
# ============================================
# CI & Release Commands
# ============================================
# Run all CI checks locally
ci: fmt-check lint test audit build
# PR checks (mimics CI workflow)
pr: fmt-check lint test-coverage audit build
# ============================================
# Binary Size Analysis Commands
# ============================================
# Run cargo-bloated on repoverlay, save to metrics/ (Linux only)
# Uses separate 'bloat' profile because cargo-bloated requires panic=unwind
[linux]
bloat:
cargo bloated --profile bloat --bin=repoverlay --output crates | tee metrics/bloat.txt
# Record release binary size to metrics/binary-size.txt
[linux]
record-size:
#!/usr/bin/env bash
set -euo pipefail
cargo build --release
SIZE=$(stat --format="%s" target/release/repoverlay)
HUMAN=$(numfmt --to=iec --suffix=B "$SIZE")
DATE=$(date +%Y-%m-%d)
echo "$DATE repoverlay $SIZE $HUMAN" >> metrics/binary-size.txt
echo "Recorded binary size: $SIZE ($HUMAN)"
# Test the binary size diff script
test-size-diff:
@echo "Testing size increase..."
@python3 scripts/binary-size-diff.py 3012456 2900000
@echo ""
@echo "Testing size decrease..."
@python3 scripts/binary-size-diff.py 2900000 3012456
@echo ""
@echo "Testing no change..."
@python3 scripts/binary-size-diff.py 3012456 3012456
# ============================================
# Utility Commands
# ============================================
# Clean build artifacts
clean:
cargo clean
# Install the binary locally
install:
cargo install --path .
# Run the binary with arguments
run *ARGS:
cargo run -- {{ARGS}}
# Update dependencies
update:
cargo update