-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
149 lines (112 loc) · 4.15 KB
/
justfile
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
#!/usr/bin/env just --justfile
nightly := "nightly-2024-12-04"
msrv := "1.74"
rust := env("RUSTUP_TOOLCHAIN", "stable")
# Run all checks
all: fmt check-all deny clippy examples docs test machete udeps msrv
@echo "All checks passed 🍻"
# Check for unused dependencies
udeps:
#!/usr/bin/env sh
set -euo pipefail
bold() {
echo "\033[1m$1\033[0m"
}
export CARGO_TARGET_DIR="target/hack/"
bold "cargo +{{nightly}} udeps"
cargo +{{nightly}} udeps --all-features
bold "cargo +{{nightly}} hack udeps"
cargo +{{nightly}} hack udeps --each-feature
# Use machete to check for unused dependencies
machete:
cargo +{{rust}} machete --skip-target-dir
alias c := check
# Check compilation
check:
cargo +{{rust}} check --all-targets --all-features
# Check compilation across all features
check-all: check check-hack-each check-hack-powerset check-hack-all-targets
# Check feature combinations
check-hack: check-hack-each check-hack-powerset check-hack-all-targets
[private]
check-hack-each:
cargo +{{rust}} hack check --target-dir target/hack/ --no-private --each-feature --no-dev-deps
[private]
check-hack-powerset:
cargo +{{rust}} hack check --target-dir target/hack/ --no-private --feature-powerset --no-dev-deps --skip docs,axum,sni,tls-ring,tls-aws-lc
[private]
check-hack-tests: (check-hack-targets "tests")
[private]
check-hack-examples: (check-hack-targets "examples")
[private]
check-hack-benches: (check-hack-targets "benches")
[private]
check-hack-all-targets: (check-hack-targets "all-targets")
# Check compilation combinations for a specific target
check-hack-targets targets='tests':
cargo +{{rust}} hack check --{{targets}} --target-dir target/hack/ --no-private --feature-powerset --exclude-no-default-features --include-features mocks,tls-ring,server,client,stream
# Build the library in release mode
build:
cargo +{{rust}} build --release
# Run clippy
clippy:
cargo +{{rust}} clippy --all-targets --all-features -- -D warnings
# Check examples
examples:
cargo +{{rust}} check --examples --all-features
alias d := docs
alias doc := docs
# Build documentation
docs:
cargo +{{rust}} doc --all-features --no-deps
# Build and read documentation
read: docs
cargo +{{rust}} doc --all-features --no-deps --open
# Check support for MSRV
msrv:
cargo +{{msrv}} check --target-dir target/msrv/ --all-targets --all-features
cargo +{{msrv}} doc --target-dir target/msrv/ --all-features --no-deps
alias t := test
# Run cargo tests
test: test-build test-run
[private]
test-build:
cargo +{{rust}} nextest run --features axum,sni,tls,tls-ring,mocks --no-run
[private]
test-run:
cargo +{{rust}} nextest run --features axum,sni,tls,tls-ring,mocks
cargo +{{rust}} test --features axum,sni,tls,tls-ring,mocks --doc
# Run coverage tests
coverage:
cargo +{{rust}} tarpaulin -o html --features axum,sni,tls,tls-ring,mocks
alias timing := timings
# Compile with timing checks
timings:
cargo +{{rust}} build --features axum,sni,tls,tls-ring,mocks --timings
# Run deny checks
deny:
cargo +{{rust}} deny check
# Run fmt checks
fmt:
cargo +{{rust}} fmt --all --check
# Run pre-commit checks
pre-commit:
pre-commit run --all-files
[private]
pre-commit-ci:
SKIP=cargo-machete,fmt,check,clippy pre-commit run --color=always --all-files --show-diff-on-failure --hook-stage commit
# Run httpbin tests
httpbin:
cargo +{{rust}} build --features client,tls,tls-ring --example httpbin
cargo +{{rust}} run --features client,tls,tls-ring --example httpbin -- -X GET
cargo +{{rust}} run --features client,tls,tls-ring --example httpbin -- -X POST -d "Hello World"
cargo +{{rust}} run --features client,tls,tls-ring --example httpbin -- -X GET --http2
cargo +{{rust}} run --features client,tls,tls-ring --example httpbin -- -X POST --http2 -d "Hello World"
# Run the HURL command
hurl *args='':
cargo +{{rust}} run --features client,tls,tls-ring --example hurl -- {{args}}
profile:
cargo +{{rust}} run --release --features client,tls,tls-ring --example profile
# Launch jaeger
jaeger:
docker run -d -p16686:16686 -p4317:4317 -e COLLECTOR_OTLP_ENABLED=true jaegertracing/all-in-one:latest