Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
319 lines (278 loc) · 14.3 KB
/
Copy pathjustfile
File metadata and controls
319 lines (278 loc) · 14.3 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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# ElastOS — single entry point for build, test, and publish.
# Install: cargo install just
# Default: show recipes
default:
@just --list
# Build runtime + core capsules
build:
./scripts/build.sh
# Build everything (runtime + all capsules)
build-all:
./scripts/build.sh --all
# Build runtime only
build-runtime:
./scripts/build.sh --runtime
# Build a specific capsule by name
build-capsule name:
./scripts/build.sh --capsule {{name}}
# List all buildable capsules
list-capsules:
./scripts/build.sh --list
# Fast check after editing (single crate)
check crate="elastos-server":
cd elastos && cargo check -p {{crate}}
# --target-dir is pinned so the binary paths below stay correct even when the
# environment sets a global CARGO_TARGET_DIR.
# Build the provider process binaries the protected-content process tests spawn
prepare-providers:
cd capsules/protected-content-protect-provider && cargo build --release --target-dir target
cd capsules/protected-content-decrypt-provider && cargo build --release --target-dir target
cd capsules/custody-provider && cargo build --release --target-dir target
# Run workspace tests (provider process tests need the capsule binaries)
test-elastos *args: prepare-providers
cd elastos && \
ELASTOS_TEST_PROTECT_PROVIDER_BIN="$(pwd)/../capsules/protected-content-protect-provider/target/release/protected-content-protect-provider" \
ELASTOS_TEST_DECRYPT_PROVIDER_BIN="$(pwd)/../capsules/protected-content-decrypt-provider/target/release/protected-content-decrypt-provider" \
ELASTOS_TEST_CUSTODY_PROVIDER_BIN="$(pwd)/../capsules/custody-provider/target/release/custody-provider" \
cargo test --workspace --no-fail-fast {{args}}
# The elastos workspace suite (and CI's `cargo test --workspace`) never
# builds or tests own-workspace capsules; this covers them.
# Test every capsule that is its own cargo workspace
test-capsules:
#!/usr/bin/env bash
set -uo pipefail
# Dependency artifacts are shared across all workspaces via the root
# .cargo/config.toml build-dir (<repo>/target-build), so each dep compiles
# once instead of ~25 times. Deliberately NO --target-dir pin: with a
# shared build-dir, cargo reuses compiled test executables across
# invocations without re-baking their CARGO_BIN_EXE_* paths, so every
# invocation style (just, plain cargo test, rust-analyzer, CI) must agree
# on each workspace's default target dir or process tests spawn stale
# binary paths.
failed=0
for lock in capsules/*/Cargo.lock; do
capsule="$(dirname "$lock")"
echo "== testing $capsule =="
(cd "$capsule" && cargo test --no-fail-fast) || failed=1
done
exit "$failed"
# Run the workspace suite and every own-workspace capsule suite
test:
#!/usr/bin/env bash
set -u
failed=0
just test-elastos || failed=1
just test-capsules || failed=1
exit "$failed"
# Capsule units and script behavior fixtures, as CI and the pre-push gate run
# them; offline, after `just test-behaviour-inputs` installed the pinned
# Playwright/Chromium inputs once.
test-behaviour:
./scripts/test-behaviour.sh
test-behaviour-inputs:
./scripts/test-behaviour.sh inputs
# Check a clean candidate against current develop before each push.
ci-local-prepush:
scripts/ci-local-prepush.sh
# Small Git/Cargo decision fixtures; Cargo is simulated.
test-ci-local-prepush:
python3 scripts/ci-local-prepush-test.py
# Cold Debian container check for test-elastos when Docker is available.
# It copies the working tree and installs Node for integration tests.
ci-test-elastos:
tar --no-xattrs --no-mac-metadata --no-fflags --exclude='.git' --exclude='target' --exclude='target-capsules' --exclude='target-build' --exclude='*/target' --exclude='capsules/*/target' -cf - . | \
docker run --rm -i -e RUSTFLAGS="-D warnings" -e CARGO_TERM_COLOR=always rust:1.91-bookworm bash -c '\
mkdir /w && tar -xf - -C /w && cd /w && cargo --version >/dev/null && \
apt-get update -qq >/dev/null && apt-get install -y -qq nodejs >/dev/null && node --version && \
useradd -m ci && chown -R ci:ci /w && \
su -s /bin/bash ci -c "export PATH=/usr/local/cargo/bin:\$PATH RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/home/ci/.cargo RUSTFLAGS=\"-D warnings\" && cd /w && \
cargo build --release --manifest-path capsules/protected-content-protect-provider/Cargo.toml --target-dir capsules/protected-content-protect-provider/target && \
cargo build --release --manifest-path capsules/protected-content-decrypt-provider/Cargo.toml --target-dir capsules/protected-content-decrypt-provider/target && \
cargo build --release --manifest-path capsules/custody-provider/Cargo.toml --target-dir capsules/custody-provider/target && \
cd elastos && \
ELASTOS_TEST_PROTECT_PROVIDER_BIN=/w/capsules/protected-content-protect-provider/target/release/protected-content-protect-provider \
ELASTOS_TEST_DECRYPT_PROVIDER_BIN=/w/capsules/protected-content-decrypt-provider/target/release/protected-content-decrypt-provider \
ELASTOS_TEST_CUSTODY_PROVIDER_BIN=/w/capsules/custody-provider/target/release/custody-provider \
cargo test --workspace --no-fail-fast"'
# Cold Debian container check for test-capsules when Docker is available.
ci-test-capsules:
tar --no-xattrs --no-mac-metadata --no-fflags --exclude='.git' --exclude='target' --exclude='target-capsules' --exclude='target-build' --exclude='*/target' --exclude='capsules/*/target' -cf - . | \
docker run --rm -i -e RUSTFLAGS="-D warnings" -e CARGO_TERM_COLOR=always rust:1.91-bookworm bash -c '\
mkdir /w && tar -xf - -C /w && cd /w && cargo --version >/dev/null && \
useradd -m ci && chown -R ci:ci /w && \
su -s /bin/bash ci -c "export PATH=/usr/local/cargo/bin:\$PATH RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/home/ci/.cargo RUSTFLAGS=\"-D warnings\" && cd /w && \
failed=0; \
for lock in capsules/*/Cargo.lock; do \
capsule=\$(dirname \$lock); \
echo \"== testing \$capsule ==\"; \
(cd \$capsule && cargo test --no-fail-fast) || failed=1; \
done; exit \$failed"'
# Cold Debian source-home check when Docker is available. arch selects
# native ARM64 or emulated x86-64; GitHub runs Ubuntu 24.04 for acceptance.
ci-source-home-linux arch='arm64':
tar --no-xattrs --no-mac-metadata --no-fflags --exclude='.git' --exclude='target' --exclude='target-capsules' --exclude='target-build' --exclude='*/target' --exclude='capsules/*/target' -cf - . | \
docker run --rm -i --platform linux/{{arch}} -e CARGO_TERM_COLOR=never rust:1.91-bookworm bash -c '\
mkdir /w && tar -xf - -C /w && cd /w && \
apt-get update -qq >/dev/null && apt-get install -y -qq coturn e2fsprogs ffmpeg nodejs git jq musl-tools nasm pkg-config >/dev/null && \
rustup target add wasm32-unknown-unknown "$(uname -m)-unknown-linux-musl" >/dev/null 2>&1 && \
useradd -m ci && chown -R ci:ci /w && \
su -s /bin/bash ci -c "set -euo pipefail && \
export PATH=/usr/local/cargo/bin:\$PATH RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/home/ci/.cargo && \
cd /w && git init -q && git add -A && git -c user.email=ci@local -c user.name=ci commit -qm ci-replica && \
export ELASTOS_COLLABORATION_STARTUP_MODE=isolated && \
export ELASTOS_NODE_BIN=/usr/bin/node ELASTOS_BROWSER_VM_TURNSERVER_BIN=/usr/bin/turnserver && \
SOURCE_HOME=/home/ci/rtemp/elastos-source-home && mkdir -p \$SOURCE_HOME && \
export HOME=\$SOURCE_HOME XDG_DATA_HOME=\$SOURCE_HOME/.local/share && \
SETUP_SOURCE_HOME_MEDIA_TOOLS_DIR=/usr/bin scripts/setup-source-home.sh && \
ELASTOS_DATA_DIR=\$XDG_DATA_HOME/elastos scripts/installed-provider-verify.sh && \
scripts/local-carrier-setup-smoke.sh"'
# Test a single crate (fastest iteration)
test-crate crate *args:
cd elastos && cargo test -p {{crate}} {{args}}
# Run clippy + fmt check
lint:
cd elastos && cargo clippy --workspace --all-targets -- -D warnings
cd elastos && cargo fmt --all -- --check
# Stamp the shared UI token sheet into each consuming capsule
vendor-ui:
./scripts/vendor-ui-tokens.sh
# Auto-format code
fmt:
cd elastos && cargo fmt --all
# Pre-commit gate: data contracts, behavior tests, smoke tests, fmt/lint/test
verify:
git --no-pager diff --check
./scripts/test-source-gate.sh
node scripts/check-elastos-bus-wit.mjs
node scripts/check-capsule-templates.mjs
./scripts/vendor-ui-tokens.sh --check
node scripts/carrier-dependency-generation-check.mjs
just product-ui-source
node --test scripts/browser-window-close-handshake.test.mjs
node --test scripts/home-assistant-mark.test.mjs
node --test scripts/assistant-markdown.test.mjs
node --test scripts/home-two-runtime-acceptance.test.mjs
node --test scripts/system-hosted-save.test.mjs
node --test scripts/home-form-factor.test.mjs
node --test scripts/home-keyboard-inset.test.mjs
node --test scripts/home-capsule-layout.test.mjs
node --test scripts/home-phone-dock.test.mjs
node --test scripts/home-phone-stage.test.mjs
node --test scripts/home-sheet-handle.test.mjs
node --test scripts/home-link-status.test.mjs
node --test scripts/home-touch-long-press.test.mjs
node --test scripts/home-fullscreen-toggle.test.mjs
node --test scripts/home-phone-home.test.mjs
node --test scripts/chat-room-enter.test.mjs
python3 scripts/source-home-capsule-inventory-smoke.py
./scripts/command-smoke.sh
./scripts/browser-local-exit-orphan-cleanup-smoke.sh
just candidate-command-audit
cd elastos && cargo fmt --all -- --check
cd elastos && cargo clippy --workspace --all-targets -- -D warnings
just test
# browser-local-exit has its own workspace under elastos/tools, so neither
# the elastos workspace test nor test-capsules reaches it
cd elastos/tools/browser-local-exit && cargo fmt -- --check
cd elastos/tools/browser-local-exit && cargo clippy --all-targets -- -D warnings
cd elastos/tools/browser-local-exit && cargo test
# Simulate CI (github actions), especially the test parts for
# both main steps (`test-capsules` and `test-elastos`)
verify-ci: ci-test-capsules ci-test-elastos
product-ui-source:
node scripts/home-shell-regression-smoke.mjs
node scripts/home-shell-bridge-smoke.mjs
node scripts/home-shell-recovery-smoke.mjs
node scripts/people-discovery-smoke.mjs
node scripts/inbox-product-behavior-smoke.mjs
node scripts/archive-product-behavior-smoke.mjs
node scripts/marketplace-product-behavior-smoke.mjs
node --test scripts/documents-markdown.test.mjs
node scripts/library-product-behavior-smoke.mjs
node scripts/chat-room-product-behavior-smoke.mjs
node --test scripts/chat-room-reconnect.test.mjs
product-ui-browser:
node scripts/assistant-reply-layout-browser-smoke.mjs
node scripts/people-product-layout-smoke.mjs
node scripts/inbox-product-layout-smoke.mjs
node scripts/archive-product-layout-smoke.mjs
node scripts/marketplace-product-layout-smoke.mjs
node scripts/isolation-ui-truth-browser-smoke.mjs
node scripts/documents-product-layout-smoke.mjs
node scripts/library-product-layout-smoke.mjs
node scripts/library-menu-smoke.mjs
node scripts/library-shared-cid-smoke.mjs
node scripts/home-library-open-headless-smoke.mjs
node scripts/browser-product-layout-smoke.mjs
node scripts/system-uiux-layout-smoke.mjs
node scripts/system-window-policy-browser-smoke.mjs
node scripts/chat-room-configured-layout-smoke.mjs
node scripts/home-phone-layout-smoke.mjs
product-ui-virtual-auth:
HOME_VIRTUAL_AUTH_APP_MATRIX=1 node scripts/home-passkey-virtual-auth-smoke.mjs
# Release-trust gate: requires canonical publisher signer, not the dev signer
verify-release:
just verify
just product-ui-browser
just local-carrier-setup-smoke
just home-frontdoor-smoke
# Validate capsule metadata, component profiles and signed catalog bindings.
product-data:
node scripts/check-product-data.mjs
# Verify the checked-in ElastOS Bus contract and real Component fixture
bus-conformance:
node scripts/check-elastos-bus-wit.mjs
cd elastos && cargo test -p elastos-server component_runs_through_real_bus_authority_provider_and_audit_paths -- --nocapture
# Validate canonical capsule scaffolds against the current manifest and WIT contracts
capsule-templates:
node scripts/check-capsule-templates.mjs
cd elastos && cargo test -p elastos-common capsule_authoring_templates_validate -- --nocapture
# Real-PTY source proof: current target-built elastos + current home-cli.wasm against clean-home data
home-frontdoor-smoke:
./scripts/home-frontdoor-smoke.sh
# Clean-home setup proof for the current local trusted-source path
local-carrier-setup-smoke:
./scripts/local-carrier-setup-smoke.sh
# Prepare and launch a clean temp-home local Home demo from source
home-demo-local *args:
./scripts/home-demo-local.sh {{args}}
# Audit an installed-style elastos binary on a clean home
installed-command-audit bin="":
#!/usr/bin/env bash
set -euo pipefail
if [[ -n "{{bin}}" ]]; then
ELASTOS_AUDIT_BIN="{{bin}}" ./scripts/installed-command-audit.sh
else
./scripts/installed-command-audit.sh
fi
# Build the release binary and audit its installed-style command surface
candidate-command-audit:
#!/usr/bin/env bash
set -euo pipefail
cargo build -p elastos-server --release --manifest-path elastos/Cargo.toml
audit_target_root="${CARGO_TARGET_DIR:-$PWD/elastos/target}"
if [[ "$audit_target_root" != /* ]]; then
audit_target_root="$PWD/$audit_target_root"
fi
ELASTOS_AUDIT_BIN="$audit_target_root/release/elastos" ./scripts/installed-command-audit.sh
# Clean build artifacts
clean:
./scripts/build/clean.sh
# Clean everything (artifacts + runtime data + caches)
clean-all:
./scripts/build/clean.sh --all
# Build rootfs for a single capsule
rootfs name:
./scripts/build/build-rootfs.sh {{name}}
# Build rootfs for all publish capsules
rootfs-all:
#!/usr/bin/env bash
set -euo pipefail
capsules=(shell localhost-provider chat did-provider ipfs-provider tunnel-provider)
for c in "${capsules[@]}"; do
./scripts/build/build-rootfs.sh "$c" --output artifacts/
done
echo "All rootfs builds complete."
# Run GBA emulator demo
gba *args:
./scripts/gba.sh {{args}}