ci: fix universal binary build by archiving .app bundles with ditto and robust lipo extraction #8

Merged
gronod merged 1 commits from fix/ppd-media-type-and-tray-options into development 2026-09-07 23:56:04 +01:00
Owner

Root Cause

The universal binary CI job was failing at Lipo Universal 2 .app because:

  1. actions/upload-artifact@v3 was uploading the raw uncompressed TargetPrint.app bundle folder.
  2. In Gitea Actions / act runner, upload-artifact and download-artifact strip UNIX execute permission bits (chmod -x, resulting in 0644).
  3. In build-universal, the lipo step tested [ -x "${base}/Contents/MacOS/TargetPrint" ] to decide whether to wrap root Contents into TargetPrint.app. Because -x evaluated to false, the move was skipped and the subsequent test -x immediately exited with code 1.
  4. Even if the move had occurred, the missing execute bit on the binary caused test -x to fail silently.

Fix

  1. Bundle Preservation with ditto:
    • In build-arch, package TargetPrint.app with ditto -c -k --keepParent into TargetPrint.app.zip before uploading.
    • ditto preserves macOS bundle directory structure, file permissions (+x), extended attributes, and codesign resources.
  2. Robust Multi-Strategy Extraction in build-universal:
    • Checks for *.zip and cleanly extracts using ditto -x -k.
    • Handles fallback to reconstructing TargetPrint.app from root Contents/ if raw contents are ever downloaded (without requiring -x on the check).
    • Handles any subfolder nesting (e.g. app-x86_64/TargetPrint.app).
    • Explicitly ensures chmod +x on TargetPrint.app/Contents/MacOS/TargetPrint.
    • Adds diagnostic logging (ls -l and lipo -info) so CI logs are fully transparent.
  3. Release Asset Upload Condition:
    • Changed release asset upload check to success() rather than !cancelled().
### Root Cause The universal binary CI job was failing at `Lipo Universal 2 .app` because: 1. `actions/upload-artifact@v3` was uploading the raw uncompressed `TargetPrint.app` bundle folder. 2. In Gitea Actions / act runner, `upload-artifact` and `download-artifact` strip UNIX execute permission bits (`chmod -x`, resulting in `0644`). 3. In `build-universal`, the lipo step tested `[ -x "${base}/Contents/MacOS/TargetPrint" ]` to decide whether to wrap root `Contents` into `TargetPrint.app`. Because `-x` evaluated to false, the move was skipped and the subsequent `test -x` immediately exited with code 1. 4. Even if the move had occurred, the missing execute bit on the binary caused `test -x` to fail silently. ### Fix 1. **Bundle Preservation with `ditto`**: - In `build-arch`, package `TargetPrint.app` with `ditto -c -k --keepParent` into `TargetPrint.app.zip` before uploading. - `ditto` preserves macOS bundle directory structure, file permissions (`+x`), extended attributes, and codesign resources. 2. **Robust Multi-Strategy Extraction in `build-universal`**: - Checks for `*.zip` and cleanly extracts using `ditto -x -k`. - Handles fallback to reconstructing `TargetPrint.app` from root `Contents/` if raw contents are ever downloaded (without requiring `-x` on the check). - Handles any subfolder nesting (e.g. `app-x86_64/TargetPrint.app`). - Explicitly ensures `chmod +x` on `TargetPrint.app/Contents/MacOS/TargetPrint`. - Adds diagnostic logging (`ls -l` and `lipo -info`) so CI logs are fully transparent. 3. **Release Asset Upload Condition**: - Changed release asset upload check to `success()` rather than `!cancelled()`.
gronod added 1 commit 2026-09-07 23:52:24 +01:00
ci: fix universal binary build by archiving .app bundles with ditto and robust lipo extraction
Build macOS Packages / Build macOS (Intel) (pull_request) Successful in 34s
Build macOS Packages / Build macOS (Apple Silicon) (pull_request) Successful in 35s
Build macOS Packages / Build macOS (Universal) (pull_request) Successful in 34s
8d69aab54d
gronod merged commit 16c5dbac39 into development 2026-09-07 23:56:04 +01:00
Sign in to join this conversation.