cmux/tests/test_ci_self_hosted_guard.sh
Lawrence Chen 58bb9bc655
Migrate all workflows from self-hosted Mac Mini to Depot runners (#730)
* Migrate all workflows from self-hosted Mac Mini to Depot runners

Move CI, nightly, and release workflows to depot-macos-latest. Replace
zig GhosttyKit builds with pre-built xcframework downloads. Add virtual
display for CI UI tests. Remove concurrency groups (ephemeral VMs don't
need them).

* Add per-test timeout to CI UI tests to prevent hangs on Depot

SidebarResizeUITests hangs on headless Depot runners due to mouse drag
simulation issues. Adding -maximum-test-execution-time-allowance 120
(matching test-depot.yml) ensures individual tests timeout after 2 min
instead of blocking the entire run.

* Skip SidebarResizeUITests in CI on Depot runners

Mouse drag simulation hangs on headless Depot runners even with a
virtual display. The per-test timeout doesn't prevent the hang either.
Skip this test class in CI; it still runs fine on local machines.

* Handle XCTExpectFailure in CI UI tests (exit 65 with 0 unexpected)

xcodebuild exits 65 even when all failures use XCTExpectFailure. Add
the same expected-failure handling from the unit test step so browser
focus tests (which are expected to fail on headless runners) don't
break CI.
2026-03-01 19:06:45 -08:00

29 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Regression test for https://github.com/manaflow-ai/cmux/issues/385.
# Ensures Depot-hosted UI tests are never run for fork pull requests.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
WORKFLOW_FILE="$ROOT_DIR/.github/workflows/ci.yml"
EXPECTED_IF="if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository"
if ! grep -Fq "$EXPECTED_IF" "$WORKFLOW_FILE"; then
echo "FAIL: Missing fork pull_request guard for tests in $WORKFLOW_FILE"
echo "Expected line:"
echo " $EXPECTED_IF"
exit 1
fi
if ! awk '
/^ tests:/ { in_tests=1; next }
in_tests && /^ [^[:space:]]/ { in_tests=0 }
in_tests && /runs-on: depot-macos-latest/ { saw_depot=1 }
in_tests && /github.event.pull_request.head.repo.full_name == github.repository/ { saw_guard=1 }
END { exit !(saw_depot && saw_guard) }
' "$WORKFLOW_FILE"; then
echo "FAIL: tests block must keep both depot-macos-latest runner and fork guard"
exit 1
fi
echo "PASS: tests Depot runner fork guard is present"