-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjustfile
More file actions
80 lines (67 loc) · 2.26 KB
/
Copy pathjustfile
File metadata and controls
80 lines (67 loc) · 2.26 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
# Default: show available recipes
default:
@just --list
# Build native release
build:
cargo build --release
# Build WASM target and stage it for the web demo (web/unit.wasm is
# untracked; CI builds its own copy for the Pages deploy)
wasm:
cargo build --target wasm32-unknown-unknown --release
@mkdir -p web
@cp target/wasm32-unknown-unknown/release/unit.wasm web/unit.wasm
@echo "WASM binary: web/unit.wasm"
# Run all tests
test:
cargo test
# Quick end-to-end smoke: pipe a few words through the real release binary
# (arithmetic, goals, persistence) — cheaper than tests/integration.sh
smoke: build
@echo "=== basic test ==="
echo '2 3 + . BYE' | ./target/release/unit
@echo "=== goal test ==="
echo '5 GOAL{ 6 7 * } DROP GOALS BYE' | UNIT_PORT=0 ./target/release/unit
@echo "=== persistence test ==="
echo 'SAVE BYE' | UNIT_PORT=0 ./target/release/unit
@echo "=== smoke passed ==="
# Run clippy (must be warning-free)
lint:
cargo clippy -- -D warnings
# Format code
fmt:
cargo fmt
# Check formatting without changing files
fmt-check:
cargo fmt -- --check
# Run the REPL
run *ARGS:
cargo run -- {{ARGS}}
# Run a swarm of N units (default 3)
swarm n="3":
#!/usr/bin/env bash
for i in $(seq 1 {{n}}); do
port=$((4200 + i))
if [ "$i" -eq 1 ]; then
UNIT_PORT=$port cargo run --release &
else
UNIT_PORT=$port UNIT_PEERS=127.0.0.1:4201 cargo run --release &
fi
done
wait
# Core CI gates, mirroring GitHub Actions' Rust job (clippy + tests).
# rustfmt is intentionally NOT a gate — the tree is hand-formatted and CI
# does not run fmt-check. Use `just fmt` / `just fmt-check` opt-in if you like.
ci: lint test
# Publish to crates.io (dry run)
publish-dry:
cargo publish --dry-run
# Clean build artifacts
clean:
cargo clean
# Dockerized multihost wedge drill — validates the Phase 3 deep-tree
# deadline guarantees (v0.35.0) across real containers: docker pause as
# the wedge, peer eviction, fail-closed abandonment, unplaced placement.
# netem=1 adds tc-netem WAN realism (40ms±10ms, 1% loss, slight reorder).
drill netem="0":
docker build -f docker/Dockerfile -t unit-drill:latest .
UNIT_RECRUIT_TIMEOUT_SECS=2 DRILL_NETEM={{netem}} bash docker/drill.sh