Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

ci: reuse prebuilt Omarchy VM from GHCR

quanru8b47e6179ea3
diff --git a/.github/workflows/midscene-experimental.yml b/.github/workflows/midscene-experimental.yml
index b486c8c..4661750 100644
--- a/.github/workflows/midscene-experimental.yml
+++ b/.github/workflows/midscene-experimental.yml
@@ -1,16 +1,10 @@
name: Midscene experimental
-on:
- push:
- branches: [ci/midscene-e2e]
- paths:
- # The VM install is deliberately expensive. Push this marker only when
- # the pinned Omarchy ISO or installer harness needs to be revalidated.
- - "tests/midscene/.rebuild-omarchy-vm"
- workflow_dispatch:
+on: workflow_dispatch
permissions:
contents: read
+ packages: read
concurrency:
group: midscene-experimental-${{ github.ref }}
@@ -57,8 +51,16 @@ jobs:
"${MIDSCENE_MODEL_BASE_URL%/}/chat/completions" \
>/dev/null
- - name: Install Omarchy VM
- run: tests/midscene/install-omarchy-vm.sh
+ - name: Install ORAS client
+ uses: oras-project/setup-oras@22ce207df3b08e061f537244349aac6ae1d214f6 # v1
+
+ - name: Sign in to GitHub Container Registry
+ run: echo "$GHCR_TOKEN" | oras login ghcr.io --username "$GITHUB_ACTOR" --password-stdin
+ env:
+ GHCR_TOKEN: ${{ github.token }}
+
+ - name: Restore prebuilt Omarchy VM
+ run: tests/midscene/restore-omarchy-vm.sh
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
diff --git a/.github/workflows/omarchy-vm-image.yml b/.github/workflows/omarchy-vm-image.yml
new file mode 100644
index 0000000..e816ee6
--- /dev/null
+++ b/.github/workflows/omarchy-vm-image.yml
@@ -0,0 +1,52 @@
+name: Build Omarchy VM image
+
+on:
+ workflow_dispatch:
+ push:
+ branches: [ci/midscene-e2e]
+ paths:
+ - "tests/midscene/.rebuild-omarchy-vm"
+ - "tests/midscene/install-omarchy-vm.sh"
+ - "tests/midscene/prepare-omarchy-host.sh"
+ - "tests/midscene/publish-omarchy-vm.sh"
+ - "tests/midscene/omarchy-vm.env"
+
+permissions:
+ contents: read
+ packages: write
+
+concurrency:
+ group: omarchy-vm-image-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ build:
+ name: Install and publish Omarchy base VM
+ runs-on: ubuntu-latest
+ timeout-minutes: 70
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+
+ - uses: oras-project/setup-oras@22ce207df3b08e061f537244349aac6ae1d214f6 # v1
+
+ - name: Install Omarchy from the verified official ISO
+ run: tests/midscene/install-omarchy-vm.sh
+
+ - name: Sign in to GitHub Container Registry
+ run: echo "$GHCR_TOKEN" | oras login ghcr.io --username "$GITHUB_ACTOR" --password-stdin
+ env:
+ GHCR_TOKEN: ${{ github.token }}
+
+ - name: Publish versioned Omarchy base VM
+ run: tests/midscene/publish-omarchy-vm.sh
+
+ - name: Upload installer evidence
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: omarchy-vm-image-installer-evidence
+ path: .midscene-omarchy/omarchy-iso/test-runs/**/runs/**
+ if-no-files-found: warn
+ retention-days: 3
diff --git a/tests/midscene/README.md b/tests/midscene/README.md
index dedce09..67c1f79 100644
--- a/tests/midscene/README.md
+++ b/tests/midscene/README.md
@@ -3,18 +3,22 @@
Everything under this directory is developed on `ci/midscene-e2e`; it is not
part of the release branch.
-The first CI stage proves that a GitHub-hosted runner can install the exact
+The image-builder CI proves that a GitHub-hosted runner can install the exact
official Omarchy ISO in a headless QEMU/KVM VM. It reuses Omarchy's own ISO
-acceptance harness and saves installer screenshots and logs as short-lived
-artifacts. It does not upload the VM disk or its temporary SSH key.
+acceptance harness, saves installer evidence as short-lived artifacts, and
+publishes the resulting test-only VM bundle to this repository's private GHCR
+namespace.
The full Omarchy install is intentionally not triggered by ordinary pushes.
-During development on this branch, deliberately add/update
-`tests/midscene/.rebuild-omarchy-vm` only when the pinned ISO or installer
-harness changes. Once this workflow exists on the default branch, it can also
-be started with `workflow_dispatch`. GitHub-hosted runners are ephemeral, so
-every such full rebuild downloads the pinned ISO again; routine Ubuntu
-Midscene tests do not need the ISO.
+`Build Omarchy VM image` installs the verified official ISO only when its
+version, checksum, harness, or rebuild marker changes, then publishes the
+installed base disk as a private, versioned OCI artifact in GHCR. The
+experimental E2E restores that base and creates a throwaway overlay, so normal
+manual runs no longer download or install the 6 GB ISO.
+
+The GHCR artifact also contains the harness-created UEFI state and SSH key.
+That key is valid only for the disposable test VM, whose SSH port is bound to
+the runner's loopback interface; it is never used for GitHub or production.
Omarchy 4.0.3 was installed successfully on a GitHub-hosted runner in
[Actions run 34866563731](https://github.com/quanru/doubao-say/actions/runs/34866563731).
diff --git a/tests/midscene/install-omarchy-vm.sh b/tests/midscene/install-omarchy-vm.sh
index 3c7981b..63ea023 100755
--- a/tests/midscene/install-omarchy-vm.sh
+++ b/tests/midscene/install-omarchy-vm.sh
@@ -4,54 +4,18 @@ set -euo pipefail
# This is deliberately a real Omarchy installation, not an Arch container
# dressed up with a few Omarchy files. The official ISO acceptance harness
# drives the installer through QEMU screenshots, OCR and virtual keystrokes.
-readonly ISO_VERSION="4.0.3"
-readonly ISO_SHA256="03d60bc74306dca51f96e1a84b690871d8d606826b260edd0208962da8507d14"
-readonly ISO_HARNESS_SHA="a23f8d464dcb0616a61bfaa8026e23d0533da209"
readonly WORK_DIR="$PWD/.midscene-omarchy"
-readonly ISO_PATH="$WORK_DIR/omarchy-${ISO_VERSION}.iso"
+source "$PWD/tests/midscene/omarchy-vm.env"
+readonly ISO_PATH="$WORK_DIR/omarchy-${OMARCHY_ISO_VERSION}.iso"
readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
-if [[ ! -c /dev/kvm ]]; then
- echo "::error::This GitHub runner does not expose /dev/kvm; a real Omarchy VM cannot be started."
- exit 1
-fi
-
-sudo chmod 0666 /dev/kvm
-
-# The ISO is about 6 GB and the installed qcow2 image is sparse but sizeable.
-# GitHub's image includes large SDKs that this isolated job does not need.
-sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
-sudo apt-get update
-sudo apt-get install -y --no-install-recommends \
- curl git imagemagick ovmf qemu-system-x86 qemu-utils socat \
- tesseract-ocr tesseract-ocr-eng
-
-mkdir -p "$WORK_DIR"
+tests/midscene/prepare-omarchy-host.sh
df -h "$WORK_DIR"
curl --fail --location --retry 5 --retry-all-errors \
- "https://iso.omarchy.org/omarchy-${ISO_VERSION}.iso" \
+ "https://iso.omarchy.org/omarchy-${OMARCHY_ISO_VERSION}.iso" \
--output "$ISO_PATH"
-printf '%s %s\n' "$ISO_SHA256" "$ISO_PATH" | sha256sum --check --strict
-
-git init --quiet "$HARNESS_DIR"
-git -C "$HARNESS_DIR" remote add origin https://github.com/omacom/omarchy-iso.git
-git -C "$HARNESS_DIR" fetch --quiet --depth 1 origin "$ISO_HARNESS_SHA"
-git -C "$HARNESS_DIR" checkout --quiet --detach FETCH_HEAD
-
-# Omarchy 4.0.3's welcome tagline says "Agentic Linux" while this pinned
-# harness revision still waits for the former "Opinionated" tagline. Keep the
-# test on the official ISO and change only the OCR readiness marker.
-grep -q 'wait_for_screen "Opinionated"' "$HARNESS_DIR/bin/omarchy-iso-test"
-sed -i 's/wait_for_screen "Opinionated"/wait_for_screen "Agentic"/g' \
- "$HARNESS_DIR/bin/omarchy-iso-test"
-
-# The official harness names Arch paths and its package helper. Adapt only
-# those host-side dependencies; the guest still boots and installs the exact
-# verified official ISO.
-sudo mkdir -p /usr/share/edk2/x64
-sudo ln -sf /usr/share/OVMF/OVMF_CODE_4M.fd /usr/share/edk2/x64/OVMF_CODE.4m.fd
-sudo ln -sf /usr/share/OVMF/OVMF_VARS_4M.fd /usr/share/edk2/x64/OVMF_VARS.4m.fd
+printf '%s %s\n' "$OMARCHY_ISO_SHA256" "$ISO_PATH" | sha256sum --check --strict
readonly SHIM_DIR="$(mktemp -d)"
trap 'rm -rf "$SHIM_DIR"' EXIT
@@ -66,5 +30,5 @@ PATH="$SHIM_DIR:$PATH" "$HARNESS_DIR/bin/omarchy-iso-test" \
--timeout 3000 \
--no-preview
-test -s "$HARNESS_DIR/test-runs/omarchy-${ISO_VERSION}/base.qcow2"
-echo "PASS: a complete Omarchy ${ISO_VERSION} base VM was installed on the GitHub runner"
+test -s "$HARNESS_DIR/test-runs/omarchy-${OMARCHY_ISO_VERSION}/base.qcow2"
+echo "PASS: a complete Omarchy ${OMARCHY_ISO_VERSION} base VM was installed on the GitHub runner"
diff --git a/tests/midscene/omarchy-vm.env b/tests/midscene/omarchy-vm.env
new file mode 100644
index 0000000..abbca14
--- /dev/null
+++ b/tests/midscene/omarchy-vm.env
@@ -0,0 +1,3 @@
+OMARCHY_ISO_VERSION=4.0.3
+OMARCHY_ISO_SHA256=03d60bc74306dca51f96e1a84b690871d8d606826b260edd0208962da8507d14
+OMARCHY_ISO_HARNESS_SHA=a23f8d464dcb0616a61bfaa8026e23d0533da209
diff --git a/tests/midscene/prepare-omarchy-host.sh b/tests/midscene/prepare-omarchy-host.sh
new file mode 100755
index 0000000..60aef8b
--- /dev/null
+++ b/tests/midscene/prepare-omarchy-host.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -euo pipefail
+
+readonly ROOT_DIR="$PWD"
+readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
+readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
+
+# shellcheck source=omarchy-vm.env
+source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+
+if [[ ! -c /dev/kvm ]]; then
+ echo "::error::This GitHub runner does not expose /dev/kvm; a real Omarchy VM cannot be started."
+ exit 1
+fi
+
+sudo chmod 0666 /dev/kvm
+sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
+sudo apt-get update
+sudo apt-get install -y --no-install-recommends \
+ curl git imagemagick ovmf qemu-system-x86 qemu-utils socat \
+ tesseract-ocr tesseract-ocr-eng zstd
+
+mkdir -p "$WORK_DIR"
+git init --quiet "$HARNESS_DIR"
+git -C "$HARNESS_DIR" remote add origin https://github.com/omacom/omarchy-iso.git
+git -C "$HARNESS_DIR" fetch --quiet --depth 1 origin "$OMARCHY_ISO_HARNESS_SHA"
+git -C "$HARNESS_DIR" checkout --quiet --detach FETCH_HEAD
+
+grep -q 'wait_for_screen "Opinionated"' "$HARNESS_DIR/bin/omarchy-iso-test"
+sed -i 's/wait_for_screen "Opinionated"/wait_for_screen "Agentic"/g' \
+ "$HARNESS_DIR/bin/omarchy-iso-test"
+
+sudo mkdir -p /usr/share/edk2/x64
+sudo ln -sf /usr/share/OVMF/OVMF_CODE_4M.fd /usr/share/edk2/x64/OVMF_CODE.4m.fd
+sudo ln -sf /usr/share/OVMF/OVMF_VARS_4M.fd /usr/share/edk2/x64/OVMF_VARS.4m.fd
diff --git a/tests/midscene/publish-omarchy-vm.sh b/tests/midscene/publish-omarchy-vm.sh
new file mode 100755
index 0000000..9b1152d
--- /dev/null
+++ b/tests/midscene/publish-omarchy-vm.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -euo pipefail
+
+readonly ROOT_DIR="$PWD"
+readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
+
+# shellcheck source=omarchy-vm.env
+source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+
+readonly BASE_DIR="$WORK_DIR/omarchy-iso/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
+readonly BUNDLE_DIR="$WORK_DIR/registry"
+readonly ARCHIVE="$BUNDLE_DIR/omarchy-base.tar.zst"
+readonly IMAGE_TAG="${OMARCHY_ISO_VERSION}-${OMARCHY_ISO_SHA256:0:12}-${OMARCHY_ISO_HARNESS_SHA:0:12}"
+readonly IMAGE="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/doubao-say-omarchy-ci-base:${IMAGE_TAG}"
+
+for file in base.qcow2 OVMF_VARS.4m.fd id_ed25519 id_ed25519.pub; do
+ test -s "$BASE_DIR/$file"
+done
+
+mkdir -p "$BUNDLE_DIR"
+tar -C "$BASE_DIR" --sparse -I 'zstd -T0 -6' -cf "$ARCHIVE" \
+ base.qcow2 OVMF_VARS.4m.fd id_ed25519 id_ed25519.pub
+sha256sum "$ARCHIVE" | sed 's# .*/# #' >"$BUNDLE_DIR/SHA256SUMS"
+du -h "$ARCHIVE"
+
+oras push "$IMAGE" \
+ --artifact-type application/vnd.lifeos.omarchy-vm.v1 \
+ --annotation "org.opencontainers.image.source=https://github.com/$GITHUB_REPOSITORY" \
+ --annotation "org.opencontainers.image.version=$OMARCHY_ISO_VERSION" \
+ "$ARCHIVE:application/vnd.lifeos.omarchy-vm.layer.v1+zstd" \
+ "$BUNDLE_DIR/SHA256SUMS:text/plain"
+
+echo "PASS: published $IMAGE"
diff --git a/tests/midscene/restore-omarchy-vm.sh b/tests/midscene/restore-omarchy-vm.sh
new file mode 100755
index 0000000..6082b20
--- /dev/null
+++ b/tests/midscene/restore-omarchy-vm.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+set -euo pipefail
+
+readonly ROOT_DIR="$PWD"
+readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
+
+# shellcheck source=omarchy-vm.env
+source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+
+readonly BASE_DIR="$WORK_DIR/omarchy-iso/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
+readonly BUNDLE_DIR="$WORK_DIR/registry"
+readonly IMAGE_TAG="${OMARCHY_ISO_VERSION}-${OMARCHY_ISO_SHA256:0:12}-${OMARCHY_ISO_HARNESS_SHA:0:12}"
+readonly IMAGE="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/doubao-say-omarchy-ci-base:${IMAGE_TAG}"
+
+tests/midscene/prepare-omarchy-host.sh
+mkdir -p "$BASE_DIR" "$BUNDLE_DIR"
+oras pull --output "$BUNDLE_DIR" "$IMAGE"
+(cd "$BUNDLE_DIR" && sha256sum --check --strict SHA256SUMS)
+tar -C "$BASE_DIR" --use-compress-program=unzstd -xf "$BUNDLE_DIR/omarchy-base.tar.zst"
+
+# In --reuse-base mode the official harness uses the ISO basename only to
+# locate BASE_DIR; it does not read ISO contents.
+printf 'restored-from=%s\n' "$IMAGE" >"$WORK_DIR/omarchy-${OMARCHY_ISO_VERSION}.iso"
+
+for file in base.qcow2 OVMF_VARS.4m.fd id_ed25519 id_ed25519.pub; do
+ test -s "$BASE_DIR/$file"
+done
+chmod 0600 "$BASE_DIR/id_ed25519"
+qemu-img check "$BASE_DIR/base.qcow2"
+rm -rf "$BUNDLE_DIR"
+echo "PASS: restored $IMAGE"
diff --git a/tests/midscene/run-omarchy-midscene.sh b/tests/midscene/run-omarchy-midscene.sh
index 57b8283..f381355 100755
--- a/tests/midscene/run-omarchy-midscene.sh
+++ b/tests/midscene/run-omarchy-midscene.sh
@@ -4,8 +4,10 @@ set -euo pipefail
readonly ROOT_DIR="$PWD"
readonly WORK_DIR="$ROOT_DIR/.midscene-omarchy"
readonly HARNESS_DIR="$WORK_DIR/omarchy-iso"
-readonly ISO_PATH="$WORK_DIR/omarchy-4.0.3.iso"
-readonly BASE_DIR="$HARNESS_DIR/test-runs/omarchy-4.0.3"
+# shellcheck source=omarchy-vm.env
+source "$ROOT_DIR/tests/midscene/omarchy-vm.env"
+readonly ISO_PATH="$WORK_DIR/omarchy-${OMARCHY_ISO_VERSION}.iso"
+readonly BASE_DIR="$HARNESS_DIR/test-runs/omarchy-${OMARCHY_ISO_VERSION}"
readonly SSH_KEY="$BASE_DIR/id_ed25519"
readonly SSH_PORT=2222
readonly PLUGIN_DIR="/home/omarchy/.config/omarchy/plugins/md.lifeos.doubao-say"