-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
192 lines (151 loc) · 5.03 KB
/
justfile
File metadata and controls
192 lines (151 loc) · 5.03 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
#!/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 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
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
test *ARGS='':
cargo test {{ARGS}}
# Run tests with nextest (faster parallel execution)
test-fast *ARGS='':
cargo nextest run {{ARGS}}
# Run tests with coverage (generates lcov.info)
test-coverage:
#!/usr/bin/env bash
set -euo pipefail
source <(cargo llvm-cov show-env --export-prefix)
cargo build --all-features
cargo llvm-cov --no-clean --all-features --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 {{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
# ============================================
# Build documentation
docs:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
# Open documentation in browser
docs-open: docs
cargo doc --no-deps --all-features --open
# ============================================
# Changelog Commands
# ============================================
# Create a new changelog entry
change:
changie new
# Preview the next version changelog
changelog-preview:
changie batch auto --dry-run
# ============================================
# Binary Size Commands (Linux only)
# ============================================
# Run cargo-bloat on examples, save to metrics/ (Linux only)
[linux]
bloat:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p metrics
echo "=== native-tls ===" | tee metrics/bloat-native-tls.txt
cargo bloat --release --example size_check --crates | tee -a metrics/bloat-native-tls.txt
echo ""
echo "=== rustls ===" | tee metrics/bloat-rustls.txt
cargo bloat --release --example size_check_rustls --no-default-features --features rustls --crates | tee -a metrics/bloat-rustls.txt
# Record release binary size to metrics/binary-size.txt
[linux]
record-size:
#!/usr/bin/env bash
set -euo pipefail
cargo build --release --example size_check
cargo build --release --example size_check_rustls --no-default-features --features rustls
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
DATE=$(date +%Y-%m-%d)
mkdir -p metrics
# native-tls
SIZE=$(stat --format="%s" "target/release/examples/size_check")
HUMAN=$(numfmt --to=iec --suffix=B "$SIZE")
echo "$DATE v$VERSION native-tls $SIZE $HUMAN" >> metrics/binary-size.txt
echo "Recorded: $DATE v$VERSION native-tls $SIZE ($HUMAN)"
# rustls
SIZE=$(stat --format="%s" "target/release/examples/size_check_rustls")
HUMAN=$(numfmt --to=iec --suffix=B "$SIZE")
echo "$DATE v$VERSION rustls $SIZE $HUMAN" >> metrics/binary-size.txt
echo "Recorded: $DATE v$VERSION rustls $SIZE ($HUMAN)"
# ============================================
# 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
# ============================================
# Utility Commands
# ============================================
# Clean build artifacts
clean:
cargo clean
# Install the binary locally
install:
cargo install --path .
# Update dependencies
update:
cargo update