Skip to content

Commit 65781c0

Browse files
authored
ci(hu): wasm plugin test job, full check-hu, hu docs (hu stack 9/9) (#240)
1 parent 906acbb commit 65781c0

21 files changed

Lines changed: 1417 additions & 678 deletions

.github/workflows/ci.yml

Lines changed: 81 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ jobs:
7979
uses: jlumbroso/free-disk-space@main
8080
with:
8181
large-packages: true
82-
tool-cache: false
83-
android: false
84-
dotnet: false
85-
haskell: false
86-
docker-images: false
82+
tool-cache: true
83+
android: true
84+
dotnet: true
85+
haskell: true
86+
docker-images: true
8787
swap-storage: false
8888

8989
- name: Install Nix (Linux)
@@ -176,11 +176,11 @@ jobs:
176176
uses: jlumbroso/free-disk-space@main
177177
with:
178178
large-packages: true
179-
tool-cache: false
180-
android: false
181-
dotnet: false
182-
haskell: false
183-
docker-images: false
179+
tool-cache: true
180+
android: true
181+
dotnet: true
182+
haskell: true
183+
docker-images: true
184184
swap-storage: false
185185

186186
- name: Install Nix (Linux)
@@ -234,11 +234,11 @@ jobs:
234234
uses: jlumbroso/free-disk-space@main
235235
with:
236236
large-packages: true
237-
tool-cache: false
238-
android: false
239-
dotnet: false
240-
haskell: false
241-
docker-images: false
237+
tool-cache: true
238+
android: true
239+
dotnet: true
240+
haskell: true
241+
docker-images: true
242242
swap-storage: false
243243

244244
- name: Install Nix
@@ -311,11 +311,11 @@ jobs:
311311
uses: jlumbroso/free-disk-space@main
312312
with:
313313
large-packages: true
314-
tool-cache: false
315-
android: false
316-
dotnet: false
317-
haskell: false
318-
docker-images: false
314+
tool-cache: true
315+
android: true
316+
dotnet: true
317+
haskell: true
318+
docker-images: true
319319
swap-storage: false
320320

321321
- name: Install Nix (Linux)
@@ -352,6 +352,7 @@ jobs:
352352
uses: actions-rust-lang/setup-rust-toolchain@v1
353353
with:
354354
toolchain: stable
355+
target: wasm32-wasip2
355356
components: clippy, rustfmt
356357

357358
- name: Install dependencies (macOS)
@@ -420,6 +421,56 @@ jobs:
420421
nu scripts/test-pure-rust.nu clippy-tests
421422
shell: bash
422423

424+
wasm-plugin-tests:
425+
name: WASM Plugin Tests (ubuntu-latest)
426+
runs-on: ubuntu-latest
427+
permissions:
428+
contents: read
429+
430+
steps:
431+
- name: Checkout repository
432+
uses: actions/checkout@v4
433+
434+
- name: Free Disk Space (Ubuntu)
435+
uses: jlumbroso/free-disk-space@main
436+
with:
437+
large-packages: true
438+
tool-cache: true
439+
android: true
440+
dotnet: true
441+
haskell: true
442+
docker-images: true
443+
swap-storage: false
444+
445+
- name: Install Nix
446+
uses: cachix/install-nix-action@v31
447+
with:
448+
extra_nix_config: |
449+
extra-substituters = https://hiroz.cachix.org
450+
extra-trusted-public-keys = hiroz.cachix.org-1:wKJuqEckTG0DL3Df7Ly9OVsg5S5TGBHtvlPGs+vlqrY=
451+
452+
- name: Setup Cachix
453+
uses: cachix/cachix-action@v15
454+
with:
455+
name: hiroz
456+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
457+
skipPush: ${{ github.event_name == 'pull_request' }}
458+
459+
- name: Setup nix environment
460+
run: |
461+
nix print-dev-env '.#pureRust-ci' --accept-flake-config > /tmp/nix-dev-env.sh
462+
echo "export CI=true" >> /tmp/nix-dev-env.sh
463+
464+
- name: Setup Rust cache
465+
uses: Swatinem/rust-cache@v2
466+
with:
467+
shared-key: ubuntu-latest-wasm-plugin-tests
468+
469+
- name: Run WASM plugin tests
470+
run: |
471+
source /tmp/nix-dev-env.sh
472+
bash scripts/ci/hu-tests.sh
473+
423474
go-tests:
424475
name: Go Tests (${{ matrix.os }})
425476
runs-on: ${{ matrix.os }}
@@ -483,11 +534,11 @@ jobs:
483534
uses: jlumbroso/free-disk-space@main
484535
with:
485536
large-packages: true
486-
tool-cache: false
487-
android: false
488-
dotnet: false
489-
haskell: false
490-
docker-images: false
537+
tool-cache: true
538+
android: true
539+
dotnet: true
540+
haskell: true
541+
docker-images: true
491542
swap-storage: false
492543

493544
- name: Install Nix
@@ -600,11 +651,11 @@ jobs:
600651
uses: jlumbroso/free-disk-space@main
601652
with:
602653
large-packages: true
603-
tool-cache: false
604-
android: false
605-
dotnet: false
606-
haskell: false
607-
docker-images: false
654+
tool-cache: true
655+
android: true
656+
dotnet: true
657+
haskell: true
658+
docker-images: true
608659
swap-storage: false
609660

610661
- name: Install Nix

.github/workflows/test.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,53 @@ jobs:
5757
container:
5858
image: ${{ matrix.image }}
5959
steps:
60+
- name: Compute weekly cache key
61+
id: cache-week
62+
run: echo "week=$(date -u +%Y-W%V)" >> "$GITHUB_OUTPUT"
63+
6064
- name: Cache apt packages
6165
uses: actions/cache@v4
6266
with:
6367
path: /var/cache/apt/archives
6468
key: apt-${{ matrix.distro }}-v3-${{ hashFiles('.github/workflows/test.yml') }}
6569

70+
# The apt package-index fetch (not the downloads) is the mirror bottleneck
71+
# here (~900 B/s), costing minutes per job. Cache the index; keyed weekly
72+
# so it can't go permanently stale — a miss just re-fetches.
73+
- name: Cache apt package lists
74+
uses: actions/cache@v4
75+
with:
76+
path: /var/lib/apt/lists
77+
key: apt-lists-${{ matrix.distro }}-${{ steps.cache-week.outputs.week }}
78+
restore-keys: |
79+
apt-lists-${{ matrix.distro }}-
80+
81+
# GitHub runners are on Azure, but the ROS base images point at the
82+
# generic archive/security.ubuntu.com endpoints, which are slow from here
83+
# (~75-900 B/s). Repoint to Azure's same-datacenter mirror. Handles both
84+
# the legacy one-line sources.list and the newer deb822 *.sources format.
85+
- name: Point apt at the Azure Ubuntu mirror
86+
run: |
87+
if [ -f /etc/apt/sources.list ]; then
88+
sed -i \
89+
-e 's|http://archive\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
90+
-e 's|http://security\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
91+
/etc/apt/sources.list
92+
fi
93+
# Guard with `ls`: with nullglob off, a non-matching glob expands to
94+
# the literal pattern, so don't rely on the match itself.
95+
if ls /etc/apt/sources.list.d/*.sources > /dev/null 2>&1; then
96+
sed -i \
97+
-e 's|http://archive\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
98+
-e 's|http://security\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
99+
/etc/apt/sources.list.d/*.sources
100+
fi
101+
66102
- name: Install system dependencies
67-
run: apt-get update && apt-get install -y nodejs
103+
run: |
104+
# Install jq here so taiki-e/install-action's cargo-nextest step
105+
# below doesn't trigger a second, redundant apt-get update for it.
106+
apt-get update && apt-get install -y nodejs jq
68107
69108
- name: Install Nushell
70109
run: |
@@ -123,6 +162,13 @@ jobs:
123162
else
124163
cargo nextest run -p hiroz-tests --profile interop \
125164
--features "ros-interop,$FEATURES"
165+
# dynamic_subscriber tests are all #[ignore]'d in CI (ros2 topic
166+
# pub isn't graph-visible under CI's rmw_zenoh_cpp — see
167+
# headless_test.rs). --no-tests=warn keeps that from failing the job.
168+
cargo nextest run -p hiroz-union --profile interop \
169+
--features ros-interop \
170+
-E 'test(dynamic_subscriber)' \
171+
--no-tests=warn
126172
fi
127173
128174
- uses: actions/setup-go@v5

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ This pushes `v0.0.0-smoke-test`, waits for all CI jobs to pass (builds, smoke te
5252
The CI pipeline exercises:
5353

5454
- All wheel builds (jazzy + humble × x86_64 Linux, aarch64 Linux, aarch64 macOS)
55-
- All binary builds (`hiroz-console`)
55+
- The `hu` binary build, plus the `hu-meter` / `hu-monitor` WASM plugins (`hu_meter.wasm` / `hu_monitor.wasm`, `wasm32-wasip2` target)
5656
- All Go library builds (`libhiroz` static + shared)
5757
- Python smoke test: install into venv, `import hiroz_py`
5858
- Binary smoke test: `--help` + 3-second runtime check (no crash)

docs/core-concepts/actions-advanced.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub async fn run_fibonacci_action_server(ctx: ZContext, timeout: Option<Duration
9696

9797
```bash
9898
# Start Eclipse Zenoh router first
99-
cargo run --example zenoh_router
99+
hu router
100100

101101
# Run the server (runs until Ctrl+C)
102102
cargo run --example demo_nodes_fibonacci_action_server
@@ -200,7 +200,7 @@ cargo run --example demo_nodes_fibonacci_action_client -- --endpoint tcp/localho
200200
**Terminal 1 - Start Zenoh Router:**
201201

202202
```bash
203-
cargo run --example zenoh_router
203+
hu router
204204
```
205205

206206
**Terminal 2 - Start Action Server:**

docs/core-concepts/parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ The parameter examples are now split into focused binaries:
488488

489489
```bash
490490
# Start a Zenoh router first
491-
cargo run --example zenoh_router
491+
hu router
492492
493493
# Local declare/get/set/undeclare flow
494494
cargo run --example z_parameter_declare

docs/core-concepts/pubsub.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ while let Ok(msg) = subscriber.async_recv().await {
225225
**Terminal 1 — Start Zenoh Router:**
226226

227227
```bash
228-
cargo run --example zenoh_router
228+
hu router
229229
```
230230

231231
**Terminal 2 — Start Subscriber:**

docs/core-concepts/services.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ A client that sends an addition request and prints the result. Full source: [`cr
236236
**Terminal 1 — Start Zenoh Router:**
237237

238238
```bash
239-
cargo run --example zenoh_router
239+
hu router
240240
```
241241

242242
**Terminal 2 — Start Server:**

docs/getting-started/quick-start.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Pre-built artifacts are available on the [Releases page](https://github.com/Zett
99

1010
| Artifact | Use case | Install |
1111
|---|---|---|
12-
| `hiroz-console` binary | Monitor any ROS 2 / hiroz system | [Console docs](../tools/console.md#installation) |
12+
| `hu` binary | Monitor and introspect any ROS 2 / hiroz system | Forthcoming — not yet a release artifact; [build from source](../tools/hu.md#installation) |
1313
| `hiroz_py` Python wheel | Python pub/sub & services | [Python quick start](../bindings/python-quick-start.md) |
1414
| `libhiroz` Go library | Go pub/sub & services | [Go quick start](../bindings/go-quick-start.md) |
1515

@@ -50,7 +50,7 @@ The router is a lightweight process that lets nodes find each other — think of
5050
**Terminal 1 — Start the Router:**
5151

5252
```bash
53-
cargo run --example zenoh_router
53+
hu router
5454
```
5555

5656
### Run the Pub/Sub Example
@@ -91,7 +91,7 @@ Ready to build your own hiroz application? Follow these steps to create a new pr
9191

9292
### 1. Install the Zenoh Router
9393

94-
Since you won't have access to the `zenoh_router` example outside the hiroz repository, you'll need to install a Zenoh router. Here are the quickest options:
94+
Outside the hiroz repository you'll need a Zenoh router — either the standalone `hu router` command (if you have the `hu` tool installed) or one of the quickest options below:
9595

9696
**Option A: Using cargo (if you have Rust):**
9797

0 commit comments

Comments
 (0)