Skip to content

ci(e2e): start the iOS test database in the background - #62

Merged
grimen merged 2 commits into
mainfrom
ci/ios-postgres-background
Sep 4, 2026
Merged

grimen merged 2 commits into
mainfrom
ci/ios-postgres-background

Conversation

@grimen

@grimen grimen commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #61, which cut the iOS job's Homebrew Postgres step by skipping the auto-update. What remains (~1 min of bottle download + pour) still sat on the critical path between Metro start and migrations.

The steps before the database is needed (npm ci, Maestro install, simulator pick, Metro start) add up to ~100 s, so the install now runs in the background from right after checkout, and a Wait for test database step joins it just before migrations.

scripts/ci/postgres-brew.sh gains two modes:

  • background: nohup the existing start flow, record its pid and log under $RUNNER_TEMP.
  • wait: poll pg_isready on esign_test for up to 5 min. If the background process has exited without writing SETUP_OK, dump its log and fail immediately instead of timing out (tested locally with a dead pid: fails in <1 s with the log shown).

start is unchanged, so running the script by hand still works.

Measurements (E2E / iOS job, seconds; non-Maestro = total minus the Maestro step, which varies 343-914 s on its own)

Run DB on critical path migrations Metro prewarm non-Maestro total job total
baseline main cb7a1a8 220 8 136 643 1015
#61 PR run (skip auto-update) 150 6 48 382 974
#61 on main 321 5 26 529 927
this PR, attempt 1 (Maestro driver flake, timed out) 26 78 73 381 1295
this PR, attempt 2 2 69 161 484 827

Reading: the database is off the critical path (2 s), but migrations and the Metro prewarm now overlap the simulator boot and Metro bundling instead of a Homebrew wait, and on a 3-vCPU runner they absorb roughly a minute of it. The step that used to cost 150-321 s (Homebrew is that variable even without the auto-update) now costs ~2 s, so the change removes the unbounded part; the contention cost is bounded.

Attempt 1 failed in Maestro with Failed to connect to /127.0.0.1:53720 (the iOS XCTest driver, #41 class) on a runner that was slow from the first step; attempt 2 on the same commit passed with Maestro at 343 s.

Even without the auto-update, brew install postgresql@16 is ~1 min of
download and pour that sat on the iOS job's critical path between Metro
start and migrations. The steps before the database is needed (npm ci,
Maestro install, simulator pick, Metro start) add up to ~100 s, so the
install now runs in the background from right after checkout and a wait
step joins it just before migrations.

postgres-brew.sh grows two modes: background (nohup start, records pid +
log) and wait (poll pg_isready up to 5 min; if the background process has
exited without SETUP_OK, dump its log and fail immediately rather than
time out). start is unchanged.
The wait step spent ~22 s of its 25 s inside brew --prefix (Ruby startup
on a busy runner); HOMEBREW_PREFIX is exported on the runner images.
@grimen
grimen merged commit 5586373 into main Sep 4, 2026
18 checks passed
@grimen
grimen deleted the ci/ios-postgres-background branch September 4, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant