Skip to content

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223 #2384

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223

Desktop on Windows: a closed approval prompt says approval, and is told by exit code 1223 #2384

Workflow file for this run

name: Desktop
# The shell is the one thing here that cannot be proved by running it on Linux: it is a macOS app, a
# Windows app and a Linux app built from one tree, and the ways they differ are exactly the ways
# this fails. So it tests and builds on all three, on every change to it.
# `shared/harnesses.json` and `shared/marks/**` are watched here even though they are not under
# desktop/: the catalogue the setup window draws moved there so the web app could read one copy, and
# these jobs are the only ones that prove it still deserializes into `Harness` — `catalogue()` parses
# it at runtime with an `expect`, so a bad row panics the window rather than failing a type check.
on:
pull_request:
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml", "!**/*.md"]
push:
branches: [main]
paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml", "!**/*.md"]
workflow_call:
permissions:
contents: read
# As in CI: a pull request's newer push cancels the run before it; every commit on main keeps its own
# run; a call of this workflow stays out of its caller's group and is never cancelled; and pull
# requests from forks share one group, one run at a time.
concurrency:
group: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && 'desktop-forks' || format('desktop-{0}-{1}', github.workflow, github.ref == 'refs/heads/main' && github.sha || github.ref) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
# Match the source publisher's exact repository/distribution identity in official and fork builds.
env:
OPENBOT_DISTRIBUTION_ID: ${{ vars.OPENBOT_DISTRIBUTION_ID || github.repository }}
OPENBOT_RELEASE_REPOSITORY: ${{ github.repository }}
OPENBOT_RELEASE_CHANNEL: ${{ vars.OPENBOT_RELEASE_CHANNEL || 'stable' }}
jobs:
# What this push has to run (scripts/ci-changes.ts), as in CI: on a pull request, a job whose
# inputs are unchanged since a commit where it passed is skipped. The setup window's own tests run
# in CI's suite, so a change to them alone builds no app here, and neither does a release PR that
# moves only the versions. Any other event builds everything.
changes:
name: changes
# A standard runner: it reads the API for a few seconds, and every other job waits on it,
# so it must not queue behind the 16-core pool's backlog.
runs-on: ubuntu-latest
timeout-minutes: 5 # usually under half a minute
permissions:
contents: read
# To read which jobs passed on earlier commits, and to cancel this run at its first failure
# (.github/actions/stop-on-failure).
actions: write
outputs:
core: ${{ steps.decide.outputs.core }}
app: ${{ steps.decide.outputs.app }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Strings, since 0 is falsy and `&& 0 || 1` would always give 1.
fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }}
filter: ${{ github.event_name == 'pull_request' && 'blob:none' || '' }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.3
- id: decide
name: Decide what runs
env:
GH_TOKEN: ${{ github.token }}
run: bun scripts/ci-changes.ts desktop
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
# Fast formatting and lint checks. Rust regression tests run once per platform below.
core:
name: core
needs: changes
if: needs.changes.outputs.core == 'true'
# Clippy over the whole crate is CPU-bound: the 16-core larger runner, except for forks.
# A standard runner: about 1.2 minutes from the Rust cache on either (scripts/ci-runners.test.ts).
runs-on: ubuntu-latest
timeout-minutes: 30 # usually about a minute from the Rust cache; a cold clippy takes longer
permissions:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: desktop/src-tauri
# Linux is the only target needing system libraries, and it needs them even to check. They
# install from the .deb files an earlier run kept (install-linux-build-deps.sh), keyed by the
# runner image, whose package lists say which versions install.
- name: Name the runner image
id: image
run: echo "image=${ImageOS:-unknown}-${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"
- name: Cache the Linux system libraries
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/apt-archives
key: desktop-apt-${{ runner.arch }}-${{ steps.image.outputs.image }}-${{ hashFiles('desktop/scripts/install-linux-build-deps.sh') }}
- name: Install the Linux system libraries
run: bash desktop/scripts/install-linux-build-deps.sh "$RUNNER_TEMP/apt-archives"
- run: cargo fmt --check
working-directory: desktop/src-tauri
- run: cargo clippy --all-targets -- -D warnings
working-directory: desktop/src-tauri
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
# The Rust regression tests that need a real container engine, on the Linux runner's Docker (the
# others have none). They run beside the app builds rather than after the Linux one, where they
# were seven of its thirteen minutes, and in two halves so that neither outlasts the builds: the
# image download alone takes four. They test the Rust, not the installer, so they build only the
# tests. Run with `--test-threads=1`: each one's lab holds the runner's Docker to itself.
live:
name: live (${{ matrix.suite }})
needs: changes
if: needs.changes.outputs.app == 'true'
runs-on: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && 'ubuntu-latest' || 'openbot-ubuntu-16core' }}
timeout-minutes: 30 # usually about 6 minutes
permissions:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
strategy:
fail-fast: false
matrix:
suite: [images, engines]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: desktop/src-tauri
shared-key: desktop-live
- name: Name the runner image
id: image
run: echo "image=${ImageOS:-unknown}-${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"
- name: Cache the Linux system libraries
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/apt-archives
key: desktop-apt-${{ runner.arch }}-${{ steps.image.outputs.image }}-${{ hashFiles('desktop/scripts/install-linux-build-deps.sh') }}
- name: Install the Linux system libraries
run: bash desktop/scripts/install-linux-build-deps.sh "$RUNNER_TEMP/apt-archives"
- name: Build the tests
run: cargo test --locked --lib --no-run
working-directory: desktop/src-tauri
# The back end's image download against a real containerd: the k3s node the CLI creates, a
# registry and a throttling proxy, on the runner's Docker.
- name: Back end image download regression tests
if: matrix.suite == 'images'
run: cargo test --locked --lib local_images::live -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# An announced release's images downloaded while the version that runs stays up, against the
# same node, registry and proxy, with Docker as OpenBot's engine: the update afterwards
# downloads nothing, and a disk short of room downloads nothing at all.
- name: Update download ahead regression tests
if: matrix.suite == 'engines'
run: cargo test --locked --lib update_ready::live -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# The AI connection changed in the app, on the runner's Docker with this tree's Compose file:
# a plan's engine starts alone and stops alone, the picked Bot restarts alone, and the
# database never stops.
- name: AI connection change regression tests
if: matrix.suite == 'engines'
run: cargo test --locked --lib ai_connection::tests::real_engine -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# OpenBot's machine on Windows shares one network namespace with every WSL distro, so a
# stopped machine's port rules outlive it. Reproduced on real netavark, both generations
# Podman runs on WSL, in a privileged lab on the runner's Docker, then cleared.
- name: Stale port rule regression tests
if: matrix.suite == 'engines'
run: cargo test --locked --lib netavark_rules::live -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# A backend node pruned while it was stopped, on the runner's Docker: a k3d-shaped node, its
# network, image volume and tools container, stopped and pruned, then found gone.
- name: Pruned backend node regression tests
if: matrix.suite == 'engines'
run: cargo test --locked --lib local_eval::stack_lost_live::engine -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# The folder sandbox on the runner's Docker: what a Bot is told when its command fails, runs
# too long or out of memory, or cannot start, for each way that happens.
- name: Folder sandbox answer regression tests
if: matrix.suite == 'engines'
run: cargo test --locked --lib host_access::live -- --ignored --test-threads=1
working-directory: desktop/src-tauri
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
# The three artifacts, built by the shared workflow. A pull request build is unchanged: unpinned, no CLI, kept 7 days.
app:
name: app
needs: changes
if: needs.changes.outputs.app == 'true'
uses: $/.github/workflows/desktop-build.yml
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
channel: internal
bundle_cli: false
manifest_artifact: ""
retention_days: 7
platforms: '["macos","windows","linux"]'