The Mac Mini runner has no dev certificates, so xcodebuild produces an ad-hoc signed app. Gatekeeper rejects it, causing XCUITest to hang forever at app.launch(). Split build and test phases, strip the ad-hoc signature between them so the app can launch.
114 lines
3.9 KiB
YAML
114 lines
3.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
workflow-guard-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Validate self-hosted runner guards
|
|
run: ./tests/test_ci_self_hosted_guard.sh
|
|
|
|
web-typecheck:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Typecheck
|
|
run: bun tsc --noEmit
|
|
|
|
ui-tests:
|
|
# Never run self-hosted jobs for fork pull requests.
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: self-hosted
|
|
concurrency:
|
|
group: self-hosted-build
|
|
cancel-in-progress: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Select Xcode
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -d "/Applications/Xcode.app/Contents/Developer" ]; then
|
|
XCODE_DIR="/Applications/Xcode.app/Contents/Developer"
|
|
else
|
|
XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | head -n 1 || true)"
|
|
if [ -n "$XCODE_APP" ]; then
|
|
XCODE_DIR="$XCODE_APP/Contents/Developer"
|
|
else
|
|
echo "No Xcode.app found under /Applications" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
echo "DEVELOPER_DIR=$XCODE_DIR" >> "$GITHUB_ENV"
|
|
export DEVELOPER_DIR="$XCODE_DIR"
|
|
xcodebuild -version
|
|
xcrun --sdk macosx --show-sdk-path
|
|
|
|
- name: Download Metal Toolchain
|
|
run: xcodebuild -downloadComponent MetalToolchain
|
|
|
|
- name: Build GhosttyKit.xcframework
|
|
run: |
|
|
set -euo pipefail
|
|
if ! command -v zig >/dev/null 2>&1; then
|
|
if command -v brew >/dev/null 2>&1; then
|
|
brew install zig
|
|
else
|
|
echo "zig is required to build GhosttyKit.xcframework. Install zig and retry." >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
(cd ghostty && zig build -Demit-xcframework=true -Demit-macos-app=false)
|
|
rm -rf GhosttyKit.xcframework
|
|
cp -R ghostty/macos/GhosttyKit.xcframework GhosttyKit.xcframework
|
|
test -d GhosttyKit.xcframework
|
|
|
|
- name: Clean DerivedData
|
|
run: |
|
|
# Remove stale build cache to avoid incremental build errors
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-*
|
|
|
|
- name: Build for testing
|
|
run: |
|
|
set -euo pipefail
|
|
xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux -configuration Debug -destination "platform=macOS" build-for-testing
|
|
|
|
- name: Allow ad-hoc signed app to launch
|
|
run: |
|
|
# The runner has no development certificates, so the app is ad-hoc signed.
|
|
# Gatekeeper blocks ad-hoc apps, causing XCUITest to hang on launch.
|
|
# Remove the signature so macOS treats it as unsigned (launchable) instead.
|
|
APP_PATH="$(find ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-*/Build/Products/Debug -name 'cmux DEV.app' -print -quit)"
|
|
if [ -z "$APP_PATH" ]; then
|
|
echo "Built app not found in DerivedData" >&2
|
|
exit 1
|
|
fi
|
|
codesign --remove-signature "$APP_PATH"
|
|
echo "Removed ad-hoc signature from: $APP_PATH"
|
|
|
|
- name: Run UI tests
|
|
run: |
|
|
set -euo pipefail
|
|
xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux -configuration Debug -destination "platform=macOS" -only-testing:cmuxUITests/UpdatePillUITests test-without-building
|