Files
komorebi/e2e/platforms/qemu_windows/build-ref.sh
T
LGUG2Z f0a0d71b83 test(e2e): a Windows scenario bar for komorebi-bar
New extras scenario e2e/platforms/qemu_windows/extras/bar.py, registered in
run.py as `bar` (runs after the tiling windows, like the other Windows
extras). It starts komorebi-bar in the guest with a configuration that has
storage, time, applications, komorebi workspaces and layout widgets, the
Windows-only Keyboard and Systray widgets and a `mouse` block (a message and
a command), and checks: `komorebi-bar --schema` equals the checked-in
schema.bar.json byte for byte; the process starts and its window titled
komorebi-bar appears, visible and sized; it runs 15 s (scaled); `komorebic
state` answers and komorebi does not tile the bar; commands that notify the
bar work; the bar survives `komorebic stop` and the daemon starting again as
the same process (it reconnects: it does NOT exit when the daemon stops, so
the task text "exits cleanly when komorebi stops" is checked as
`komorebic stop --bar` ending daemon and bar); screenshots are kept as
artefacts, no pixel assertions. No known failures.

Plumbing: run.py uploads komorebi-bar.exe when the binaries directory has it
(other scenarios do not need it, so older build-ref directories still work),
the nix app copies it and sets KOMOREBI_E2E_BAR_SCHEMA to the checked-in
schema (the e2e directory alone does not contain it), build-ref.sh builds it.
README and docs/dev/bar-e2e.md document it.

Verified: py_compile and ruff clean; the runner and library unit tests: 157
passed; flake.nix parses. NOT run: the scenario itself (the Windows guest is
reserved for gates), so every check is untested against a real bar and may
need adjusting (window title, timings, the Systray widget inside the VM).
Needs gate: win-e2e `bar`.
2026-11-05 10:30:05 -08:00

42 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the binaries of another komorebi commit, to run the e2e scenarios
# against them: `KOMOREBI_E2E_BINS=OUTDIR nix run .#e2e-windows -- ...`.
#
# usage: build-ref.sh REF OUTDIR
# REF is anything git knows (a commit, a branch, a tag); it is fetched from
# origin if it is not here yet. The checkout of REF is built with this
# tree's flake.nix and flake.lock, because the nix build of an older commit
# may not work any more; the test window is this tree's. OUTDIR gets
# komorebi.exe, komorebic.exe, komorebi-testwin.exe and `commit`, the full
# hash, which the runner writes into every result.json.
# needs on PATH: git nix
set -euo pipefail
ref=$1 out=$2
here=$(cd "$(dirname "$0")" && pwd)
root=$(git -C "$here" rev-parse --show-toplevel)
if ! git -C "$root" cat-file -e "$ref^{commit}" 2>/dev/null; then
git -C "$root" fetch origin "+refs/heads/*:refs/remotes/origin/*"
fi
commit=$(git -C "$root" rev-parse "$ref^{commit}")
tree=$(mktemp -d)
cleanup() {
git -C "$root" worktree remove --force "$tree" 2>/dev/null || rm -rf "$tree"
}
trap cleanup EXIT
git -C "$root" worktree add --detach "$tree" "$commit"
cp "$root/flake.nix" "$root/flake.lock" "$tree/"
mkdir -p "$out"
for package in komorebi komorebic komorebi-bar; do
path=$(nix build "$tree#$package" --no-link --print-out-paths)
cp "$path/bin/$package.exe" "$out/"
done
path=$(nix build "$root#komorebi-testwin-e2e" --no-link --print-out-paths)
cp "$path/bin/komorebi-testwin.exe" "$out/"
chmod u+w "$out"/*.exe
echo "$commit" > "$out/commit"
echo "built $commit into $out"