-
-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathjustfile
More file actions
316 lines (232 loc) · 9.78 KB
/
Copy pathjustfile
File metadata and controls
316 lines (232 loc) · 9.78 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
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
# `--cfg tokio_unstable` enables Tokio's unstable runtime APIs that
# `dial9-tokio-telemetry` requires. It is benign for crates that do
# not opt into the `dial9` feature; the workspace `.cargo/config.toml`
# carries the same flag for raw `cargo` invocations. We set it via env
# here because justfile's `export RUSTFLAGS` overrides cargo's config.
#
# Set `ALLOW_WARNINGS=true` for local iteration to drop `-D warnings`
# so in-progress code with unused imports / dead code still builds.
export RUSTFLAGS := \
if env_var_or_default("ALLOW_WARNINGS", "false") == "true" { \
"--cfg tokio_unstable" \
} else { \
"-D warnings --cfg tokio_unstable" \
}
export RUST_LOG := "debug"
fmt *ARGS:
cargo fmt --all {{ARGS}}
fmt-crate CRATE *ARGS:
cargo fmt --all -p {{CRATE}} {{ARGS}}
fmt-check *ARGS:
cargo fmt --all --check {{ARGS}}
fmt-check-crate CRATE *ARGS:
cargo fmt --all -p {{CRATE}} --check {{ARGS}}
sort:
@command -v cargo-sort >/dev/null || cargo install cargo-sort --locked
cargo sort --workspace --grouped
sort-check *ARGS:
cargo sort --workspace --check {{ARGS}}
lint: fmt sort
deny:
@cargo install cargo-deny
cargo deny --workspace --all-features check
check:
cargo check --workspace --all-targets --all-features
check-crate CRATE:
cargo check -p {{CRATE}} --all-targets --all-features
check-crate-linux CRATE:
cargo check -p {{CRATE}} --target x86_64-unknown-linux-gnu --all-features
cargo check -p {{CRATE}} --target aarch64-unknown-linux-gnu --all-features
check-links:
lychee .
clippy:
cargo clippy --workspace --all-targets --all-features
clippy-beta:
cargo +beta clippy --workspace --all-targets --all-features
clippy-beta-crate CRATE:
cargo +beta clippy -p {{CRATE}} --all-targets --all-features
clippy-crate CRATE:
cargo clippy -p {{CRATE}} --all-targets --all-features
clippy-fix *ARGS:
cargo clippy --workspace --all-targets --all-features --fix {{ARGS}}
clippy-fix-crate CRATE *ARGS:
cargo clippy -p {{CRATE}} --all-targets --all-features --fix {{ARGS}}
typos:
typos -w
extra-checks:
@just _extra-checks-{{os_family()}}
_extra-checks-unix:
{{justfile_directory()}}/scripts/extra-checks.sh
_extra-checks-windows:
@echo "Skipping extra checks on Windows"
doc:
cargo doc --all-features --no-deps --workspace --exclude rama-cli --exclude rama-net-apple-xpc
just doc-crate rama-cli
doc-crate CRATE:
cargo doc --all-features --no-deps -p {{CRATE}}
hack:
@cargo install cargo-hack
cargo hack check --each-feature --no-dev-deps --workspace
test *ARGS:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
cargo nextest run --all-features --workspace {{ARGS}}
test-doc *ARGS:
cargo test --doc --all-features --workspace {{ARGS}}
test-crate CRATE *ARGS:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
cargo nextest run --all-features -p {{CRATE}} {{ARGS}}
test-doc-crate CRATE *ARGS:
cargo test --doc --all-features -p {{CRATE}} {{ARGS}}
test-spec-h2 *ARGS:
bash rama-http-core/ci/h2spec.sh {{ARGS}}
# MITM OCSP-stapling gate (Linux/macOS): hermetic curl --cert-status matrix
# (incl. the no-staple negative) + a real-crates.io curl/cargo leg through the
# CONNECT proxy. Skips the strict legs if no OpenSSL-backed curl is found (set
# OCSP_GATE_REQUIRE=1 to make that a failure, as CI does).
test-ocsp-gate *ARGS:
bash scripts/ocsp-relay-gate.sh {{ARGS}}
# MITM OCSP-stapling gate (Windows): cargo through the CONNECT proxy to real
# crates.io, where schannel enforces revocation (the customer scenario).
test-ocsp-gate-windows:
pwsh scripts/ocsp-relay-gate.ps1
test-spec: test-spec-h2 test-ocsp-gate
test-ignored:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
cargo nextest run --all-features --workspace --run-ignored=only
test-ignored-release:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
cargo nextest run --all-features --release --workspace --run-ignored=only
test-loom:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
RUSTFLAGS="--cfg loom -Dwarnings" cargo nextest run --all-features -p rama-utils
qq: sort-check fmt-check check clippy doc extra-checks
qa: qq test test-doc deny
# QA pass for the optional `dial9` runtime-telemetry feature. Builds, lints
# and tests the rama crates that opt into dial9. `tokio_unstable` is
# required by `dial9-tokio-telemetry` and is set workspace-wide in
# `.cargo/config.toml` so this recipe does not need to set it explicitly.
#
# Kept separate from the main `qa` recipe so the standard QA path stays
# focused — but is part of `qa-full` so anyone running the full suite
# covers it. CI runs it as its own job.
qa-dial9:
@command -v cargo-nextest >/dev/null || cargo install cargo-nextest --locked
cargo check -p rama-net -p rama-net-apple-networkextension -p rama-dns -p rama-tls-rustls -p rama-tls-boring -p rama-socks5 -p rama --features dial9 --all-targets
cargo clippy -p rama-net -p rama-net-apple-networkextension -p rama-dns -p rama-tls-rustls -p rama-tls-boring -p rama-socks5 -p rama --features dial9 --all-targets
cargo nextest run -p rama-net -p rama-net-apple-networkextension -p rama-dns -p rama-socks5 --features dial9
# Interactive: boot the fastcgi-php gateway demo (HTTPS → FastCGI/TCP → php-fpm)
# and leave it running until Ctrl-C so you can curl / browse it.
example-fastcgi-php-gateway:
./examples/gateway/fastcgi-php/gateway/run.sh run
# Interactive: boot the fastcgi-php migration demo (HTTP → router → FastCGI/Unix → php-fpm).
example-fastcgi-php-migration:
./examples/gateway/fastcgi-php/migration/run.sh run
# CI/test: boot both, run jq assertions, tear down.
test-fastcgi-php:
./examples/gateway/fastcgi-php/test.sh test
qa-crate CRATE:
just fmt-check-crate {{CRATE}}
just check-crate {{CRATE}}
just clippy-crate {{CRATE}}
just doc-crate {{CRATE}}
just test-crate {{CRATE}}
just test-doc-crate {{CRATE}}
qa-ffi-apple:
RAMA_TPROXY_SKIP_CODESIGNING=1 RAMA_TPROXY_ISOLATED_CACHE=1 just ./ffi/apple/examples/transparent_proxy/qa
qa-xpc-apple:
cargo check -p rama-net-apple-xpc
cargo clippy -p rama-net-apple-xpc --all-targets -- -D warnings
cargo doc --all-features --no-deps -p rama-net-apple-xpc
cargo check -p rama --features net-apple-xpc
cargo run --example xpc_echo --features=net-apple-xpc
cargo run --example xpc_ca_exchange --features=net-apple-xpc
test-e2e-ffi-apple:
just ./ffi/apple/examples/transparent_proxy/test-e2e
test-e2e-ffi-swift:
just ./ffi/apple/examples/transparent_proxy/run-tproxy-ffi-e2e-swift
test-ffi-apple-full: qa-ffi-apple test-e2e-ffi-apple test-e2e-ffi-swift qa-xpc-apple
qa-full: qa qa-dial9 hack test-ignored test-ignored-release test-loom fuzz-60s check-links
bench-e2e-http-client-server *ARGS:
./scripts/bench/e2e_http_client_server.py {{ARGS}}
clean:
cargo clean
just ./ffi/apple/examples/transparent_proxy/clean
watch-docs:
@cargo install cargo-watch
cargo watch -x doc
watch-check:
@cargo install cargo-watch
cargo watch -x check -x test
rama +ARGS:
cargo run -p rama-cli -- {{ARGS}}
rama-fp *ARGS:
cargo run -p rama-fp -- {{ARGS}}
watch-rama-fp *ARGS:
@cargo install cargo-watch
cargo watch -x 'run -p rama-fp -- {{ARGS}}'
docker-build-rama-cli:
docker build -f rama-cli/infra/Dockerfile -t glendc/rama-cli:latest .
echo 'glendc/rama-cli:latest ready to use'
browserstack-rama-fp:
cd rama-fp/browserstack && \
(pip install -r requirements.txt || true) && \
python main.py
example NAME:
cargo run -p rama --example {{NAME}}
self-signed-certs CRT KEY:
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -out {{CRT}} -keyout {{KEY}}
report-code-lines:
find . -type f -name '*.rs' -exec cat {} + \
| grep -v target | tr -d ' ' | grep -v '^$' | grep -v '^//' \
| wc -l
fuzz-ua:
cargo +nightly fuzz run ua_parse -- -max_len=131072
fuzz-ua-60s:
cargo +nightly fuzz run ua_parse -- -max_len=131072 -max_total_time=60
fuzz-http-headers-x-robots-tag:
cargo +nightly fuzz run http_header_x_robots_tag -- -max_len=131072
fuzz-http-headers-x-robots-tag-60s:
cargo +nightly fuzz run http_header_x_robots_tag -- -max_len=131072 -max_total_time=60
fuzz-h2-main:
# cargo install honggfuzz
cd rama-http-core/tests/h2-fuzz && \
HFUZZ_RUN_ARGS="-t 1" cargo hfuzz run h2-fuzz
fuzz-h2-client:
cargo +nightly fuzz run h2_client
fuzz-h2-hpack:
cargo +nightly fuzz run h2_hpack
fuzz-h2-e2e:
cargo +nightly fuzz run h2_e2e
fuzz-h2-60s:
cargo +nightly fuzz run h2_client -- -max_total_time=60
cargo +nightly fuzz run h2_hpack -- -max_total_time=60
cargo +nightly fuzz run h2_e2e -- -max_total_time=60
fuzz-60s: fuzz-ua-60s fuzz-h2-60s fuzz-http-headers-x-robots-tag-60s
fuzz-full: fuzz-60s fuzz-h2-main
bench:
cargo bench --features=full
vet:
cargo vet
miri:
cargo +nightly miri test
detect-unused-deps:
@cargo install cargo-machete
cargo machete --skip-target-dir --with-metadata
detect-biggest-fn:
cargo bloat --package rama-cli --release -n 10
detect-biggest-crates:
cargo bloat --package rama-cli --release --crates
mdbook-serve:
cd docs/book && mdbook serve
publish *ARGS:
cargo publish --workspace {{ARGS}}
[working-directory: './rama-cli/manifests/winget/Plabayo/Rama/Preview']
@submit-rama-cli-winget-preview:
wingetcreate submit -p 'Plabayo.Rama.Preview version bump' .
update-deps:
@cargo install cargo-edit --locked
cargo upgrade --incompatible && cargo update
just ./ffi/apple/examples/transparent_proxy/update-deps
oss-endpoint-healthcheck:
bash rama-fp/infra/scripts/remote-healthcheck.sh