From 929ce39f093295d44234772c3ec0ce525f94b1a3 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 25 Aug 2026 20:29:24 -0600 Subject: [PATCH] ci: add the reusable Qt Linux build, drop build-slint One workflow_call recipe for every Linux release path: aqt Qt (the runner's own Qt is 6.4 and lacks QtQuick.Effects), Rust stable, no memory tiers, ubuntu-22.04 for the glibc 2.35 floor. Produces the bare binary and a self-contained AppDir (linuxdeploy + Qt plugin, Wayland and offscreen platform plugins added explicitly), then boots the AppDir offscreen with the Qt install removed from the environment and fails on any QML complaint. Dispatchable on its own as the pre-flight. Recipe measured on the 24.04 CI VM 2026-08-25 (contracts in qbz-nix-docs/cicd/2026-08-25-qt-workflows-contracts). cc --- .github/workflows/build-qt-linux.yml | 241 +++++++++++++++++++ .github/workflows/build-slint-selfhosted.yml | 61 ----- .github/workflows/build-slint.yml | 114 --------- 3 files changed, 241 insertions(+), 175 deletions(-) create mode 100644 .github/workflows/build-qt-linux.yml delete mode 100644 .github/workflows/build-slint-selfhosted.yml delete mode 100644 .github/workflows/build-slint.yml diff --git a/.github/workflows/build-qt-linux.yml b/.github/workflows/build-qt-linux.yml new file mode 100644 index 000000000..f177c5611 --- /dev/null +++ b/.github/workflows/build-qt-linux.yml @@ -0,0 +1,241 @@ +# Linux build of the Qt frontend — ONE recipe, reused by every Linux release +# workflow (release-linux, release-linux-aarch64, release-snap, release-flatpak) +# via `workflow_call`, and dispatchable on its own as the pre-flight ("does the +# release recipe still build; publish nothing") — the job build-slint.yml used +# to do. The 2026-07-04 lesson was two copies of the same recipe drifting apart; +# this file exists so there is exactly one. +# +# WHAT CHANGED VS THE SLINT ERA (all measured 2026-08-25, see +# qbz-nix-docs/cicd/2026-08-25-qt-workflows-contracts/): +# * No memory wall. `-p qbz-qt` never pulls the 30 GB `qbz-ui` unit: no swap +# ceremony, no CARGO_BUILD_JOBS=1 / codegen-units=256 / opt-level 2 (those +# were memory tiers and cost runtime performance for nothing now), no +# nightly, no mold, no RUSTFLAGS (any of them re-keys the whole cache). +# * Qt comes from aqt (official binaries), NOT from apt: ubuntu-24.04 ships +# Qt 6.4.2 and has no QtQuick.Effects module at all; the tree needs 6.8. +# * The runner is ubuntu-22.04 (glibc 2.35 floor, asserted below), which is +# also the platform the official Qt binaries are built for. +# * Two outputs per arch: the BARE binary (AUR / Gentoo / Flathub — ecosystems +# with their own Qt >= 6.8) and an AppDir with Qt bundled (deb / rpm / +# AppImage / snap — so Ubuntu 24.04 keeps working). The AppDir is built by +# linuxdeploy + linuxdeploy-plugin-qt and is self-contained (proven by +# running it offscreen with the Qt install removed). +# * The smoke gate runs against THE ARTIFACT THAT SHIPS (the AppDir), not the +# build tree: offscreen boot, zero QML complaints, core initialized. A +# `cargo check` sees nothing of the QML — a missing bridge member compiles +# clean and throws when the user opens the view. +# +# CONTRACT: artifact names are consumed downstream by name. Do not rename. +# qbz-linux- bare binary (stripped by the workspace profile) +# qbz-linux--unstripped symbolication copy (CARGO_PROFILE_RELEASE_STRIP=none) +# qbz-appdir- tar of the self-contained AppDir +# is x86_64 | aarch64. + +name: build-qt-linux + +on: + workflow_call: + inputs: + arch: + description: "x86_64 | aarch64" + required: true + type: string + outputs: + version: + description: "Workspace version from crates/Cargo.toml" + value: ${{ jobs.build.outputs.version }} + workflow_dispatch: + inputs: + arch: + description: "Architecture to pre-flight" + required: true + default: x86_64 + type: choice + options: [x86_64, aarch64] + +# The Qt pin. Repository variables win (set QT_VERSION_LINUX in Settings → +# Variables to bump without a commit); the literal is the measured floor. +# 6.8 is the LTS line and the floor the tree needs once the six macOS-only +# SafeArea/padding lines are guarded (contracts §1 / §4 #0). Keep in sync +# with the same pin in test-crates.yml. +env: + QT_VERSION: ${{ vars.QT_VERSION_LINUX || '6.8.3' }} + +jobs: + build: + name: build (${{ inputs.arch }}) + runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }} + timeout-minutes: 120 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Workspace version + id: version + run: | + V="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + echo "version=$V" >> "$GITHUB_OUTPUT" + echo "workspace version: $V" + + # Build-time deps only. fontconfig / freetype / wayland / xcb / mesa dev + # headers were Slint's direct needs; Qt links its own. The xcb/wayland + # RUNTIME libs are for linuxdeploy-plugin-qt: it resolves libqxcb.so's + # dependencies on the runner and dies on a missing libxkbcommon-x11.so.0 + # (measured). patchelf + file are linuxdeploy's own tools. + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + build-essential pkg-config cmake clang libclang-dev nasm \ + libasound2-dev libjack-jackd2-dev libdbus-1-dev libssl-dev \ + libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev \ + libxkbcommon-x11-0 libxcb-cursor0 libxcb-icccm4 libxcb-image0 \ + libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 \ + libxcb-shape0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxcb-glx0 \ + libwayland-client0 libwayland-egl1 libwayland-cursor0 libegl1 libgl1 \ + patchelf file binutils + + # Official Qt binaries. `qtshadertools` brings `qsb`; the committed .qsb + # files make it optional for the build (build.rs warns), but the + # re-bake keeps shaders honest against the pinned Qt. The arm64 host + # exists in aqt from 6.7 — the first aarch64 dispatch is the proof. + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + host: ${{ inputs.arch == 'aarch64' && 'linux_arm64' || 'linux' }} + target: desktop + arch: ${{ inputs.arch == 'aarch64' && 'linux_gcc_arm64' || 'linux_gcc_64' }} + modules: qtshadertools + cache: true + + - name: Setup Rust (stable) + uses: dtolnay/rust-toolchain@stable + + # Cache key split by toolchain/profile and NEVER shared with the old + # `slint-*` keys. Main-branch caches serve tag runs; pre-release + # pre-flights only serve themselves (Actions cache scoping). + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: crates -> target + shared-key: qt-linux-${{ inputs.arch }} + cache-on-failure: true + save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-release' }} + + # NEVER `-p qbz`: crates/qbz (the frozen Slint binary) declares the same + # bin name in the same target dir and would silently win the file. + - name: Build (release) + env: + CARGO_INCREMENTAL: "0" + # Keep symbols in this build: the unstripped copy is archived for + # crash symbolication, then stripped for every shipped artifact. + CARGO_PROFILE_RELEASE_STRIP: "none" + run: | + cargo build --release --manifest-path crates/Cargo.toml -p qbz-qt + cp crates/target/release/qbz qbz-unstripped + strip -o qbz crates/target/release/qbz + ls -la qbz qbz-unstripped + + - name: Slint-free dep-graph gate (qbz-qt) + run: | + set -euo pipefail + hits=$(cargo tree --manifest-path crates/Cargo.toml -p qbz-qt -e normal \ + | grep -E '\b(slint|qbz-ui|qbz-slint-common|qbz-dac-wizard) v' || true) + [ -z "$hits" ] || { echo "::error::qbz-qt graph resolves Slint crates:"; echo "$hits"; exit 1; } + + # The empirical-verification rule: the README/website say what objdump + # says, not what the runner image advertises. + - name: glibc floor gate (<= 2.35) + run: | + set -euo pipefail + floor=$(objdump -T qbz | grep -oE 'GLIBC_[0-9]+\.[0-9]+' | sort -Vu | tail -1) + echo "glibc floor: $floor" + highest=$(printf '%s\n' "$floor" "GLIBC_2.35" | sort -V | tail -1) + [ "$highest" = "GLIBC_2.35" ] || { echo "::error::glibc floor $floor exceeds 2.35"; exit 1; } + + # Self-contained AppDir. The plugin scans QML_SOURCES_PATHS for imports + # and copies exactly the Qt QML modules the app uses (Effects, labs, + # Controls, ...) plus the platform plugins — but xcb ONLY unless told + # otherwise: Wayland needs both EXTRA_PLATFORM_PLUGINS and + # EXTRA_QT_MODULES=waylandcompositor (libQt6WaylandClient + the + # wayland-* plugin dirs). offscreen is what the smoke below runs on. + # It writes usr/bin/qt.conf and patches RPATH to $ORIGIN/../lib, which + # is why the tree works from any install prefix with no env at all. + - name: Build AppDir (linuxdeploy + Qt plugin) + env: + QMAKE: ${{ env.QT_ROOT_DIR }}/bin/qmake + QML_SOURCES_PATHS: ${{ github.workspace }}/crates/qbz-qt/qml + EXTRA_PLATFORM_PLUGINS: "libqoffscreen.so;libqwayland-generic.so;libqwayland-egl.so" + EXTRA_QT_MODULES: waylandcompositor + LD_LIBRARY_PATH: ${{ env.QT_ROOT_DIR }}/lib + ARCH_TAG: ${{ inputs.arch }} + run: | + set -euo pipefail + curl -fsSL -o linuxdeploy \ + "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${ARCH_TAG}.AppImage" + curl -fsSL -o linuxdeploy-plugin-qt \ + "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${ARCH_TAG}.AppImage" + chmod +x linuxdeploy linuxdeploy-plugin-qt + cp packaging/linux/qbz.desktop qbz.desktop + cp packaging/icons/256x256.png qbz.png + ./linuxdeploy --appimage-extract-and-run --appdir AppDir \ + -e qbz -d qbz.desktop -i qbz.png --plugin qt + # Nothing in the app uses Qt SQL / network-information plugins. + rm -rf AppDir/usr/plugins/sqldrivers AppDir/usr/plugins/networkinformation + echo "platforms: $(ls AppDir/usr/plugins/platforms | tr '\n' ' ')" + test -f AppDir/usr/plugins/platforms/libqwayland-generic.so + test -f AppDir/usr/plugins/platforms/libqoffscreen.so + test -f AppDir/usr/qml/QtQuick/Effects/libeffectsplugin.so + test -f AppDir/usr/bin/qt.conf + du -sh AppDir + + # THE gate. Runs the AppDir with the Qt install removed from the + # environment so a missing plugin/module cannot be masked by the build + # box. Pass = the app booted (>= 10 log lines), reached core init, and + # the QML engine logged no complaint. `home published` is NOT required: + # it needs a logged-in session and CI has none — the boot stops at the + # login screen, which is the point this gate proves reachable. + - name: Offscreen smoke (the AppDir that ships) + run: | + set -uo pipefail + env -u LD_LIBRARY_PATH -u QT_PLUGIN_PATH -u QML_IMPORT_PATH -u QML2_IMPORT_PATH \ + QT_QPA_PLATFORM=offscreen RUST_LOG=info \ + timeout 60 ./AppDir/AppRun > smoke.log 2>&1 || true + lines=$(wc -l < smoke.log) + echo "smoke log: $lines lines" + if (( lines < 10 )); then cat smoke.log; echo "::error::the app did not start"; exit 1; fi + errs=$(grep -av 'propertyCache' smoke.log \ + | grep -aciE 'is not a type|unavailable|ReferenceError|TypeError|Cannot read|Unable to assign|Cannot open|no such method|non-existent property|failed to load component|is not installed' || true) + if (( errs > 0 )); then + grep -av 'propertyCache' smoke.log | grep -aiE 'is not a type|unavailable|ReferenceError|TypeError|Cannot read|Unable to assign|Cannot open|no such method|non-existent property|failed to load component|is not installed' | head -20 + echo "::error::$errs QML complaint(s) in the smoke log"; exit 1 + fi + grep -aq 'QbzCore initialized' smoke.log || { tail -20 smoke.log; echo "::error::never reached QbzCore init"; exit 1; } + echo "smoke OK (0 QML complaints, core initialized)" + + - name: Upload bare binary + uses: actions/upload-artifact@v7 + with: + name: qbz-linux-${{ inputs.arch }} + path: qbz + if-no-files-found: error + + - name: Upload unstripped binary (symbolication) + uses: actions/upload-artifact@v7 + with: + name: qbz-linux-${{ inputs.arch }}-unstripped + path: qbz-unstripped + retention-days: 90 + + # tar keeps the symlinks (AppRun, .DirIcon) and the exec bits that + # upload-artifact's zip would drop. + - name: Upload AppDir + run: tar -cf appdir.tar AppDir + - uses: actions/upload-artifact@v7 + with: + name: qbz-appdir-${{ inputs.arch }} + path: appdir.tar + if-no-files-found: error diff --git a/.github/workflows/build-slint-selfhosted.yml b/.github/workflows/build-slint-selfhosted.yml deleted file mode 100644 index 045b1166a..000000000 --- a/.github/workflows/build-slint-selfhosted.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Build Slint (self-hosted) - -# Builds qbz-slint on the self-hosted runner registered on the dev box -# (`qbz-box`, labels: self-hosted,linux,x64,qbz-builder). The box CAN compile -# qbz-slint (proven locally), so this is the reliable path to a real CI/CD -# artifact while the GitHub-hosted private runner (2 vCPU / 8 GB) cannot. -# -# Self-hosted runners keep their work directory between runs, so `target/` -# persists → builds are INCREMENTAL after the first (no `actions/cache` needed). -# -# MANUAL trigger only (workflow_dispatch): the box shares RAM with the desktop -# and earlyoom will SIGTERM the build if RAM runs low. Trigger this when the box -# is free (close heavy apps / TTY), and do NOT run a local build at the same -# time (one heavy build at a time — the box hard-freezes on double-build OOM). - -on: - workflow_dispatch: - -concurrency: - group: selfhosted-slint - cancel-in-progress: true - -jobs: - build: - runs-on: [self-hosted, qbz-builder] - timeout-minutes: 180 - steps: - - uses: actions/checkout@v7 - - - name: Free RAM check (earlyoom will kill the build if too low) - run: | - free -h | head -2 - avail=$(free -m | awk '/^Mem:/ {print $7}') - echo "MemAvailable: ${avail} MB" - if [ "${avail}" -lt 16000 ]; then - echo "::warning::Only ${avail} MB free — earlyoom may SIGTERM the qbz-slint rustc. Close apps / drop to TTY for headroom." - fi - - # Desktop-proof recipe, root-caused 2026-07-04 (ftrace): earlyoom's - # RAM-only trigger SIGTERM'd rustc whenever global MemAvailable dipped - # to ~3 GB — the cap margin, not the settings, was the bug. With - # slint-run.sh anchoring memory.high at avail-9G, this exact recipe - # (threads=2, cgu=256, opt=3, capped) completed with a 5.7 GB global - # floor and zero signals while the desktop ran. Same flags as the - # distribution profile → the runner cache stays warm between runs. - - name: Build qbz-slint (desktop-proof — capped, threads=2, opt-3) - run: NORUN=1 CAPPED=1 THREADS=2 CODEGEN_UNITS=256 OPT=3 ./scripts/slint-run.sh - - - name: Strip + report size - run: | - BIN=crates/target/release/qbz - echo "unstripped:"; ls -lh "$BIN" | awk '{print $5}' - cp "$BIN" qbz-linux-x86_64 - strip qbz-linux-x86_64 || true - echo "stripped:"; ls -lh qbz-linux-x86_64 | awk '{print $5}' - - - uses: actions/upload-artifact@v7 - with: - name: qbz-linux-x86_64 - path: qbz-linux-x86_64 - if-no-files-found: error diff --git a/.github/workflows/build-slint.yml b/.github/workflows/build-slint.yml deleted file mode 100644 index 25f147991..000000000 --- a/.github/workflows/build-slint.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Build Slint (linux) - -# Builds the Slint app on a stock GitHub-hosted runner. The wall is the qbz_ui -# rustc (the generated Slint UI = ONE ~1.6M-line module): its peak memory DEMAND -# is ~30 GB (measured RSS+Swap, 2026-06) and it is FRONTEND-bound — codegen knobs -# (codegen-units, opt-level, CARGO_BUILD_JOBS, -Z threads) barely move it (jobs=1 -# only shaved ~3 GB vs cargo defaults). So the build is NOT made to fit by tuning; -# it is made to fit by giving it enough RAM+SWAP to hold ~30 GB. A stock -# `ubuntu-24.04` runner has ~16 GB RAM, so this job adds a large swapfile so -# RAM(16) + swap(~4 base + 18) ≈ 38 GB comfortably exceeds the ~30 GB demand: the -# resident working set stays near RAM size while cold pages page out (slow but it -# completes). The MIN-tier rustc env below keeps the resident set as low as -# possible. rust-cache (added below) makes this heavy compile happen ONCE per -# qbz_ui change, not on every push — that, not the peak, is the minute saver. -# Build-only for now (no signing/bundling). - -on: - # Manual trigger ONLY (pick the ref in the Actions UI). Repo policy: public - # workflows fire on release tags, never on plain pushes — a push to main IS - # a release merge, and the tag that follows immediately fires the real - # release builds, so an auto-build here would just double-burn ~2h of - # runner time for nothing. - workflow_dispatch: - -# A new push to slint-mvp cancels the older in-flight build — only the latest -# commit matters, and stacked ~20-min builds are the main minute-burn. -concurrency: - group: build-slint-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-24.04 - timeout-minutes: 180 - steps: - - uses: actions/checkout@v7 - - - name: Free disk + swap - run: | - echo "::group::before"; df -h /; free -h; echo "::endgroup::" - # On ubuntu-24.04 there is no separate large /mnt disk — everything is - # on the 72 GB root (~16 GB free after the image). Reclaim the big - # preinstalled toolchains we don't need (~25-30 GB) so the cargo target - # fits, then add a modest swap cushion for the qbz-slint rustc peak. - sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \ - /opt/hostedtoolcache /usr/local/share/boost /usr/share/swift \ - /usr/local/lib/node_modules || true - sudo docker image prune --all --force || true - # The runner ships an active /swapfile (~4 GB); add a LARGE extra swap - # so RAM(16) + swap(~4 + 18) ≈ 38 GB holds the measured ~30 GB qbz_ui - # demand (frontend-bound; not tunable away). 8 GB was NOT enough - # (16+4+8 ≈ 28 GB < 30 GB → OOM risk). Guarded so a swap hiccup never - # fails the job. - ( sudo fallocate -l 18G /swap_extra \ - && sudo chmod 600 /swap_extra \ - && sudo mkswap /swap_extra \ - && sudo swapon /swap_extra ) || echo "extra swap skipped (non-fatal)" - echo "::group::after"; df -h /; free -h; echo "::endgroup::" - - - name: System dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - build-essential pkg-config cmake clang libclang-dev mold nasm \ - libasound2-dev libjack-jackd2-dev \ - libfontconfig1-dev libfreetype-dev \ - libxkbcommon-dev libwayland-dev libxcb1-dev \ - libgl1-mesa-dev libegl1-mesa-dev \ - libdbus-1-dev libssl-dev \ - libharfbuzz-dev libjbig2dec0-dev libopenjp2-7-dev \ - libjpeg-dev zlib1g-dev libgumbo-dev - - - name: Rust toolchain (pinned dated nightly — build uses -Z threads) - # Pinned (not floating @nightly) so rustc -V is byte-stable across runs: - # rust-cache embeds the rustc version in its key, and a floating nightly - # re-keys the cache + invalidates every Cargo fingerprint daily (the - # from-scratch-every-run waste). Bump this date deliberately when a newer - # nightly feature is actually needed. - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2026-06-23 - - - name: Cargo cache (Swatinem/rust-cache) - # THE biggest minute-saver: caches ~/.cargo + crates/target so a push - # that only touches controllers restores the prebuilt qbz-ui rlib (the - # ~20 GB / ~20-min compilation unit) instead of recompiling it; only the - # cheap qbz bin then rebuilds + links. `workspaces` MUST point at crates/ - # (manifest is crates/Cargo.toml, artifacts land in crates/target — not - # the default `. -> target`). save-if gates cache WRITES to slint-mvp so - # dispatch/PR runs read but don't churn the 10 GB Actions cache budget. - uses: Swatinem/rust-cache@v2 - with: - workspaces: crates -> target - shared-key: slint-linux - cache-on-failure: true - save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/slint-mvp' }} - - - name: Build qbz-slint (memory-tuned, MIN tier) - env: - CARGO_INCREMENTAL: '0' - CARGO_BUILD_JOBS: '1' - CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '256' - CARGO_PROFILE_RELEASE_OPT_LEVEL: '2' - RUSTFLAGS: '-C link-arg=-fuse-ld=mold -Z threads=1' - run: | - cargo build --release --manifest-path crates/Cargo.toml -p qbz - echo "::group::result"; ls -lh crates/target/release/qbz; df -h /; free -h; echo "::endgroup::" - - - name: Upload binary - uses: actions/upload-artifact@v7 - with: - name: qbz-linux-x86_64 - path: crates/target/release/qbz - if-no-files-found: error