ci: rewrite release-macos with aqt Qt and macdeployqt
The Slint workflow copied the bare Mach-O into the bundle; a Qt binary is not self-contained. Now: universal aqt Qt (Homebrew's split layout breaks macdeployqt with rpath errors), MACOSX_DEPLOYMENT_TARGET 12.0, the arm_acle.h include for Qt 6.9's qyieldcpu.h on Apple clang 21, macdeployqt -qmldir, then an offscreen boot of the bundle with the Qt install hidden before signing and packing. Intel builds move to macos-15-intel. Measured on the Mac mini M2 2026-08-25. cc
This commit is contained in:
1 file changed
+124
-41
@@ -1,16 +1,26 @@
|
||||
# macOS release — Slint binary (crates/ workspace).
|
||||
# macOS release — Qt frontend (crates/ workspace, package `qbz-qt`, binary `qbz`).
|
||||
#
|
||||
# Rewritten 2026-07-02 for the Tauri -> Slint migration (v2.0). Builds the
|
||||
# qbz binary per target, assembles a minimal QBZ.app bundle (Info.plist +
|
||||
# icns + binary), ad-hoc signs it (same trust level as the unsigned Tauri
|
||||
# builds), and packs a dmg with hdiutil. No Tauri updater: the .app.tar.gz
|
||||
# + .sig updater assets are gone, dmg is the distribution.
|
||||
# Rewritten 2026-08-25 for the Slint -> Qt frontend switch. Recipe measured on
|
||||
# the Mac mini M2 (qbz-nix-docs/cicd/2026-08-25-qt-workflows-contracts/ V5b):
|
||||
# * Qt from aqt (official, UNIVERSAL frameworks, min macOS 12) — NOT Homebrew:
|
||||
# Homebrew splits Qt across formulae and macdeployqt cannot resolve
|
||||
# @rpath/QtQml.framework in that layout (600 rpath errors, the .app dies
|
||||
# with "no Qt platform plugin"). Homebrew bottles also target the runner's
|
||||
# own macOS and would silently raise LSMinimumSystemVersion.
|
||||
# * `macdeployqt -qmldir` is MANDATORY: a Qt binary is not self-contained.
|
||||
# The Slint workflow copied the bare Mach-O into Contents/MacOS; a Qt
|
||||
# .app assembled that way dies on launch on every machine that is not
|
||||
# the build box.
|
||||
# * CXXFLAGS=-include arm_acle.h (arm64 only): Qt 6.9.x's qyieldcpu.h calls
|
||||
# __yield() without <arm_acle.h>; Apple clang 21 makes it a hard error.
|
||||
# Harmless where the compiler does not care. Drop when the pin has the fix.
|
||||
# * MACOSX_DEPLOYMENT_TARGET=12.0 -> `minos 12.0` in the Mach-O (rustc's
|
||||
# default is 11.0, cc-rs otherwise picks the host SDK).
|
||||
# * The smoke gate runs the BUNDLE offscreen with the Qt install removed.
|
||||
#
|
||||
# MEMORY NOTE: hosted macOS runners have ~7 GB RAM; the qbz_ui rustc peaks
|
||||
# ~30 GB on Linux. macOS swaps dynamically to SSD so the build may survive
|
||||
# (slowly) — if it proves unreliable, point runs-on at a self-hosted runner
|
||||
# on the M2 Mini instead. continue-on-error keeps a mac failure from
|
||||
# blocking the Linux release.
|
||||
# macOS pins 6.9 (not the Linux 6.8 LTS): the traffic-lights fix uses
|
||||
# Window paddings + SafeArea (Qt 6.9), and Qt is always bundled here so a
|
||||
# higher floor costs no reach. `vars.QT_VERSION_MACOS` overrides.
|
||||
|
||||
name: release-macos
|
||||
|
||||
@@ -18,7 +28,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Optional release tag to build (e.g. v2.0.0). Empty = build HEAD with the Cargo.toml version, no Release publish."
|
||||
description: "Optional release tag to build (e.g. v2.1.0). Empty = build HEAD with the Cargo.toml version, no Release publish."
|
||||
required: false
|
||||
type: string
|
||||
push:
|
||||
@@ -29,20 +39,31 @@ concurrency:
|
||||
group: release-macos-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
QT_VERSION: ${{ vars.QT_VERSION_MACOS || '6.9.3' }}
|
||||
|
||||
jobs:
|
||||
build-macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-apple-darwin
|
||||
runner: macos-latest
|
||||
artifact: qbz-macos-aarch64
|
||||
arch: aarch64
|
||||
# See header: Qt 6.9 header bug on Apple clang 21 (arm64 code path).
|
||||
cxxflags: "-include arm_acle.h"
|
||||
- target: x86_64-apple-darwin
|
||||
# macos-latest is arm64; Intel needs an Intel runner (arm_acle.h
|
||||
# is ARM-only, so no CXXFLAGS here).
|
||||
runner: macos-15-intel
|
||||
artifact: qbz-macos-x86_64
|
||||
# Historical dmg naming: intel assets ship as "x64".
|
||||
arch: x64
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 360
|
||||
cxxflags: ""
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 120
|
||||
continue-on-error: true
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -91,35 +112,48 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Same pinned nightly as the Linux builders (-Z threads support,
|
||||
# consistent measured behavior). Bump all release workflows together.
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
- name: Install Qt ${{ env.QT_VERSION }} (universal)
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ env.QT_VERSION }}
|
||||
host: mac
|
||||
target: desktop
|
||||
arch: clang_64
|
||||
modules: qtshadertools
|
||||
cache: true
|
||||
|
||||
- name: Setup Rust (stable)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: nightly-2026-06-23
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: crates -> target
|
||||
shared-key: slint-macos-${{ matrix.target }}
|
||||
shared-key: qt-macos-${{ matrix.target }}
|
||||
cache-on-failure: true
|
||||
save-if: true
|
||||
save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-release' }}
|
||||
|
||||
# MIN memory tier — the 7 GB hosted runner relies on macOS dynamic
|
||||
# swap for the qbz_ui rustc peak. Binary is stripped by the workspace
|
||||
# profile (strip = "symbols"), which rustc applies correctly to Mach-O.
|
||||
- name: Build (release, MIN memory tier)
|
||||
# NEVER `-p qbz` (the frozen Slint binary shares the bin name).
|
||||
- name: Build (release)
|
||||
env:
|
||||
CARGO_INCREMENTAL: "0"
|
||||
CARGO_BUILD_JOBS: "1"
|
||||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "256"
|
||||
CARGO_PROFILE_RELEASE_OPT_LEVEL: "2"
|
||||
RUSTFLAGS: "-Z threads=1"
|
||||
CMAKE_PREFIX_PATH: ${{ env.QT_ROOT_DIR }}
|
||||
QMAKE: ${{ env.QT_ROOT_DIR }}/bin/qmake
|
||||
CXXFLAGS: ${{ matrix.cxxflags }}
|
||||
MACOSX_DEPLOYMENT_TARGET: "12.0"
|
||||
run: |
|
||||
cargo build --release --manifest-path crates/Cargo.toml \
|
||||
-p qbz --target ${{ matrix.target }}
|
||||
-p qbz-qt --target ${{ matrix.target }}
|
||||
otool -l "crates/target/${{ matrix.target }}/release/qbz" | grep -A4 LC_BUILD_VERSION | grep minos
|
||||
|
||||
- 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; }
|
||||
|
||||
- name: Assemble QBZ.app
|
||||
env:
|
||||
@@ -144,7 +178,7 @@ jobs:
|
||||
<key>CFBundleIconFile</key><string>icon</string>
|
||||
<key>CFBundleShortVersionString</key><string>${VERSION}</string>
|
||||
<key>CFBundleVersion</key><string>${VERSION}</string>
|
||||
<key>LSMinimumSystemVersion</key><string>11.0</string>
|
||||
<key>LSMinimumSystemVersion</key><string>12.0</string>
|
||||
<key>NSHighResolutionCapable</key><true/>
|
||||
<key>LSApplicationCategoryType</key><string>public.app-category.music</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
|
||||
@@ -159,10 +193,61 @@ jobs:
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
# Ad-hoc signature: required for arm64 Macs to launch at all;
|
||||
# matches the trust level of the previous unsigned Tauri builds.
|
||||
codesign --force --deep -s - "$APP"
|
||||
codesign --verify --verbose "$APP"
|
||||
|
||||
# Bundle the Qt frameworks, the cocoa platform plugin and the QML
|
||||
# modules the app imports (Effects, labs.qmlmodels, Controls, ...).
|
||||
# Measured: 21 s, ~225 MB. The optional sqldrivers plugins (iodbc,
|
||||
# mimer, libpq) are the only deploy "errors" and nothing uses Qt SQL.
|
||||
- name: macdeployqt
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APP="dist/QBZ.app"
|
||||
"$QT_ROOT_DIR/bin/macdeployqt" "$APP" -qmldir=crates/qbz-qt/qml -verbose=1 2>&1 | tee macdeploy.log | grep -E 'ERROR' || true
|
||||
rm -rf "$APP/Contents/PlugIns/sqldrivers"
|
||||
test -f "$APP/Contents/PlugIns/platforms/libqcocoa.dylib"
|
||||
test -d "$APP/Contents/Resources/qml/QtQuick/Effects"
|
||||
test -f "$APP/Contents/Resources/qt.conf"
|
||||
# Every Qt reference must now be bundle-relative.
|
||||
if otool -L "$APP/Contents/MacOS/qbz" | grep -E 'Qt.*\.framework' | grep -vq '@executable_path'; then
|
||||
otool -L "$APP/Contents/MacOS/qbz"; echo "::error::binary still links Qt outside the bundle"; exit 1
|
||||
fi
|
||||
# offscreen platform plugin: only for the smoke below (macdeployqt
|
||||
# deploys cocoa alone). Removed again before signing/packing.
|
||||
cp "$QT_ROOT_DIR/plugins/platforms/libqoffscreen.dylib" "$APP/Contents/PlugIns/platforms/"
|
||||
du -sh "$APP"
|
||||
|
||||
# THE gate: the bundle boots without the Qt install. Pass = >= 10 log
|
||||
# lines, zero QML complaints, core initialized (login screen reached;
|
||||
# `home published` needs a session CI does not have).
|
||||
- name: Offscreen smoke (the bundle that ships)
|
||||
run: |
|
||||
set -uo pipefail
|
||||
APP="dist/QBZ.app"
|
||||
mv "$QT_ROOT_DIR" "${QT_ROOT_DIR}.hidden"
|
||||
( env -u DYLD_LIBRARY_PATH -u DYLD_FRAMEWORK_PATH -u QT_PLUGIN_PATH -u QML_IMPORT_PATH -u QML2_IMPORT_PATH \
|
||||
QT_QPA_PLATFORM=offscreen RUST_LOG=info "$APP/Contents/MacOS/qbz" > smoke.log 2>&1 & echo $! > smoke.pid )
|
||||
sleep 45; kill "$(cat smoke.pid)" 2>/dev/null || true; sleep 1
|
||||
mv "${QT_ROOT_DIR}.hidden" "$QT_ROOT_DIR"
|
||||
lines=$(wc -l < smoke.log | tr -d ' ')
|
||||
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|Library not loaded|dyld' || 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|Library not loaded|dyld' | head -20
|
||||
echo "::error::$errs QML/loader 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; }
|
||||
rm -f "$APP/Contents/PlugIns/platforms/libqoffscreen.dylib"
|
||||
echo "smoke OK (0 QML complaints, core initialized)"
|
||||
|
||||
# Ad-hoc signature: required for arm64 Macs to launch at all. AFTER
|
||||
# macdeployqt (it rewrites install names) and after the smoke plugin
|
||||
# is gone, so the seal matches what ships.
|
||||
- name: Sign
|
||||
run: |
|
||||
codesign --force --deep -s - "dist/QBZ.app"
|
||||
codesign --verify --verbose "dist/QBZ.app"
|
||||
|
||||
- name: Build dmg
|
||||
env:
|
||||
@@ -174,10 +259,9 @@ jobs:
|
||||
ls -la dist
|
||||
|
||||
# Tauri-updater bridge: v1.2.x installs poll latest.json and verify
|
||||
# with the Tauri minisign pubkey baked into the old binaries. The
|
||||
# updater expects QBZ_${ARCH}.app.tar.gz — keep producing it, signed
|
||||
# with the SAME key, so old installs update straight into the Slint
|
||||
# .app. release-updater-manifest.yml collects the .sig files.
|
||||
# with the Tauri minisign pubkey baked into the old binaries. Keep
|
||||
# producing QBZ_${ARCH}.app.tar.gz signed with the SAME key so old
|
||||
# installs update straight into this .app.
|
||||
- name: Package .app.tar.gz + sign (Tauri-updater bridge)
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
@@ -201,8 +285,7 @@ jobs:
|
||||
dist/*.app.tar.gz
|
||||
dist/*.app.tar.gz.sig
|
||||
|
||||
# Attaches to the Release created by release-linux.yml; same
|
||||
# prerelease logic (the old workflow hardcoded prerelease: true).
|
||||
# Attaches to the Release created by release-linux.yml.
|
||||
- name: Publish GitHub Release Assets
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: softprops/action-gh-release@v3
|
||||
|
||||
Reference in new issue
Block a user