Document the Windows build, its CI and the native test runner
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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).
|
||||
@@ -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
|
||||
(a local test VM). 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.
|
||||
Reference in New Issue
Block a user