cmux/tests/test_ci_self_hosted_guard.sh
Lawrence Chen 225588ccfc
Split CI: GitHub runners for tests, Depot for perf regression (#773)
* Split CI: GitHub runners for tests, Depot for perf regression

Unit/UI tests move to macos-15 (no queue wait, fast enough for test
suites). Typing-lag regression stays on Depot in a new tests-depot job
(needs stronger hardware). No duplicated test work between the two.

* Fix Xcode selection: add pipefail guard, use sort|tail for consistency

Address review comments:
- tests job: add || true to ls pipeline so fallback works under pipefail
- tests-depot job: use sort | tail -n 1 instead of head -n 1

* Move XCUITests from GitHub runner to Depot

tests (macos-15) now runs unit tests only. tests-depot (Depot) runs
UI tests and the typing-lag regression, reusing the same build.
2026-03-02 21:31:39 -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-depot:/ { 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-depot block must keep both depot-macos-latest runner and fork guard"
exit 1
fi
echo "PASS: tests-depot Depot runner fork guard is present"