-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJustfile
More file actions
243 lines (200 loc) · 8.81 KB
/
Justfile
File metadata and controls
243 lines (200 loc) · 8.81 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
# Plasmite task runner (just).
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
# Show available recipes.
default:
@just --list
# Format all Rust code.
fmt:
cargo fmt --all
# Lint Rust code with warnings denied.
clippy:
cargo clippy --all-targets -- -D warnings
# Run Rust test suites.
test:
cargo test
# Lane A: deterministic fast hardening checks for local iteration + PR CI.
# Keep runtime bounded and avoid flaky timing-sensitive scenarios.
hardening-fast: test cookbook-smoke
@echo "hardening-fast complete"
cookbook-smoke:
bash scripts/cookbook_smoke.sh
@echo "cookbook-smoke complete"
# Lane B: broader deterministic hardening checks for full/main CI.
# This lane is intentionally broader than Lane A but still release-agnostic.
hardening-broad: conformance-all cross-artifact-smoke
@echo "hardening-broad complete"
# Verify version alignment across release surfaces.
check-version-alignment:
./scripts/check-version-alignment.sh
# Run Go bindings tests with repo-local caches.
bindings-go-test:
cargo build -p plasmite
mkdir -p tmp/go-cache tmp/go-tmp
cd bindings/go && GOCACHE="$(pwd)/../../tmp/go-cache" GOTMPDIR="$(pwd)/../../tmp/go-tmp" PLASMITE_LIB_DIR="$(pwd)/../../target/debug" PKG_CONFIG="/usr/bin/true" CGO_CFLAGS="-I$(pwd)/../../include" CGO_LDFLAGS="-L$(pwd)/../../target/debug" go test ./...
# Run Go API contract tests without CGO.
bindings-go-contract-test:
cd bindings/go && CGO_ENABLED=0 go test ./api/...
# Run Python bindings unit tests.
bindings-python-test:
cargo build -p plasmite
cd bindings/python && PLASMITE_LIB_DIR="$(pwd)/../../target/debug" PLASMITE_BIN="$(pwd)/../../target/debug/plasmite" python3 -m unittest discover -s tests
# Run Node bindings tests.
bindings-node-test:
cargo build -p plasmite
cd bindings/node && PLASMITE_LIB_DIR="$(pwd)/../../target/debug" npm test
bash scripts/node_pack_smoke.sh
bash scripts/node_remote_only_smoke.sh
# Run Node bindings type checks.
bindings-node-typecheck:
cd bindings/node && npm run typecheck
# Run all language bindings tests and checks.
bindings-test: bindings-go-test bindings-python-test bindings-node-test bindings-node-typecheck
# Fast local CI parity gate used during iteration.
ci-fast: fmt clippy hardening-fast check-version-alignment bindings-go-contract-test bindings-node-typecheck
# Full CI parity gate including ABI/conformance/cross-artifact checks.
ci-full: fmt clippy hardening-fast check-version-alignment abi-smoke hardening-broad bindings-node-typecheck
# Alias for full CI gate.
ci: ci-full
# Canonical release candidate gate before tagging/publishing.
# Keep this focused on deterministic checks that map to release-manager required gates.
# Note: `bindings-test` includes node_pack_smoke + node_remote_only_smoke.
release-gate: fmt clippy test bindings-test check-version-alignment
bash scripts/python_wheel_smoke.sh
# Build shared library artifacts for local ABI usage.
abi:
cargo build --lib
@ls -1 target/debug/libplasmite.* 2>/dev/null || true
# Build release shared library artifacts.
abi-release:
cargo build --release --lib
@ls -1 target/release/libplasmite.* 2>/dev/null || true
# Build ABI artifacts and run ABI smoke unit.
abi-test: abi
cargo test abi_smoke
# Run ABI smoke script against built artifacts.
abi-smoke: abi
./scripts/abi_smoke.sh
# Run full conformance suite.
conformance-all:
./scripts/conformance_all.sh
# Verify behavior across published artifact boundaries.
cross-artifact-smoke:
./scripts/cross_artifact_smoke.sh
# Build a release-style SDK tarball from source (for C/libplasmite consumers).
# Defaults target Linux x86_64; override for other targets/platform tags.
sdk-from-source target="x86_64-unknown-linux-gnu" platform="linux_amd64":
version="$$(sed -n 's/^version = \"\([0-9A-Za-z\.\-+]*\)\"$$/\1/p' Cargo.toml | head -n 1)"; \
if [[ -z "$$version" ]]; then \
echo "failed to detect version from Cargo.toml" >&2; \
exit 1; \
fi; \
cargo build --release --target "{{target}}" --bins; \
if [[ "{{target}}" == *windows-msvc ]]; then \
cargo rustc --release --target "{{target}}" --lib --crate-type=cdylib; \
elif [[ "{{target}}" == *apple-darwin ]]; then \
cargo rustc --release --target "{{target}}" --lib --crate-type=cdylib -- -C link-arg=-Wl,-install_name,@rpath/libplasmite.dylib; \
else \
cargo rustc --release --target "{{target}}" --lib --crate-type=cdylib -- -C link-arg=-Wl,-soname,libplasmite.so; \
fi; \
cargo rustc --release --target "{{target}}" --lib --crate-type=staticlib; \
./scripts/package_release_sdk.sh "{{target}}" "{{platform}}" "$$version"; \
./scripts/cross_artifact_smoke.sh "dist/plasmite_$${version}_{{platform}}.tar.gz"; \
echo "sdk-from-source complete: dist/plasmite_$${version}_{{platform}}.tar.gz"
# Ensure scratch workspace exists.
scratch:
mkdir -p .scratch
# Refresh or clone the RustSec advisory DB into repo-local scratch space.
audit-db: scratch
if [ -d .scratch/advisory-db/.git ]; then \
git -C .scratch/advisory-db pull --ff-only; \
else \
git clone https://github.com/RustSec/advisory-db.git .scratch/advisory-db; \
fi
# Run cargo-audit against the locally pinned advisory DB.
audit: audit-db
cargo audit --db .scratch/advisory-db --no-fetch --ignore yanked
# Build and execute the benchmark example in release mode.
bench:
cargo build --release --example plasmite-bench
./target/release/examples/plasmite-bench
# Emit benchmark output as JSON for tooling/analysis.
bench-json:
cargo build --release --example plasmite-bench
./target/release/examples/plasmite-bench --format json > bench.json
# Install plasmite from this working tree.
install:
cargo install --path . --locked
# Remove build artifacts.
clean:
cargo clean
# --- Dev server management ---
# All dev state lives under /tmp/plasmite-dev/.
# serve-dev is idempotent: it kills any previous server before starting a fresh one.
_dev_dir := "/tmp/plasmite-dev"
_dev_port := "9009"
_dev_bind := "127.0.0.1:" + _dev_port
_dev_bin := "./target/debug/plasmite"
_dev_pool_dir := _dev_dir + "/pools"
_dev_log := _dev_dir + "/serve.log"
_dev_pid := _dev_dir + "/serve.pid"
# Build, seed test data, and start a dev server on :9009 (returns immediately).
serve-dev: _serve-kill
cargo build --bin plasmite
bash scripts/serve_dev.sh seed-demo {{_dev_bin}} {{_dev_pool_dir}} full serve-dev
bash scripts/serve_dev.sh start-detached {{_dev_bin}} {{_dev_pool_dir}} {{_dev_bind}} {{_dev_log}} {{_dev_pid}} "" serve-dev
@echo "serve-dev: server running (pid $(cat {{_dev_pid}}))"
@echo "serve-dev: http://{{_dev_bind}}/ui"
@echo "serve-dev: log at {{_dev_log}}"
@echo "serve-dev: sandbox-safe one-shot: just serve-with '<command>'"
@echo "serve-dev: stop with 'just serve-stop'"
# Run a command while hosting a temporary dev server (sandbox-safe).
# Example: just serve-with "agent-browser open http://127.0.0.1:9009/ui/pools/demo"
serve-with cmd: _serve-kill
cargo build --bin plasmite
bash scripts/serve_dev.sh seed-demo {{_dev_bin}} {{_dev_pool_dir}} full serve-with
bash scripts/serve_dev.sh run-with {{_dev_bin}} {{_dev_pool_dir}} {{_dev_bind}} {{_dev_log}} serve-with "{{cmd}}"
# Start dev server with bearer auth enabled.
serve-dev-auth token="devtoken": _serve-kill
cargo build --bin plasmite
bash scripts/serve_dev.sh seed-demo {{_dev_bin}} {{_dev_pool_dir}} auth serve-dev-auth
bash scripts/serve_dev.sh start-detached {{_dev_bin}} {{_dev_pool_dir}} {{_dev_bind}} {{_dev_log}} {{_dev_pid}} {{token}} serve-dev-auth
@echo "serve-dev-auth: server running (pid $(cat {{_dev_pid}}))"
@echo "serve-dev-auth: http://{{_dev_bind}}/ui?token={{token}}"
@echo "serve-dev-auth: auth required — token: {{token}}"
@echo "serve-dev-auth: log at {{_dev_log}}"
@echo "serve-dev-auth: stop with 'just serve-stop'"
# Show status of the dev server.
serve-status:
@if [ -f {{_dev_pid}} ] && kill -0 $(cat {{_dev_pid}}) 2>/dev/null; then \
echo "serve-status: running (pid $(cat {{_dev_pid}}))"; \
echo "serve-status: http://{{_dev_bind}}/ui"; \
echo "serve-status: log at {{_dev_log}}"; \
else \
echo "serve-status: not running"; \
fi
# Stop the dev server.
serve-stop: _serve-kill
@echo "serve-stop: done"
# Tail the dev server log.
serve-log:
@if [ -f {{_dev_log}} ]; then tail -40 {{_dev_log}}; else echo "serve-log: no log file"; fi
# Internal: kill any existing dev server.
_serve-kill:
@if [ -f {{_dev_pid}} ]; then \
pid=$(cat {{_dev_pid}}); \
if kill -0 $pid 2>/dev/null; then \
kill $pid 2>/dev/null || true; \
echo "serve: killed previous server (pid $pid)"; \
sleep 0.3; \
fi; \
rm -f {{_dev_pid}}; \
fi
@# Also clean up orphan listeners on the dev port in case pidfile state was lost/stale.
@for pid in $(lsof -nP -tiTCP:{{_dev_port}} -sTCP:LISTEN 2>/dev/null || true); do \
if kill -0 $pid 2>/dev/null; then \
kill $pid 2>/dev/null || true; \
echo "serve: killed orphan listener on :{{_dev_port}} (pid $pid)"; \
fi; \
done
# Run full release readiness checks.
release-check: ci audit