Skip to content

The agent that grows with you

ci: run cargo test for the bootstrap installer

Brooklyn Nicholson5caea5e501a3
diff --git a/.github/actions/detect-changes/action.yml b/.github/actions/detect-changes/action.yml
index b16500346f5..ade05ba124d 100644
--- a/.github/actions/detect-changes/action.yml
+++ b/.github/actions/detect-changes/action.yml
@@ -48,6 +48,9 @@ outputs:
installer:
description: Run the PowerShell installer tests on a Windows runner.
value: ${{ steps.classify.outputs.installer }}
+ rust:
+ description: Run `cargo test` for the Tauri bootstrap installer.
+ value: ${{ steps.classify.outputs.rust }}
mcp_catalog:
description: Require MCP catalog security review label.
value: ${{ steps.classify.outputs.mcp_catalog }}
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index b5df97cf020..71756b3acba 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -105,6 +105,14 @@ jobs:
if: needs.detect.outputs.installer == 'true'
uses: ./.github/workflows/installer-tests.yml
+ rust-tests:
+ name: Rust tests
+ needs: detect
+ # Only for PRs that touch a Rust crate. `.rs` is under apps/, so these
+ # changes used to run the TypeScript matrix and nothing that compiles them.
+ if: needs.detect.outputs.rust == 'true'
+ uses: ./.github/workflows/rust-tests.yml
+
e2e-desktop:
name: Desktop E2E
needs: detect
@@ -213,6 +221,7 @@ jobs:
- lint
- js-tests
- installer-tests
+ - rust-tests
- e2e-desktop
- docs-site
- history-check
diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml
new file mode 100644
index 00000000000..e65dcc18e7c
--- /dev/null
+++ b/.github/workflows/rust-tests.yml
@@ -0,0 +1,66 @@
+# .github/workflows/rust-tests.yml
+name: Rust tests
+
+# `cargo test` for the Tauri bootstrap installer (Hermes-Setup). Nothing in CI
+# compiled this crate before: `.rs` lives under `apps/`, so the change
+# classifier matched it as `frontend` and ran the TypeScript matrix, which
+# cannot notice a Rust error. The crate's unit tests existed in the tree and had
+# never run.
+#
+# Linux runner on purpose. The pipe-drain tests in src/powershell.rs need a real
+# process tree whose grandchild inherits the parent's stdout, and their fixture
+# is `#[cfg(unix)]`; the Windows half of that same contract is covered by
+# `-SelfTestPipeDrain` in scripts/desktop-update/windows.ps1 on the Windows
+# lane. A Windows runner here would compile them out and report green over zero
+# coverage.
+
+on:
+ workflow_call:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: rust-tests-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ bootstrap-installer:
+ name: cargo test (bootstrap installer)
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ defaults:
+ run:
+ working-directory: apps/bootstrap-installer/src-tauri
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+
+ # Tauri links against the system webkit2gtk on Linux, so the crate does
+ # not compile without these even for `cargo test --lib`.
+ - name: Install Tauri system dependencies
+ working-directory: .
+ run: |
+ sudo apt-get update
+ sudo apt-get install --no-install-recommends -y \
+ libwebkit2gtk-4.1-dev \
+ libappindicator3-dev \
+ librsvg2-dev \
+ libxdo-dev \
+ libssl-dev \
+ patchelf
+
+ # No restore-keys: a partial hit leaves a stale target dir, and a cold
+ # build is only a few minutes. Keyed on the lockfile plus the toolchain.
+ - name: Restore cargo cache
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ apps/bootstrap-installer/src-tauri/target
+ key: cargo-${{ runner.os }}-${{ hashFiles('apps/bootstrap-installer/src-tauri/Cargo.lock') }}
+
+ # --lib only: the integration/bin targets would need a built frontend
+ # (vite dist) that this lane deliberately does not produce.
+ - name: cargo test
+ run: cargo test --lib --locked
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index db79da5c7b8..7f608d0af9c 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -25,6 +25,9 @@ Lanes:
must not run it.
* ``npm_lock`` — semantic package-lock.json diff PR comment.
* ``installer`` — PowerShell installer tests (Windows runner).
+* ``rust`` — ``cargo test`` for the Tauri bootstrap installer. ``.rs``
+ lives under ``apps/``, so without this lane a Rust change matched ``frontend``
+ and only the TypeScript matrix ran.
* ``mcp_catalog`` — bundled MCP catalog / installer review.
Docker is not a lane — it builds on push-to-main and release only,
@@ -106,6 +109,13 @@ _MCP_CATALOG_FILES = {"hermes_cli/mcp_catalog.py"}
_INSTALLER_PATHS = ("scripts/tests/",)
_INSTALLER_FILES = {"scripts/install.ps1", "scripts/install.cmd"}
+# Rust crates — currently just the Tauri bootstrap installer (Hermes-Setup).
+# These live under ``apps/``, so before this lane existed a ``.rs`` edit matched
+# ``frontend`` and nothing more: the TypeScript matrix built, cargo never ran,
+# and the crate's unit tests had never executed in CI at all.
+_RUST_PATHS = ("apps/bootstrap-installer/src-tauri/",)
+_RUST_FILENAMES = {"Cargo.toml", "Cargo.lock"}
+
def _is_docs(p: str) -> bool:
if p.startswith(("skills/", "optional-skills/")):
return False
@@ -152,6 +162,14 @@ def _is_installer(p: str) -> bool:
return p.startswith(_INSTALLER_PATHS) or p in _INSTALLER_FILES
+def _is_rust(p: str) -> bool:
+ return (
+ p.endswith(".rs")
+ or p.startswith(_RUST_PATHS)
+ or os.path.basename(p) in _RUST_FILENAMES
+ )
+
+
def _is_ci_review(p: str) -> bool:
if p in _CI_REVIEW_FILES or p.startswith(_CI_REVIEW_PATHS):
return True
@@ -187,6 +205,7 @@ def classify(files: list[str]) -> dict[str, bool]:
"uv_lock": any(f in ("pyproject.toml", "uv.lock") for f in files),
"npm_lock": npm_lock,
"installer": any(_is_installer(f) for f in files),
+ "rust": any(_is_rust(f) for f in files),
"mcp_catalog": any(_is_mcp_catalog(f) for f in files),
"ci_review": any(_is_ci_review(f) for f in files),
"nix": python_prod or frontend or any(_is_nix(f) for f in files)
@@ -203,6 +222,7 @@ def classify(files: list[str]) -> dict[str, bool]:
ret["uv_lock"] = True
ret["npm_lock"] = True
ret["installer"] = True
+ ret["rust"] = True
ret["nix"] = True
ret["ci_review"] = True
diff --git a/tests/ci/test_classify_changes.py b/tests/ci/test_classify_changes.py
index 56fe3a7ad5c..29095ffff00 100644
--- a/tests/ci/test_classify_changes.py
+++ b/tests/ci/test_classify_changes.py
@@ -34,12 +34,13 @@ DEFAULT = {
"uv_lock": True,
"npm_lock": True,
"installer": True,
+ "rust": True,
"mcp_catalog": False,
"ci_review": True,
}
-def _lanes(python=False, frontend=False, site=False, scan=False, deps=False, uv_lock=False, npm_lock=False, installer=False, mcp_catalog=False, docker_meta=False, ci_review=False, python_prod=None, nix=None, docker=None) -> dict[str, bool]:
+def _lanes(python=False, frontend=False, site=False, scan=False, deps=False, uv_lock=False, npm_lock=False, installer=False, rust=False, mcp_catalog=False, docker_meta=False, ci_review=False, python_prod=None, nix=None, docker=None) -> dict[str, bool]:
# python_prod tracks python except for tests-only diffs; default it to
# python so the majority of cases don't need to spell it out.
#
@@ -61,6 +62,7 @@ def _lanes(python=False, frontend=False, site=False, scan=False, deps=False, uv_
"uv_lock": uv_lock,
"npm_lock": npm_lock,
"installer": installer,
+ "rust": rust,
"mcp_catalog": mcp_catalog,
"ci_review": ci_review,
}
@@ -132,6 +134,26 @@ CASES = {
_lanes(python=True, installer=True),
),
"python source alone → no installer lane": (["run_agent.py"], _lanes(python=True, scan=True)),
+ # `.rs` lives under apps/, so it matches `frontend` too. That lane builds
+ # TypeScript and cannot notice a Rust error — before `rust` existed it was
+ # the ONLY lane a Rust change ran, and the crate's tests never executed.
+ "rust source → rust": (
+ ["apps/bootstrap-installer/src-tauri/src/powershell.rs"],
+ _lanes(frontend=True, rust=True),
+ ),
+ "cargo lockfile → rust": (
+ ["apps/bootstrap-installer/src-tauri/Cargo.lock"],
+ _lanes(frontend=True, rust=True),
+ ),
+ # Non-.rs files in the crate still change what cargo builds.
+ "tauri config → rust": (
+ ["apps/bootstrap-installer/src-tauri/tauri.conf.json"],
+ _lanes(frontend=True, rust=True),
+ ),
+ "ts source alone → no rust lane": (
+ ["apps/bootstrap-installer/src/main.tsx"],
+ _lanes(frontend=True),
+ ),
# Unknown top-level file keeps Python on rather than risk a silent skip.
"unknown toplevel → python": (["Makefile"], _lanes(python=True)),
"mixed docs+python → python": (["README.md", "agent/x.py"], _lanes(python=True, scan=True)),