Skip to content

Merge pull request #126 from darkroomengineering/port/browser-passkeys #229

Merge pull request #126 from darkroomengineering/port/browser-passkeys

Merge pull request #126 from darkroomengineering/port/browser-passkeys #229

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths:
- ".github/workflows/ci.yml"
- ".github/workflows/ci-macos-compat.yml"
- ".github/workflows/build-ghosttykit.yml"
- "Sources/**"
- "CLI/**"
- "daemon/**"
- "programaTests/**"
- "vendor/**"
- "scripts/**"
- "GhosttyTabs.xcodeproj/**"
- "ghostty/**"
- "vendor/bonsplit/**"
- ".gitmodules"
pull_request:
paths:
- "Sources/**"
- "CLI/**"
- "daemon/**"
- "programaTests/**"
- "tests/**"
- "tests_v2/**"
- "vendor/**"
- "scripts/**"
- ".github/workflows/ci.yml"
- ".github/workflows/ci-macos-compat.yml"
- ".github/workflows/build-ghosttykit.yml"
- "GhosttyTabs.xcodeproj/**"
- "ghostty/**"
- ".gitmodules"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
change-detection:
runs-on: ubuntu-latest
outputs:
run_app_jobs: ${{ steps.detect.outputs.run_app_jobs }}
run_remote_daemon_jobs: ${{ steps.detect.outputs.run_remote_daemon_jobs }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Detect changed files
id: detect
run: |
set -euo pipefail
# Keep full CI for push events and non-PR runs.
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
echo "run_app_jobs=true" >> "$GITHUB_OUTPUT"
echo "run_remote_daemon_jobs=true" >> "$GITHUB_OUTPUT"
echo "Changed files: full suite (non-PR context)" >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
git fetch --no-tags origin "${BASE_SHA}" "${HEAD_SHA}"
CHANGED_FILES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}")"
RUN_APP_JOBS=false
RUN_REMOTE_DAEMON_JOBS=false
if [[ -z "${CHANGED_FILES}" ]]; then
RUN_APP_JOBS=true
RUN_REMOTE_DAEMON_JOBS=true
fi
while IFS= read -r path; do
[[ -z "$path" ]] && continue
case "$path" in
# Documentation and prose
*.md|docs/*|plans/*|AGENTS.md|CHANGELOG.md|PROJECTS.md|TODO.md|README.md|LICENSE*|THIRD_PARTY_LICENSES.md|.editorconfig|.gitattributes|.gitignore|*.png|*.jpg|*.jpeg|*.gif|*.webp|*.svg)
continue
;;
# Repository metadata / workflow-only edits are not app/runtime changes
.github/*)
continue
;;
# Localization-only resource edits are scoped out per request
Resources/*.xcstrings|Resources/*/*.xcstrings|Resources/*.strings|Resources/*/*.strings)
continue
;;
# Explicitly skip doc-only translation assets
Resources/*.lproj/*)
continue
;;
daemon/**)
RUN_REMOTE_DAEMON_JOBS=true
;;
*)
RUN_APP_JOBS=true
break
;;
esac
done <<< "$CHANGED_FILES"
echo "run_app_jobs=${RUN_APP_JOBS}" >> "$GITHUB_OUTPUT"
echo "run_remote_daemon_jobs=${RUN_REMOTE_DAEMON_JOBS}" >> "$GITHUB_OUTPUT"
{
echo "### CI scope decision"
if [[ "$RUN_APP_JOBS" == "true" ]]; then
echo "Changed file set contains app-relevant changes; running full macOS jobs."
else
echo "Pull request appears docs/localization-only; skipping heavy app/daemon jobs."
fi
echo ""
echo "Changed files:"
if [[ -z "${CHANGED_FILES}" ]]; then
echo "- <none>"
else
printf '%s\n' "${CHANGED_FILES}"
fi
} >> "$GITHUB_STEP_SUMMARY"
workflow-guard-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Validate GhosttyKit lock ownership
run: ./tests/test_ensure_ghosttykit_locking.sh
- name: Validate create-dmg version pinning
run: ./tests/test_ci_create_dmg_pinned.sh
- name: Validate unit-test runner behavior
run: ./tests/test_ci_unit_test_runner_behavior.sh
- name: Validate GhosttyKit checksum verification
run: ./tests/test_ci_ghosttykit_checksum_verification.sh
- name: Validate release artifact architecture checks
run: ./tests/test_ci_universal_release_settings.sh
- name: Validate release asset guard
run: node scripts/release_asset_guard.test.js
remote-daemon-tests:
needs: change-detection
if: needs.change-detection.outputs.run_remote_daemon_jobs == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: daemon/remote/go.mod
- name: Run remote daemon tests
working-directory: daemon/remote
run: go test ./...
- name: Validate remote daemon release assets
run: ./tests/test_remote_daemon_release_assets.sh
tests:
needs: change-detection
if: needs.change-detection.outputs.run_app_jobs == 'true'
runs-on: macos-26
timeout-minutes: 60
env:
PROGRAMA_SKIP_ZIG_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- name: Select Xcode
run: |
set -euo pipefail
# Prefer Xcode 26 (macOS 26 SDK) so NSGlassEffectView / Liquid Glass compiles;
# fall back to the image default when no Xcode 26 install exists.
XCODE_APP="$(ls -d /Applications/Xcode_26*.app 2>/dev/null | sort -V | tail -n 1 || true)"
if [ -z "$XCODE_APP" ] && [ -d "/Applications/Xcode.app" ]; then
XCODE_APP="/Applications/Xcode.app"
fi
if [ -z "$XCODE_APP" ]; then
XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | sort | tail -n 1 || true)"
fi
if [ -z "$XCODE_APP" ]; then
echo "No Xcode.app found under /Applications" >&2
exit 1
fi
XCODE_DIR="$XCODE_APP/Contents/Developer"
echo "DEVELOPER_DIR=$XCODE_DIR" >> "$GITHUB_ENV"
export DEVELOPER_DIR="$XCODE_DIR"
xcodebuild -version
- name: Validate Release reload artifact discovery
run: ./tests/test_reloadp_programa_artifact.sh
- name: Validate reload entrypoint artifacts and dependency preparation
run: ./tests/test_reload_entrypoints_artifacts.sh
- name: Cache GhosttyKit.xcframework
id: cache-ghosttykit
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: GhosttyKit.xcframework
key: ghosttykit-v2-${{ hashFiles('.gitmodules', 'ghostty') }}
- name: Download pre-built GhosttyKit.xcframework
if: steps.cache-ghosttykit.outputs.cache-hit != 'true'
run: |
./scripts/download-prebuilt-ghosttykit.sh
- name: Install zig
run: |
ZIG_REQUIRED="0.15.2"
if command -v zig >/dev/null 2>&1 && zig version 2>/dev/null | grep -q "^${ZIG_REQUIRED}"; then
echo "zig ${ZIG_REQUIRED} already installed"
else
echo "Installing zig ${ZIG_REQUIRED} from tarball"
curl -fSL "https://ziglang.org/download/${ZIG_REQUIRED}/zig-aarch64-macos-${ZIG_REQUIRED}.tar.xz" -o /tmp/zig.tar.xz
tar xf /tmp/zig.tar.xz -C /tmp
sudo mkdir -p /usr/local/bin /usr/local/lib
sudo cp -f /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/zig /usr/local/bin/zig
sudo cp -rf /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/lib /usr/local/lib/zig
export PATH="/usr/local/bin:$PATH"
zig version
fi
- name: Cache Zig packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: ~/.cache/zig
key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }}
restore-keys: zig-packages-
- name: Cache DerivedData
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-*
key: deriveddata-tests-macos26-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}-${{ hashFiles('GhosttyTabs.xcodeproj/project.pbxproj') }}
restore-keys: |
deriveddata-tests-macos26-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}-
deriveddata-tests-macos26-
- name: Cache Swift packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: .ci-source-packages
key: spm-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-
- name: Resolve Swift packages
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
mkdir -p "$SOURCE_PACKAGES_DIR"
for attempt in 1 2 3; do
if xcodebuild -project GhosttyTabs.xcodeproj -scheme programa-unit -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-resolvePackageDependencies; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
echo "Failed to resolve Swift packages after 3 attempts" >&2
exit 1
fi
echo "Package resolution failed on attempt $attempt, retrying..."
sleep $((attempt * 5))
done
# Build and exercise the standalone CLI before the long XCTest bundle. This
# keeps parser/security regressions observable even when an unrelated UI
# unit test flakes later in the job.
- name: Build programa CLI regression target
run: |
CLI_REGRESSION_DIR="$RUNNER_TEMP/programa-cli-regression"
rm -rf "$CLI_REGRESSION_DIR"
xcodebuild -project GhosttyTabs.xcodeproj \
-target programa-cli \
-configuration Debug \
CONFIGURATION_BUILD_DIR="$CLI_REGRESSION_DIR" \
CODE_SIGNING_ALLOWED=NO \
build
- name: Run typed CLI registry behavior regression
run: |
set -euo pipefail
CLI_BIN="$RUNNER_TEMP/programa-cli-regression/programa"
if [ -z "${CLI_BIN:-}" ] || [ ! -x "$CLI_BIN" ]; then
echo "programa CLI binary not found in DerivedData" >&2
exit 1
fi
PROGRAMA_CLI_BIN="$CLI_BIN" python3 tests/test_cli_registry_behavior.py
- name: Run unit tests
env:
PROGRAMA_UNIT_TEST_SCOPE: serial
PROGRAMA_SKIP_ZIG_BUILD: "1"
run: ./scripts/ci-run-unit-tests.sh
- name: Run bundled Ghostty theme picker helper regression
run: |
set -euo pipefail
PROGRAMA_SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages" \
./tests/test_bundled_ghostty_theme_picker_helper.sh
- name: Run CLI version memory guard regression
run: |
set -euo pipefail
CLI_BIN="$(
find "$HOME/Library/Developer/Xcode/DerivedData" -path "*/Build/Products/Debug/programa" -exec stat -f '%m %N' {} \; \
| sort -nr \
| head -1 \
| cut -d' ' -f2-
)"
if [ -z "${CLI_BIN:-}" ] || [ ! -x "$CLI_BIN" ]; then
echo "programa CLI binary not found in DerivedData" >&2
exit 1
fi
PROGRAMA_CLI_BIN="$CLI_BIN" python3 tests/test_cli_version_memory_guard.py
tests-build-and-lag:
needs:
- tests
- change-detection
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.change-detection.outputs.run_app_jobs == 'true'
# Build the full cmux scheme and run the lag regression on GitHub-hosted runners.
# Keep lag validation separate from UI regressions so functional UI failures
# and performance regressions stay isolated. Broader interactive UI suites
# still run via test-e2e.yml on GitHub-hosted runners.
runs-on: macos-26
timeout-minutes: 60
env:
PROGRAMA_SKIP_ZIG_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- name: Select Xcode
run: |
set -euo pipefail
# Prefer Xcode 26 (macOS 26 SDK) so NSGlassEffectView / Liquid Glass compiles;
# fall back to the image default when no Xcode 26 install exists.
XCODE_APP="$(ls -d /Applications/Xcode_26*.app 2>/dev/null | sort -V | tail -n 1 || true)"
if [ -z "$XCODE_APP" ] && [ -d "/Applications/Xcode.app" ]; then
XCODE_APP="/Applications/Xcode.app"
fi
if [ -z "$XCODE_APP" ]; then
XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | sort | tail -n 1 || true)"
fi
if [ -z "$XCODE_APP" ]; then
echo "No Xcode.app found under /Applications" >&2
exit 1
fi
XCODE_DIR="$XCODE_APP/Contents/Developer"
echo "DEVELOPER_DIR=$XCODE_DIR" >> "$GITHUB_ENV"
export DEVELOPER_DIR="$XCODE_DIR"
xcodebuild -version
- name: Cache GhosttyKit.xcframework
id: cache-ghosttykit-lag
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: GhosttyKit.xcframework
key: ghosttykit-v2-${{ hashFiles('.gitmodules', 'ghostty') }}
- name: Download pre-built GhosttyKit.xcframework
if: steps.cache-ghosttykit-lag.outputs.cache-hit != 'true'
run: |
./scripts/download-prebuilt-ghosttykit.sh
- name: Install zig
run: |
ZIG_REQUIRED="0.15.2"
if command -v zig >/dev/null 2>&1 && zig version 2>/dev/null | grep -q "^${ZIG_REQUIRED}"; then
echo "zig ${ZIG_REQUIRED} already installed"
else
echo "Installing zig ${ZIG_REQUIRED} from tarball"
curl -fSL "https://ziglang.org/download/${ZIG_REQUIRED}/zig-aarch64-macos-${ZIG_REQUIRED}.tar.xz" -o /tmp/zig.tar.xz
tar xf /tmp/zig.tar.xz -C /tmp
sudo mkdir -p /usr/local/bin /usr/local/lib
sudo cp -f /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/zig /usr/local/bin/zig
sudo cp -rf /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/lib /usr/local/lib/zig
export PATH="/usr/local/bin:$PATH"
zig version
fi
- name: Cache Zig packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: ~/.cache/zig
key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }}
restore-keys: zig-packages-
- name: Cache DerivedData
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-*
key: deriveddata-build-macos26-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}-${{ hashFiles('GhosttyTabs.xcodeproj/project.pbxproj') }}
restore-keys: |
deriveddata-build-macos26-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}-
deriveddata-build-macos26-
- name: Cache Swift packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: .ci-source-packages
key: spm-build-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-build-
- name: Resolve Swift packages
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
mkdir -p "$SOURCE_PACKAGES_DIR"
for attempt in 1 2 3; do
if xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-resolvePackageDependencies; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
echo "Failed to resolve Swift packages after 3 attempts" >&2
exit 1
fi
echo "Package resolution failed on attempt $attempt, retrying..."
sleep $((attempt * 5))
done
- name: Build app
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-disableAutomaticPackageResolution \
-destination "platform=macOS" build
- name: Create virtual display
run: |
set -euo pipefail
clang -framework Foundation -framework CoreGraphics \
-o /tmp/create-virtual-display scripts/create-virtual-display.m
/tmp/create-virtual-display &
VDISPLAY_PID=$!
echo "VDISPLAY_PID=$VDISPLAY_PID" >> "$GITHUB_ENV"
sleep 3
kill -0 "$VDISPLAY_PID"
- name: Run workspace churn typing-lag regression
run: |
set -euo pipefail
APP="$(find "$HOME/Library/Developer/Xcode/DerivedData" -path "*/Build/Products/Debug/Programa DEV.app" -print -quit)"
if [ -z "${APP:-}" ] || [ ! -d "$APP" ]; then
echo "Programa DEV.app not found in DerivedData" >&2
exit 1
fi
TAG="ci-lag"
SOCK="/tmp/programa-debug-${TAG}.sock"
BUNDLE_ID="$(
/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP/Contents/Info.plist" 2>/dev/null \
|| echo 'com.darkroom.programa.debug'
)"
pkill -x "Programa DEV" || true
rm -f "$SOCK" "/tmp/programa-${TAG}.sock" || true
defaults write "$BUNDLE_ID" socketControlMode -string full >/dev/null 2>&1 || true
PROGRAMA_TAG="$TAG" PROGRAMA_SOCKET_PATH="$SOCK" PROGRAMA_UI_TEST_MODE=1 "$APP/Contents/MacOS/Programa DEV" >/tmp/programa-ci-lag.log 2>&1 &
APP_PID=$!
trap 'kill "$APP_PID" >/dev/null 2>&1 || true' EXIT
for _ in {1..240}; do
[ -S "$SOCK" ] && break
sleep 0.25
done
[ -S "$SOCK" ] || { echo "Socket not ready at $SOCK" >&2; exit 1; }
PROGRAMA_SOCKET_PATH="$SOCK" \
PROGRAMA_LAG_MAX_P95_RATIO=1.70 \
PROGRAMA_LAG_MAX_AVG_RATIO=1.70 \
PROGRAMA_LAG_MIN_BASELINE_P95_MS_FOR_RATIO=6.0 \
PROGRAMA_LAG_MIN_BASELINE_AVG_MS_FOR_RATIO=4.0 \
PROGRAMA_LAG_MAX_P95_DELTA_MS=20.0 \
PROGRAMA_LAG_MAX_AVG_DELTA_MS=12.0 \
PROGRAMA_LAG_MAX_CHURN_P95_MS=35 \
PROGRAMA_LAG_KEY_EVENTS=180 \
python3 tests/test_workspace_churn_up_arrow_lag.py
- name: Cleanup virtual display
if: always()
run: |
set -euo pipefail
if [ -n "${VDISPLAY_PID:-}" ]; then
kill "$VDISPLAY_PID" >/dev/null 2>&1 || true
fi
rm -f /tmp/create-virtual-display
ui-regressions:
needs:
- tests
- change-detection
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.change-detection.outputs.run_app_jobs == 'true'
runs-on: macos-26
timeout-minutes: 60
env:
PROGRAMA_SKIP_ZIG_BUILD: "1"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- name: Select Xcode
run: |
set -euo pipefail
# Prefer Xcode 26 (macOS 26 SDK) so NSGlassEffectView / Liquid Glass compiles;
# fall back to the image default when no Xcode 26 install exists.
XCODE_APP="$(ls -d /Applications/Xcode_26*.app 2>/dev/null | sort -V | tail -n 1 || true)"
if [ -z "$XCODE_APP" ] && [ -d "/Applications/Xcode.app" ]; then
XCODE_APP="/Applications/Xcode.app"
fi
if [ -z "$XCODE_APP" ]; then
XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | sort | tail -n 1 || true)"
fi
if [ -z "$XCODE_APP" ]; then
echo "No Xcode.app found under /Applications" >&2
exit 1
fi
XCODE_DIR="$XCODE_APP/Contents/Developer"
echo "DEVELOPER_DIR=$XCODE_DIR" >> "$GITHUB_ENV"
export DEVELOPER_DIR="$XCODE_DIR"
xcodebuild -version
xcrun --sdk macosx --show-sdk-path
- name: Download pre-built GhosttyKit.xcframework
run: ./scripts/download-prebuilt-ghosttykit.sh
- name: Install zig
run: |
ZIG_REQUIRED="0.15.2"
if command -v zig >/dev/null 2>&1 && zig version 2>/dev/null | grep -q "^${ZIG_REQUIRED}"; then
echo "zig ${ZIG_REQUIRED} already installed"
else
echo "Installing zig ${ZIG_REQUIRED} from tarball"
curl -fSL "https://ziglang.org/download/${ZIG_REQUIRED}/zig-aarch64-macos-${ZIG_REQUIRED}.tar.xz" -o /tmp/zig.tar.xz
tar xf /tmp/zig.tar.xz -C /tmp
sudo mkdir -p /usr/local/bin /usr/local/lib
sudo cp -f /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/zig /usr/local/bin/zig
sudo cp -rf /tmp/zig-aarch64-macos-${ZIG_REQUIRED}/lib /usr/local/lib/zig
export PATH="/usr/local/bin:$PATH"
zig version
fi
- name: Cache Zig packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: ~/.cache/zig
key: zig-packages-${{ hashFiles('ghostty/build.zig.zon', 'ghostty/build.zig.zon.json') }}
restore-keys: zig-packages-
- name: Cache Swift packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: .ci-source-packages
key: spm-ui-regressions-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-ui-regressions-
- name: Resolve Swift packages
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
mkdir -p "$SOURCE_PACKAGES_DIR"
for attempt in 1 2 3; do
if xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-resolvePackageDependencies; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
echo "Failed to resolve Swift packages after 3 attempts" >&2
exit 1
fi
echo "Package resolution failed on attempt $attempt, retrying..."
sleep $((attempt * 5))
done
- name: Build for testing (display resolution)
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-disableAutomaticPackageResolution \
-destination "platform=macOS" \
build-for-testing
- name: Create persistent virtual display
run: |
set -euo pipefail
HELPER_PATH="/tmp/create-virtual-display"
clang -framework Foundation -framework CoreGraphics \
-o "$HELPER_PATH" scripts/create-virtual-display.m
VDISPLAY_READY="/tmp/programa-vdisplay-persistent.ready"
VDISPLAY_ID_PATH="/tmp/programa-vdisplay-persistent.id"
rm -f "$VDISPLAY_READY" "$VDISPLAY_ID_PATH"
"$HELPER_PATH" \
--modes "1920x1080" \
--ready-path "$VDISPLAY_READY" \
--display-id-path "$VDISPLAY_ID_PATH" \
> /tmp/programa-vdisplay-persistent.log 2>&1 &
echo "VDISPLAY_PERSISTENT_PID=$!" >> "$GITHUB_ENV"
echo "Waiting for persistent virtual display..."
for i in $(seq 1 24); do
if [ -f "$VDISPLAY_READY" ]; then break; fi
sleep 0.5
done
if [ ! -f "$VDISPLAY_READY" ]; then
echo "ERROR: Persistent virtual display not ready after 12s" >&2
cat /tmp/programa-vdisplay-persistent.log 2>/dev/null || true
exit 1
fi
echo "Persistent virtual display ready: ID=$(cat "$VDISPLAY_ID_PATH")"
- name: Run display resolution churn UI regression
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
HELPER_PATH="/tmp/create-virtual-display"
TOKEN="$(uuidgen)"
DIAG_PATH="/tmp/programa-ui-test-display-churn-${TOKEN}.json"
DISPLAY_READY="/tmp/programa-ui-test-display-${TOKEN}.ready"
DISPLAY_ID_PATH="/tmp/programa-ui-test-display-${TOKEN}.id"
DISPLAY_START="/tmp/programa-ui-test-display-${TOKEN}.start"
DISPLAY_DONE="/tmp/programa-ui-test-display-${TOKEN}.done"
HELPER_LOG="/tmp/programa-ui-test-display-${TOKEN}-helper.log"
cleanup() {
pkill -x "Programa DEV" 2>/dev/null || true
rm -f "$DIAG_PATH" "$DISPLAY_READY" "$DISPLAY_ID_PATH" "$DISPLAY_START" "$DISPLAY_DONE" "$HELPER_LOG"
rm -f /tmp/programa-ui-test-prelaunch.json /tmp/programa-ui-test-display-harness.json
}
trap cleanup EXIT
# Build display helper
clang -framework Foundation -framework CoreGraphics \
-o "$HELPER_PATH" scripts/create-virtual-display.m
# Find the app binary
APP_BINARY=$(find ~/Library/Developer/Xcode/DerivedData -path "*/Build/Products/Debug/Programa DEV.app/Contents/MacOS/Programa DEV" -print -quit 2>/dev/null || true)
if [ -z "$APP_BINARY" ]; then
echo "ERROR: App binary not found in DerivedData" >&2
exit 1
fi
echo "App binary: $APP_BINARY"
for attempt in 1 2; do
cleanup 2>/dev/null || true
# Launch display helper from shell (non-sandboxed).
# Use --start-delay-ms instead of --start-path because the XCTest
# runner is sandboxed and can't write to /tmp/ for the start signal.
# 10s delay gives the test time to capture baseline render stats.
"$HELPER_PATH" \
--modes "1920x1080,1728x1117,1600x900,1440x810" \
--ready-path "$DISPLAY_READY" \
--display-id-path "$DISPLAY_ID_PATH" \
--done-path "$DISPLAY_DONE" \
--iterations 40 \
--interval-ms 40 \
--start-delay-ms 10000 \
> "$HELPER_LOG" 2>&1 &
HELPER_PID=$!
# Wait for display ready
echo "Waiting for virtual display..."
for i in $(seq 1 24); do
if [ -f "$DISPLAY_READY" ]; then break; fi
sleep 0.5
done
if [ ! -f "$DISPLAY_READY" ]; then
echo "ERROR: Virtual display not ready after 12s" >&2
cat "$HELPER_LOG" 2>/dev/null || true
continue
fi
DISPLAY_ID=$(cat "$DISPLAY_ID_PATH")
echo "Virtual display ready: ID=$DISPLAY_ID"
# Launch app from shell (non-sandboxed, outside XCTest sandbox)
PROGRAMA_UI_TEST_MODE=1 \
PROGRAMA_UI_TEST_DIAGNOSTICS_PATH="$DIAG_PATH" \
PROGRAMA_UI_TEST_DISPLAY_RENDER_STATS=1 \
PROGRAMA_UI_TEST_TARGET_DISPLAY_ID="$DISPLAY_ID" \
PROGRAMA_TAG="ui-tests-display-resolution" \
"$APP_BINARY" > /tmp/programa-ui-test-app.log 2>&1 &
APP_PID=$!
echo "App launched: PID=$APP_PID"
# Wait for app diagnostics
echo "Waiting for app diagnostics..."
APP_READY=false
for i in $(seq 1 30); do
if [ -f "$DIAG_PATH" ]; then
if python3 -c "import json; d=json.load(open('$DIAG_PATH')); assert d.get('pid')" 2>/dev/null; then
APP_READY=true
break
fi
fi
if ! kill -0 "$APP_PID" 2>/dev/null; then
echo "ERROR: App crashed during startup"
cat /tmp/programa-ui-test-app.log 2>/dev/null | tail -30 || true
break
fi
sleep 0.5
done
if [ "$APP_READY" != "true" ]; then
echo "Attempt $attempt: App not ready after 15s"
pkill -x "Programa DEV" 2>/dev/null || true
kill "$HELPER_PID" 2>/dev/null || true
if [ "$attempt" -eq 2 ]; then
echo "Display resolution UI regression failed after 2 attempts" >&2
echo "--- App log ---"
cat /tmp/programa-ui-test-app.log 2>/dev/null | tail -50 || true
echo "--- Helper log ---"
cat "$HELPER_LOG" 2>/dev/null | tail -20 || true
echo "--- Diagnostics ---"
cat "$DIAG_PATH" 2>/dev/null || echo "(not found)"
exit 1
fi
sleep 3
continue
fi
echo "App started. Diagnostics:"
cat "$DIAG_PATH"
# Wait for render stats (terminal surface initialization)
echo "Waiting for render stats..."
RENDER_READY=false
for i in $(seq 1 40); do
if python3 -c "import json; d=json.load(open('$DIAG_PATH')); assert d.get('renderStatsAvailable') == '1'" 2>/dev/null; then
RENDER_READY=true
echo "Render stats available after $((i / 2))s"
break
fi
sleep 0.5
done
if [ "$RENDER_READY" != "true" ]; then
echo "WARNING: Render stats not available after 20s. Diagnostics:"
cat "$DIAG_PATH" 2>/dev/null || true
echo "--- App log ---"
cat /tmp/programa-ui-test-app.log 2>/dev/null | tail -30 || true
fi
# Write manifests so test can find the pre-launched state
MANIFEST_PATH="/tmp/programa-ui-test-display-harness.json"
cat >"$MANIFEST_PATH" <<MANIFEST_EOF
{"readyPath":"$DISPLAY_READY","displayIDPath":"$DISPLAY_ID_PATH","donePath":"$DISPLAY_DONE","logPath":"$HELPER_LOG"}
MANIFEST_EOF
PRELAUNCH_PATH="/tmp/programa-ui-test-prelaunch.json"
cat >"$PRELAUNCH_PATH" <<PRELAUNCH_EOF
{"diagnosticsPath":"$DIAG_PATH"}
PRELAUNCH_EOF
# Run test — app is already launched from shell
if xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-disableAutomaticPackageResolution \
-destination "platform=macOS" \
-only-testing:programaUITests/DisplayResolutionRegressionUITests \
test-without-building; then
exit 0
fi
pkill -x "Programa DEV" 2>/dev/null || true
kill "$HELPER_PID" 2>/dev/null || true
if [ "$attempt" -eq 2 ]; then
echo "Display resolution UI regression failed after 2 attempts" >&2
exit 1
fi
echo "Attempt $attempt failed, retrying..."
sleep 3
done
- name: Run browser find focus UI regression
run: |
set -euo pipefail
SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages"
xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_DIR" \
-disableAutomaticPackageResolution \
-destination "platform=macOS" \
-maximum-test-execution-time-allowance 180 \
-only-testing:programaUITests/BrowserPaneNavigationKeybindUITests/testCmdFFocusesBrowserFindFieldAfterCmdDCmdLNavigation \
test-without-building
- name: Cleanup persistent virtual display
if: always()
run: |
if [ -n "${VDISPLAY_PERSISTENT_PID:-}" ]; then
kill "$VDISPLAY_PERSISTENT_PID" >/dev/null 2>&1 || true
fi
rm -f /tmp/programa-vdisplay-persistent.ready /tmp/programa-vdisplay-persistent.id /tmp/programa-vdisplay-persistent.log