-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
231 lines (185 loc) · 6.5 KB
/
justfile
File metadata and controls
231 lines (185 loc) · 6.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
226
227
228
229
230
231
# Willow — P2P encrypted chat
# Run ALL checks (fmt, clippy, test, wasm). Use before committing.
check: fmt clippy test check-wasm
# Format all code
fmt:
cargo fmt
# Check formatting without modifying
fmt-check:
cargo fmt --check
# Run clippy with warnings as errors
clippy:
cargo clippy --workspace --all-targets -- -D warnings
# Run all cargo tests (unit + integration, excludes browser)
test:
cargo test --workspace
# Run tests for a specific crate
test-crate crate:
cargo test -p {{crate}}
# Run the state machine tests
test-state:
cargo test -p willow-state
# Run the client library tests
test-client:
cargo test -p willow-client
# Run actor framework tests
test-actor:
cargo test -p willow-actor
# Run actor framework performance tests (not in CI — for optimization dev)
test-actor-perf:
cargo test -p willow-actor --test performance -- --ignored --nocapture
# Run the relay tests
test-relay:
cargo test -p willow-relay
# Run worker node tests (worker library + replay + storage)
test-workers:
cargo test -p willow-worker -p willow-replay -p willow-storage -p willow-common
# Build worker node binaries
build-workers:
cargo build --release -p willow-replay -p willow-storage
# Run in-browser Leptos component tests (requires Firefox + geckodriver)
test-browser:
wasm-pack test --headless --firefox crates/web
# Bootstrap the E2E test environment (install tooling, build, start services)
setup-e2e FEATURES="":
WILLOW_FEATURES="{{FEATURES}}" ./scripts/setup-e2e.sh
# Install/build for E2E but don't start services
setup-e2e-no-start:
./scripts/setup-e2e.sh --no-start
# Stop any services started by setup-e2e
teardown-e2e:
./scripts/teardown-e2e.sh
# Run the full E2E flow: setup, run tests, teardown (teardown runs even on failure)
test-e2e-full FEATURES="test-hooks":
#!/usr/bin/env bash
set -u
WILLOW_FEATURES="{{FEATURES}}" ./scripts/setup-e2e.sh
EXIT_CODE=0
npx playwright test --project=desktop-chrome --project=mobile-chrome || EXIT_CODE=$?
./scripts/teardown-e2e.sh
exit $EXIT_CODE
# Run Playwright E2E tests against deployed site
test-e2e-ui FEATURES="test-hooks":
@just setup-e2e FEATURES={{FEATURES}}
npx playwright test --project=desktop-chrome --project=mobile-chrome
# Run the Playwright E2E suite N times to surface intermittent flake.
# Aggregates pass/fail per run; exits non-zero if ANY run failed.
# Default N=5 (per docs/specs/2026-04-27-event-based-waits-design.md
# §Implementation phasing PR 4).
test-e2e-flake N="5" FEATURES="test-hooks":
#!/usr/bin/env bash
set -uo pipefail
WILLOW_FEATURES="{{FEATURES}}" ./scripts/setup-e2e.sh
pass=0
fail=0
failures=()
for i in $(seq 1 {{N}}); do
echo
echo "════════ flake harness: run $i / {{N}} ════════"
if npx playwright test --reporter=line; then
pass=$((pass + 1))
else
fail=$((fail + 1))
failures+=("$i")
fi
done
echo
echo "════════ flake summary ════════"
echo "passed: $pass / {{N}}"
echo "failed: $fail / {{N}}"
if (( fail > 0 )); then
echo "failed runs: ${failures[*]}"
exit 1
fi
# Full-suite gate: lint + Rust + wasm-pack browser + Playwright, in
# order, fail-fast. This is the single command a PR must go green on.
check-all FEATURES="test-hooks":
#!/usr/bin/env bash
set -euo pipefail
just fmt
just clippy
just test
just test-browser
just test-e2e-ui FEATURES={{FEATURES}}
./scripts/check-no-test-hooks-in-prod.sh
./scripts/check-wait-timeout-count.sh
# Run Playwright E2E tests on all browsers
test-e2e-ui-all:
npx playwright test
# Run Playwright E2E tests (headed, for debugging)
test-e2e-ui-headed:
npx playwright test --headed
# Run multi-peer sync tests (desktop-chrome for quick iteration)
test-e2e-sync FEATURES="test-hooks":
@just setup-e2e FEATURES={{FEATURES}}
npx playwright test e2e/multi-peer-sync.spec.ts --project=desktop-chrome
# Run permission tests
test-e2e-perms FEATURES="test-hooks":
@just setup-e2e FEATURES={{FEATURES}}
npx playwright test e2e/permissions.spec.ts --project=desktop-chrome
# Run agent unit + integration tests
test-agent:
cargo test -p willow-agent
# Run E2E multi-peer tests via agent harness
test-agent-e2e:
cargo test -p willow-agent --test e2e -- --nocapture
# Build the agent binary
build-agent:
cargo build -p willow-agent
# Build agent (release)
build-agent-release:
cargo build --release -p willow-agent
# Run the agent
agent *args:
cargo run -p willow-agent -- {{args}}
# Run ALL tests including browser and E2E
test-all: test test-browser test-agent-e2e test-e2e-ui
# Check native compilation
check-native:
cargo check
# Check WASM compilation (excludes native-only binaries that pull in tokio/mio)
check-wasm:
cargo check --target wasm32-unknown-unknown -p willow-identity -p willow-state -p willow-messaging -p willow-crypto -p willow-transport -p willow-common -p willow-network -p willow-client -p willow-web
# Build the Leptos web app (WASM)
build-web:
cd crates/web && trunk build --release
# Serve the Leptos web app locally
serve-web:
cd crates/web && trunk serve
# Build the relay server
build-relay:
cargo build --release -p willow-relay
# Run the relay server (HTTP 3340)
relay *args:
cargo run -p willow-relay -- {{args}}
# Docker: build all images
docker-build:
docker compose build
# Docker: start full stack
docker-up:
docker compose up -d
# Docker: stop full stack
docker-down:
docker compose down
# Docker: tail all logs
docker-logs:
docker compose logs -f
# Docker: print all worker peer IDs
docker-ids:
@docker compose exec replay-1 willow-replay --print-peer-id 2>/dev/null || echo "replay-1: not running"
@docker compose exec replay-2 willow-replay --print-peer-id 2>/dev/null || echo "replay-2: not running"
@docker compose exec storage-1 willow-storage --print-peer-id 2>/dev/null || echo "storage-1: not running"
@docker compose exec storage-2 willow-storage --print-peer-id 2>/dev/null || echo "storage-2: not running"
# Start all services for local development (relay, workers, web UI)
dev FEATURES="":
WILLOW_FEATURES="{{FEATURES}}" ./scripts/dev.sh
# Start all services, skipping the build step
dev-quick:
./scripts/dev.sh --skip-build
# Clean dev data (identity keys, logs, storage DB)
dev-clean:
rm -rf .dev
# Clean build artifacts
clean:
cargo clean
rm -rf crates/web/dist