Document the Windows build, its CI and the native test runner
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 7m32s
verify / verify-windows (pull_request) Successful in 14m34s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 18:32:56 -06:00
co-authored by Claude Opus 5.5
parent cb08b59820
commit 79fe3a2880
5 changed files with 150 additions and 5 deletions
+12 -2
View File
@@ -15,8 +15,11 @@ resume; it names the live threads. Parent project rules live in
run `scripts/clean-old-builds.sh` at the end of each task; keep only the
current release binary and the pinned wxWidgets cache.
- The GUI is pure-Rust wxWidgets on the vendored, patched `wx-rs`
(`thirdparty/wx-rs/wx-rs-0.2.0-patched`). When you change it, regenerate the
matching `thirdparty/wx-rs/patches/NNNN-*.patch` and commit both.
(`thirdparty/wx-rs/wx-rs-0.2.0-patched`). When you change it, record the
change with `python3 scripts/wx_rs_patches.py capture NAME "Subject"` and
commit both; CI runs `scripts/wx_rs_patches.py check`.
- OS differences in Rust go in `alkane_core::platform` (config dir, private
files, null device, console-less helper processes), not inline `cfg`s.
## Development / review / visual-feedback loop
@@ -36,6 +39,13 @@ Every UI change goes through this loop before it is considered done:
Headless X gotcha: the GTK window only maps under Xvfb with `GDK_BACKEND=x11`
set; without it the app runs but never shows a window. The scripts set it.
Windows: `scripts/build-gui-windows.sh` cross-builds the `.exe`;
`scripts/ui-selftest-windows.sh` runs the same self-test under Wine, and
`. scripts/windows-cross-env.sh` lets `cargo test --target x86_64-pc-windows-gnu`
run the unit tests under Wine. Bridge (C++) changes must work on both wxGTK
and wxMSW, where the table is wx's generic data view; see docs/windows.md.
Real-Windows checks use the Win11 VM (docs/windows.md, "Native Windows runner").
## Offline modes (no hardware needed)
- `ALKANE_FAKE_SCAN=1` -- feed `crates/alkane-gui/src/fixtures.rs` (the 9 bench
+1 -1
View File
@@ -63,7 +63,7 @@ board metadata (`boards/*/board.yml`); this toolkit mechanizes those recipes.
- Headless X gotcha: the GTK window only maps under Xvfb with `GDK_BACKEND=x11` set (the scripts do this).
**Not done yet (open threads, in rough priority):**
1. Windows + macOS builds — `scripts/build-gui-{windows,macos}.sh` exist; Windows needs msys2/MSVC (wx-rs build.rs handles msys2 paths natively), macOS needs a Mac to link. Consider a gitea Actions CI runner. No CI config exists at all yet.
1. Windows: DONE 2026-11-02 (docs/windows.md, ADR 0004) -- cross-built with mingw-w64, tested under Wine in CI and natively on the Win11 VM runner, released with every version. macOS still needs a Mac to link.
2. ARP/ICMP pre-pass for link-up-but-silent boards (M1 scope, spec'd in plan §5, not implemented)
3. Column order/visibility *persistence* to `ui.conf` (spec'd in UI-SPEC "Implementation notes"). Visibility (Columns dialog) and drag-reorder both work in-session; only the save/restore across runs is missing.
4. Sort-direction indicator in headers; per-model "Slow" bands (currently flat 80% of expected); model-derived power estimates for units that don't report wattage
+6 -2
View File
@@ -26,8 +26,12 @@ ALKANE_FAKE_SCAN=1 ~/.cache/alkane-tk-target/release/alkane-toolkit
```
The first command builds wxWidgets 3.3.3 once. Linux needs GTK 3. Fake scan
uses offline fixtures and does not contact hardware. For Windows and macOS,
use the matching `scripts/build-gui-*.sh` script.
uses offline fixtures and does not contact hardware.
Windows 10/11 builds are cross-compiled on Linux (`scripts/build-wx-windows.sh`,
then `scripts/build-gui-windows.sh`) and attached to every release as a
self-contained `alkane-toolkit.exe`; see [docs/windows.md](docs/windows.md).
macOS is not built.
## Current scope
+48
View File
@@ -0,0 +1,48 @@
# ADR 0004: Windows port
Date: 2026-11-02
## Context
The GUI is wxWidgets through the patched `wx-rs` bridge (ADR 0002), so most
of it is portable, but the patches and the app had only ever run on GTK. The
Windows build has to look and behave like a native Windows 10/11 application,
ship from the same CI as Linux, and stay maintainable for a team that develops
on Linux.
## Decision
- Build on Linux: cross-compile with mingw-w64 (posix threads) against the
vendored wxWidgets built as static wxMSW (`scripts/build-wx-windows.sh`).
The `wx-rs` build script now picks the platform from `CARGO_CFG_TARGET_*`
(a build script's `cfg!()` describes the host) and builds Windows/GNU through
`wx-config` exactly like GTK. The C++ runtime is linked statically; the
`.exe` imports only Windows system DLLs.
- Native look comes from wxMSW plus an application manifest
(`crates/alkane-gui/windows/`): Common Controls v6, per-monitor DPI
awareness v2, UTF-8 code page, Windows 10/11 compatibility, icon and
version resources. Light/dark follows the Windows app mode.
- Platform code is contained: OS differences in Rust live in
`alkane_core::platform` (config directory, owner-only secret files, null
device, console-less child processes); in C++ they are `#ifdef __WXMSW__` /
`__WXGTK__` sections of the bridge, with shared logic (icon hit-testing) in
plain functions both use.
- Sizes cross the Rust/C++ boundary in DIPs, converted per window with
`FromDIP`/`ToDIP`. That is the identity on GTK, so Linux output is unchanged.
- SSH password logins use `SSH_ASKPASS` with the toolkit's own executable as
the helper, on every platform, replacing `sshpass` (absent on Windows).
- CI tests the Windows build under Wine on the existing Linux runners (the
release gate), and again on real Windows 11 through a self-hosted VM runner
(advisory, never blocking).
- The `wx-rs` patch queue must reproduce the patched tree from the pristine
upstream crate; `scripts/wx_rs_patches.py check` enforces it in CI.
## Consequences
- One toolchain and one CI fleet for both platforms; no Windows build machine.
- Wine is a good but not perfect stand-in for Windows; the native VM job
covers the gap without making releases depend on the VM being up.
- Bridge changes need checking on both toolkits: GTK uses the native tree
view, wxMSW the generic data view, which differ in input routing, painting
and selection style (see docs/windows.md).
- macOS remains out of scope (no Mac to build or test on).
+83
View File
@@ -0,0 +1,83 @@
# Windows
The toolkit ships a Windows build alongside the Linux one in every release:
`alkane-toolkit-vX.Y.Z-windows-x86_64.zip`, holding one self-contained
`alkane-toolkit.exe` for Windows 10 and 11 (x86_64). There is no installer
and no runtime to install. Design decisions are in
[ADR 0004](adr/0004-windows-port.md).
## Using it
- Settings live in `%APPDATA%\alkane-toolkit` (Linux: `~/.config/alkane-toolkit`),
same file names and formats.
- SSH actions use the OpenSSH client built into Windows (`ssh.exe`); HTTP
actions use the built-in `curl.exe`. Both start without a console window.
- The window follows the Windows light/dark app setting. Set
`ALKANE_APPEARANCE=light` or `dark` to force one (any platform).
- Headless modes (`ALKANE_SELFTEST`, `ALKANE_ACCESS_PROBE`, `ALKANE_LOG_SCAN`)
print to the console they are started from.
- Offline demo: `set ALKANE_FAKE_SCAN=1 && alkane-toolkit.exe`.
## Building
The Windows build is cross-compiled on Linux with mingw-w64 (posix-threads
variant), exactly as CI does it:
```sh
sudo apt install g++-mingw-w64-x86-64-posix wine xvfb # once
scripts/build-wx-windows.sh # once: static wxMSW 3.3.3 in ~/.cache/wx-3.3.3-mingw
scripts/build-gui-windows.sh # release alkane-toolkit.exe
```
`scripts/windows-cross-env.sh` holds the toolchain environment (compilers,
linker, `WX_RS_WXCONFIG`, the Wine test runner). Source it to run cargo by hand:
```sh
. scripts/windows-cross-env.sh
cargo test --offline --target "$ALKANE_WIN_TARGET" --workspace --exclude wx-rs # runs under Wine
scripts/ui-selftest-windows.sh # headless UI self-test of the .exe under Wine
```
`alkane-toolkit.exe` must import only Windows system DLLs; `ci/windows-ci.sh
build` fails the build if a mingw runtime DLL slips in.
## CI
`ci/windows-ci.sh` is the one definition of every Windows step; the workflows
only call it.
| Workflow | Windows job | Gate |
|----------|-------------|------|
| `verify.yml` (PRs to main) | `verify-windows`: clippy, release build, unit tests and UI self-test under Wine | required |
| `release.yml` (main) | `windows`: the same, then packages the zip; `release` waits for it and attaches it | required |
| `next.yml` (next) | `windows`: build and package the `-rc` zip | required |
| `windows-native.yml` | runs main's cross-built unit tests and UI self-test on real Windows 11 | advisory |
The CI image (`ci/images/alkane-ci.Dockerfile`, digest pinned in
`ci/runner-image.txt`) adds mingw-w64, Wine with a ready prefix, the rustup
target and a prebuilt wxMSW prefix to the Linux image. Rebuild it with
`ci/images/build-image.sh TAG` from the workstation that holds the registry
credential; the script pins the new digest everywhere.
## Native Windows runner
`windows-native.yml` runs on the self-hosted runner `win11-test-vm`
(label `alkane-windows`, host mode) inside the Windows 11 test VM
(`~/vms/win11-fresh.qcow2` on the workstation). It downloads the
`alkane-toolkit-windows-tests` artifact of the triggering main run, runs every
test executable and the UI self-test natively, and never blocks a release:
while the VM is off, the job waits for the runner.
In the VM, `gitea-runner` v3.5.0 lives in `C:\gitea-runner` and starts at boot
as the scheduled task `gitea-runner`, running as `LOCAL SERVICE` (log:
`C:\gitea-runner\runner.log`).
## Differences from Linux worth knowing
- wxMSW's `wxDataViewCtrl` is wx's generic implementation (GTK uses the native
`GtkTreeView`), so drag-select and per-cell tooltips are implemented in the
bridge for it.
- Selected rows use the Windows 10/11 list-view highlight: a light tint under
normal text, not a solid colour with white text.
- The app is per-monitor DPI aware: the bridge converts every size it gets
from Rust from DIPs to physical pixels for the window it applies to.