cmux/ci_scripts/ci_post_clone.sh
Lawrence Chen ae3bcd7eea
Set up full test suite in CI and Xcode Cloud (#447)
* Set up full test suite in CI and Xcode Cloud

Add build-ghosttykit.yml workflow to pre-build and publish
GhosttyKit.xcframework as a GitHub release on manaflow-ai/ghostty,
keyed by submodule SHA. Add ci_scripts/ci_post_clone.sh for Xcode
Cloud to download the pre-built xcframework with retry logic. Create
cmux-ci scheme that runs both cmuxTests and cmuxUITests. Switch the
CI tests job from running a single UI test class to the full suite.

* Run unit tests + single UI test class on self-hosted runner

The self-hosted runner can't launch the full app for UI tests (no GUI
session), so run all unit tests via cmux-unit scheme and keep the
original UpdatePillUITests as a smoke test. Full UI test suite runs
on Xcode Cloud which has proper macOS GUI support.

* Handle expected test failures in unit tests step

xcodebuild returns exit code 65 even for expected failures
(XCTExpectFailure). Parse the summary line to only fail the CI job
when there are unexpected failures.
2026-02-27 04:18:26 -08:00

48 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
echo "=== ci_post_clone.sh ==="
# Initialize submodules (needed for vendor/bonsplit SPM package)
echo "Initializing submodules..."
git submodule update --init --recursive
# Get ghostty submodule SHA
GHOSTTY_SHA=$(git -C "$CI_PRIMARY_REPOSITORY_PATH/ghostty" rev-parse HEAD)
echo "Ghostty SHA: $GHOSTTY_SHA"
# Download pre-built xcframework from manaflow-ai/ghostty releases
TAG="xcframework-$GHOSTTY_SHA"
URL="https://github.com/manaflow-ai/ghostty/releases/download/$TAG/GhosttyKit.xcframework.tar.gz"
echo "Downloading xcframework from $URL"
MAX_RETRIES=30
RETRY_DELAY=20
for i in $(seq 1 $MAX_RETRIES); do
if curl -fSL -o "$CI_PRIMARY_REPOSITORY_PATH/GhosttyKit.xcframework.tar.gz" "$URL"; then
echo "Download succeeded on attempt $i"
break
fi
if [ "$i" -eq "$MAX_RETRIES" ]; then
echo "Failed to download xcframework after $MAX_RETRIES attempts" >&2
exit 1
fi
echo "Attempt $i/$MAX_RETRIES failed, retrying in ${RETRY_DELAY}s..."
sleep $RETRY_DELAY
done
# Extract xcframework to project root
echo "Extracting xcframework..."
cd "$CI_PRIMARY_REPOSITORY_PATH"
tar xzf GhosttyKit.xcframework.tar.gz
rm GhosttyKit.xcframework.tar.gz
test -d GhosttyKit.xcframework
echo "GhosttyKit.xcframework extracted successfully"
# Download Metal toolchain (required for shader compilation)
echo "Downloading Metal toolchain..."
xcodebuild -downloadComponent MetalToolchain
echo "=== ci_post_clone.sh done ==="