-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
225 lines (202 loc) · 5.5 KB
/
justfile
File metadata and controls
225 lines (202 loc) · 5.5 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
# Default feature profile (full, standard, minimal, tiny)
profile := "full"
# Install Rust nightly, frontend deps, and model catalog
init:
rustup toolchain install nightly --component rustfmt
cd ui && pnpm install
cd docs && pnpm install
./scripts/fetch-model-catalog.sh
./scripts/fetch-openapi-specs.sh
# Build frontend assets and release binary (use profile=minimal for faster builds)
build: build-frontend build-backend
# Build frontend assets (UI + docs)
build-frontend:
cd ui && pnpm run generate-api && pnpm build && pnpm storybook:build
cd docs && pnpm build
# Build release binary
build-backend:
cargo build --release --no-default-features --features {{profile}}
# Remove build artifacts
clean:
cargo clean
rm -rf ui/dist ui/storybook-static docs/out data/
# Run all CI checks (sequential)
check: check-rust check-ui check-docs check-openapi check-helm check-security
# Run all CI checks including slow ones
check-all: check check-features check-e2e
# Backend checks (matches CI backend job)
check-rust:
#!/usr/bin/env bash
set -e
run() {
echo "→ $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
run cargo +nightly fmt -- --check
run cargo clippy --all-targets --all-features -- -D clippy::correctness -W clippy::style
run cargo check
run cargo test -- --include-ignored
# Feature matrix checks (matches CI feature-check job)
# Usage: just check-features [profile]
# Examples: just check-features, just check-features tiny, just check-features minimal
check-features profile="all":
#!/usr/bin/env bash
set -e
run() {
echo "→ (features/$1) ${*:2}"
if ! output=$("${@:2}" 2>&1); then
echo "$output"
exit 1
fi
}
profiles="{{ profile }}"
if [ "$profiles" = "all" ]; then
profiles="tiny minimal standard full"
fi
for p in $profiles; do
run "$p" cargo check --no-default-features --features "$p" --all-targets
run "$p" cargo clippy --no-default-features --features "$p" --all-targets -- -D warnings
run "$p" cargo test --no-default-features --features "$p" --all-targets -- --include-ignored
done
# Frontend checks (matches CI frontend job)
check-ui:
#!/usr/bin/env bash
set -e
cd ui
run() {
echo "→ (ui) $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
run pnpm lint
run pnpm format:check
run pnpm exec tsc --noEmit
run pnpm build
run pnpm test
run pnpm test-storybook
run pnpm storybook:build
# Documentation checks (matches CI docs job)
check-docs:
#!/usr/bin/env bash
set -e
run() {
echo "→ $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
# Build storybook first (docs embeds via symlink)
echo "→ (ui) pnpm storybook:build"
(cd ui && pnpm storybook:build) 2>&1 || exit 1
cd docs
run pnpm lint
run pnpm format:check
run pnpm types:check
run pnpm build
# OpenAPI conformance check (matches CI openapi-conformance job)
check-openapi:
#!/usr/bin/env bash
set -e
echo "→ openapi-conformance"
./scripts/openapi-conformance.py
# Helm checks (matches CI helm-lint job)
check-helm:
#!/usr/bin/env bash
set -e
run() {
echo "→ (helm) $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
run helm lint helm/hadrian
run helm lint helm/hadrian --strict
run helm template test helm/hadrian
# Security audits (matches CI security-audit, cargo-deny, security-frontend jobs)
check-security:
#!/usr/bin/env bash
set -e
run() {
echo "→ $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
run cargo audit
run cargo deny check
echo "→ (ui) pnpm audit"
(cd ui && pnpm audit --audit-level=high) 2>&1 || exit 1
# E2E tests (matches CI e2e job)
check-e2e:
#!/usr/bin/env bash
set -e
cd deploy/tests
run() {
echo "→ (e2e) $*"
if ! output=$("$@" 2>&1); then
echo "$output"
exit 1
fi
}
run pnpm generate-client
run pnpm test
# Auto-fix formatting and lint issues
fix: fix-rust fix-ui fix-docs
# Fix backend formatting and lints
fix-rust:
#!/usr/bin/env bash
set -e
echo "→ cargo +nightly fmt"
cargo +nightly fmt
echo "→ cargo clippy --fix"
cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged
# Fix frontend formatting and lints
fix-ui:
#!/usr/bin/env bash
set -e
cd ui
echo "→ (ui) pnpm lint:fix"
pnpm lint:fix
echo "→ (ui) pnpm format"
pnpm format
# Fix docs formatting and lints
fix-docs:
#!/usr/bin/env bash
set -e
cd docs
echo "→ (docs) pnpm lint:fix"
pnpm lint:fix
echo "→ (docs) pnpm format"
pnpm format
# Run independent groups in parallel
check-parallel:
#!/usr/bin/env bash
set -e
just check-rust &
pid_rust=$!
just check-ui &
pid_ui=$!
just check-docs &
pid_docs=$!
just check-openapi &
pid_openapi=$!
just check-helm &
pid_helm=$!
just check-security &
pid_security=$!
failed=0
wait $pid_helm || failed=1
wait $pid_openapi || failed=1
wait $pid_security || failed=1
wait $pid_docs || failed=1
wait $pid_rust || failed=1
wait $pid_ui || failed=1
exit $failed