From b04b41f26ac0503927a929df05699168048f6f3f Mon Sep 17 00:00:00 2001 From: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:45:07 -0300 Subject: [PATCH 1/2] ci: build and smoke-test BetterXen.app on native ARM64 runners (#248) The CI workflow built and inspected the CLI but never ran scripts/build-app.sh, so a Swift compile, link or smoke failure in app/ passed CI. - ci.yml: a second job, "Native app build and smoke", on the same macos-26 image, pinned Rust toolchain and CARGO_BUILD_JOBS as the Rust job. It verifies an arm64 host without Rosetta, prints the Xcode and Swift versions and runs scripts/build-app.sh. The Rust job is unchanged. - build-app.sh: after the lipo check, print file and otool -L for the executable and fail if it links anything outside /System/Library/ and /usr/lib/. No Metal fixture runs in the new job; --smoke probes the C interface and the trusted fixture's headers only. The same change was proposed upstream as XenoraOSS/Xenora#426. Signed-off-by: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ CHANGELOG.md | 1 + scripts/build-app.sh | 10 ++++++++++ 3 files changed, 41 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7f1b65..ddc37a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,3 +90,33 @@ jobs: file "$binary" test "$(lipo -archs "$binary")" = arm64 otool -L "$binary" + + native-app: + name: Native app build and smoke + runs-on: macos-26 + timeout-minutes: 20 + env: + CARGO_BUILD_JOBS: 3 + RUSTUP_TOOLCHAIN: 1.100.0-aarch64-apple-darwin + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Verify runner architecture + run: | + uname -m + test "$(uname -m)" = arm64 + test "$(sysctl -n sysctl.proc_translated)" = 0 + - name: Install native Rust + run: | + rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal + rustc -vV + - name: Show Swift and Xcode + run: | + xcodebuild -version + swift --version + # Builds the locked C ABI library and the Swift app together, checks the + # executable is arm64-only and links only system libraries, and runs + # `--smoke`. This is an app build and smoke result, not GPU verification. + - name: Build BetterXen.app and run its smoke check + run: scripts/build-app.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index af426af..e4a22aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ remains unsupported. - Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status. ### Added +- Added a `Native app build and smoke` CI job (#248). On the same native `macos-26` runner image and pinned Rust toolchain as the Rust checks, it runs `scripts/build-app.sh`, which builds the locked C ABI library and the Swift app together, bundles and ad-hoc signs `BetterXen.app`, and runs its `--smoke` check, so a Swift compile, link or smoke failure now fails CI. `scripts/build-app.sh` also prints `file` and `otool -L` for the executable and fails if it links any library outside `/System/Library/` and `/usr/lib/` (checked locally against a stubbed non-system dependency). The job is an app build and smoke result; it runs no Metal fixture and is not GPU verification. - Recorded the migrated PR integration decisions, native verification and scope exclusions in the testing documentation. - Added `xenora-bench startup` (#178), which measures Metal startup in fresh processes and in repeated submissions within one process, phase by phase (launch, device and queue, translation, library, pipeline, diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 19fe502..3d042ad 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -54,5 +54,15 @@ codesign --force --sign - "$bundle" binary="$bundle/Contents/MacOS/BetterXen" [ "$(lipo -archs "$binary")" = arm64 ] || fail "executable is not arm64-only: $(lipo -archs "$binary")" +file "$binary" +otool -L "$binary" +# Only system libraries may be linked: anything else would be a host dependency +# shipped or expected outside macOS, which this bundle does not carry. +for dependency in $(otool -L "$binary" | tail -n +2 | awk '{print $1}'); do + case "$dependency" in + /System/Library/*|/usr/lib/*) ;; + *) fail "executable links a non-system library: $dependency" ;; + esac +done "$binary" --smoke echo "build-app: built $bundle" From 4e838207fef42b1cbd922228335c5095000b8824 Mon Sep 17 00:00:00 2001 From: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> Date: Wed, 25 Nov 2026 02:09:22 -0300 Subject: [PATCH 2/2] ci: check the printed dependency listing and reject empty or failed listings (#248) Review follow-up. build-app.sh now runs otool -L once in a checked assignment, prints that output and parses the same text, so a failing or empty listing fails the gate instead of skipping the loop. Every Swift executable links libSystem, so an empty list is an error. Bundle-relative entries (@rpath, @executable_path, @loader_path) get their own message. The changelog entry now separates the designed CI behaviour from what has been verified locally. Signed-off-by: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> --- CHANGELOG.md | 2 +- scripts/build-app.sh | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a22aa..17734d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ remains unsupported. - Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status. ### Added -- Added a `Native app build and smoke` CI job (#248). On the same native `macos-26` runner image and pinned Rust toolchain as the Rust checks, it runs `scripts/build-app.sh`, which builds the locked C ABI library and the Swift app together, bundles and ad-hoc signs `BetterXen.app`, and runs its `--smoke` check, so a Swift compile, link or smoke failure now fails CI. `scripts/build-app.sh` also prints `file` and `otool -L` for the executable and fails if it links any library outside `/System/Library/` and `/usr/lib/` (checked locally against a stubbed non-system dependency). The job is an app build and smoke result; it runs no Metal fixture and is not GPU verification. +- Added a `Native app build and smoke` CI job (#248). On the same native `macos-26` runner image and pinned Rust toolchain as the Rust checks, it runs `scripts/build-app.sh`, which builds the locked C ABI library and the Swift app together, bundles and ad-hoc signs `BetterXen.app`, and runs its `--smoke` check, so a Swift compile, link or smoke failure is designed to fail CI (implemented and verified locally; not yet shown on a CI run). `scripts/build-app.sh` also prints `file` and a single `otool -L` listing for the executable, fails if that listing fails or is empty, and fails if the executable links any library outside `/System/Library/` and `/usr/lib/`, naming bundle-relative (`@rpath`, `@executable_path`, `@loader_path`) entries separately (checked locally against stubbed failing, empty, bundle-relative and non-system listings). The job is an app build and smoke result; it runs no Metal fixture and is not GPU verification. - Recorded the migrated PR integration decisions, native verification and scope exclusions in the testing documentation. - Added `xenora-bench startup` (#178), which measures Metal startup in fresh processes and in repeated submissions within one process, phase by phase (launch, device and queue, translation, library, pipeline, diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 3d042ad..e5e16a7 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -55,12 +55,19 @@ codesign --force --sign - "$bundle" binary="$bundle/Contents/MacOS/BetterXen" [ "$(lipo -archs "$binary")" = arm64 ] || fail "executable is not arm64-only: $(lipo -archs "$binary")" file "$binary" -otool -L "$binary" # Only system libraries may be linked: anything else would be a host dependency -# shipped or expected outside macOS, which this bundle does not carry. -for dependency in $(otool -L "$binary" | tail -n +2 | awk '{print $1}'); do +# shipped or expected outside macOS, which this bundle does not carry. List the +# dependencies once, print that listing and check the same output. +dependencies=$(otool -L "$binary") || fail "otool -L failed for $binary" +printf '%s\n' "$dependencies" +dependencies=$(printf '%s\n' "$dependencies" | tail -n +2 | awk '{print $1}') +# Every Swift executable links at least libSystem, so an empty list is an error. +[ -n "$dependencies" ] || fail "otool -L listed no dependencies for $binary" +for dependency in $dependencies; do case "$dependency" in /System/Library/*|/usr/lib/*) ;; + @rpath/*|@executable_path/*|@loader_path/*) + fail "executable links a bundle-relative library, but this bundle ships none: $dependency" ;; *) fail "executable links a non-system library: $dependency" ;; esac done