iOS TestFlight CI/CD + fix Release-archive build (DEBUG-gating from #5079)

Merged
LA
6mo ago
+236-8

Adds GitHub Actions CI/CD that ships the cmux iOS app to TestFlight, and fixes the iOS Release-archive build regression that building it in Release exposed.

TestFlight workflow (.github/workflows/ios-testflight.yml)

  • Triggers: workflow_dispatch (optional build_number / force) + a nightly cron that skips when main has had no new commits in the last 24h (a cheap ubuntu decide job), so it doesn't burn build numbers on unchanged code.
  • Build: macos-26, Xcode select + submodules: recursive + install-zig-ci.sh + ensure-ghosttykit.sh (mirrors test-ios.yml), then ios/scripts/upload-testflight.sh --lane beta --signing automatic (bundle id dev.cmux.app.beta, internal TestFlight).
  • Signing: cloud-managed (automatic) via -allowProvisioningUpdates + the App Store Connect API key, so the runner needs no iOS distribution cert/profile in its keychain — only the three ASC secrets (ASC_API_KEY_ID, ASC_API_ISSUER_ID, ASC_API_KEY_P8_BASE64). upload-testflight.sh gains a --signing manual|automatic flag (default manual, preserving local-keychain exports).

Validated end-to-end on the branch (temp push trigger, since removed): real archive → cloud-signed export → altool UPLOAD SUCCEEDED with no errors, Delivery UUID 39be114b-d1df-4392-8dcb-32f9708f3f16, ~3.5 min.

iOS Release-archive fix (⚠️ this was also breaking main's nightly/release iOS)

test-ios.yml only builds Debug/simulator, so two DEBUG-only-used-from-non-DEBUG leaks from the #5079 iOS-mobile merge went unnoticed and broke the Release archive:

  • GhosttySurfaceView.surfaceText was #if DEBUG but the non-DEBUG public visibleTerminalSnapshot() (Copy Debug Logs, ships in betas) calls it → un-gated the helper.
  • TerminalLayoutPreviewView (UITest screenshot scaffolding, mounted only when CMUX_UITEST_TERMINAL_PREVIEW=1) was gated only by #if canImport(UIKit) and called DEBUG-only debug*ForLayoutPreview seams → DEBUG-gated the file + its CMUXMobileRootView mount points.

cmux-ios now compiles in Release (verified BUILD SUCCEEDED + the real upload above). Debug behavior is unchanged.

Notes

  • The ios-testflight workflow doesn't run on PRs (dispatch + nightly only); it's validated above.
  • The Release-archive fix is bundled here because building iOS in Release is exactly what this PR adds, but it independently unbreaks main's nightly/release iOS — worth merging promptly.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
Touches release signing/export and CI secrets for App Store Connect; Swift changes are compile-gating only with no intended runtime behavior change in Release beyond fixing the broken archive.

Overview
Adds automated TestFlight delivery for the iOS beta (dev.cmux.app.beta) via a new GitHub Actions workflow: manual dispatch or a nightly cron, with a lightweight decide job that skips scheduled uploads when main has no commits in the last 24h. The macOS job provisions GhosttyKit, materializes App Store Connect API keys, and runs upload-testflight.sh with --signing automatic so CI can export without a distribution cert in the keychain.

upload-testflight.sh gains --signing manual|automatic (default manual): automatic export omits manual cert/profile plist entries and relies on cloud-managed signing with -allowProvisioningUpdates.

Release archive fixes exposed by shipping Release builds: GhosttySurfaceView.surfaceText is no longer #if DEBUG-only so release Copy Debug Logs / visibleTerminalSnapshot() compiles; UITest terminal layout preview (TerminalLayoutPreviewView and its mount in CMUXMobileRootView) is restricted to DEBUG so Release does not pull DEBUG-only preview seams.

Reviewed by Cursor Bugbot for commit 458d1001bc1aaaef86039a1c9ff195d352e2951f. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Automates TestFlight uploads for the cmux iOS beta and fixes Release-archive failures from DEBUG-only code. Manual and nightly uploads use cloud-managed signing; nightly skips only when the current main HEAD was already uploaded. Release/TestFlight builds compile again.

  • New Features

    • Added iOS TestFlight (beta) workflow at .github/workflows/ios-testflight.yml to archive, export, and upload the beta lane (dev.cmux.app.beta).
    • Triggers: manual (workflow_dispatch with optional build_number) and nightly; gate uses the last successful run’s head_sha so missed/failed runs retry. Adds actions: read to query run history.
    • Uses cloud-managed signing via App Store Connect; requires ASC_API_KEY_ID, ASC_API_ISSUER_ID, ASC_API_KEY_P8_BASE64. No distribution cert/profile on the runner.
    • ios/scripts/upload-testflight.sh supports --signing automatic (CI) in addition to manual (default).
    • Labeled jobs with human-readable names for clearer Actions UI.
  • Bug Fixes

    • Ungated GhosttySurfaceView.surfaceText so visibleTerminalSnapshot() works in Release; fixes Release/TestFlight archive failures.
    • DEBUG-gated TerminalLayoutPreviewView and its mounts in CMUXMobileRootView to avoid DEBUG-only seams in Release.
    • cmux-ios now compiles in Release; nightly/release iOS and TestFlight builds succeed.

Summary by CodeRabbit

  • New Features

    • Added an iOS TestFlight CI pipeline to automate conditional beta uploads with manual trigger and nightly scheduling.
  • Improvements

    • Terminal layout preview is now enabled only in debug iOS builds.
    • Terminal snapshot / “copy logs” functionality remains available in release builds for diagnostics.
    • TestFlight upload tooling now supports selectable signing modes (manual or automatic) for exports.