Skip to content

Cut CI from 44 minutes: build once, make the ghostty cache reachable, skip docs-only runs - #37

Merged
m96-chan merged 5 commits into
mainfrom
ci-skip-docs-only
Sep 14, 2026
Merged

m96-chan merged 5 commits into
mainfrom
ci-skip-docs-only

Conversation

@m96-chan

Copy link
Copy Markdown
Owner

Every pull request runs the whole job — libghostty-vt, three package suites, an app build, the notices check, and a full UI pass on an iPhone and an iPad. #34 took 44 minutes; the UI pass alone was 31 of them. A change to a Markdown file cannot affect any of it.

Why this is gated per step and not with paths-ignore

paths-ignore is the obvious implementation and it would have quietly broken the repository.

main requires the ios status check, and enforce_admins is on. When a workflow is skipped by path filtering the check is never reported at all, so it stays pending forever — and a documentation-only pull request becomes unmergeable by anybody, including you. A job that runs and skips its steps still reports ios, so branch protection stays satisfied and the job costs a few seconds.

What counts as unable to reach the build

Deliberately narrow: Markdown anywhere, and LICENSE at the repository root.

The app's sources are App/, its only extra bundled resource is the shortcut, and the notice generator reads Package.resolved, project.yml, scripts/build_ghostty_vt.sh and scripts/third_party_licenses — none of them Markdown. The root LICENSE is not the file the app bundles; that is App/Resources/ThirdPartyNotices.txt, which is not Markdown and therefore still builds.

Checked against the cases that matter:

Changed files Result
README.md docs/APP_STORE.md skip
LICENSE README.md skip (this is #33)
docs/DEVELOPMENT.jp.md skip
README.md App/ConnectionModel.swift build
App/Resources/ThirdPartyNotices.txt build
scripts/prepare_simulator.sh build
empty list build

One thing worth knowing

The condition tests grep -v's output, not its exit status. On the machine this was written on /usr/bin/grep is ugrep, where grep -qv returns 1 on input that plain grep -v reports with 0. The -q form — which is what I wrote first — skipped a pull request that changed a README and a Swift file. The runner's own grep does not behave that way, so it would have been green here and wrong only for whoever ran it locally.

Verification

This pull request is not documentation, so it runs the full job — which is the evidence that the gate does not break a code change. The skip path is exercised the first time a docs-only pull request runs it; #33 is exactly that shape and is a good first subject once this lands.

🤖 Generated with Claude Code

m96-chan and others added 2 commits September 14, 2026 23:04
Every pull request runs the whole job: build libghostty-vt, three package test
suites, an app build, the notices check, and a full UI pass on an iPhone and an
iPad. The last of those alone is 31 minutes. A change to a Markdown file cannot
affect any of it.

It is gated per step rather than with `paths-ignore`, which is the obvious way
and is wrong here. `ios` is a required status check on main and `enforce_admins`
is on, so a workflow that never runs leaves that check pending forever — and a
documentation-only pull request would become unmergeable by anybody, including
the repository owner. A job that runs and skips its steps still reports `ios`,
so branch protection is satisfied.

What counts as unable to reach the build is deliberately narrow: Markdown
anywhere, and `LICENSE` at the root. The app's sources are `App/`, its only
extra bundled resource is the shortcut, and the notice generator reads
`Package.resolved`, `project.yml`, `scripts/build_ghostty_vt.sh` and
`scripts/third_party_licenses` — none of them Markdown. `LICENSE` at the root is
not the file the app bundles; that is `App/Resources/ThirdPartyNotices.txt`,
which is not Markdown and so still builds. A pull request touching one Markdown
file and one source file builds, and so does an unexpectedly empty file list.

The condition tests `grep -v`'s output rather than its exit status. On the
machine this was written on, `/usr/bin/grep` is ugrep, where `grep -qv` returns
1 on input that `grep -v` reports with 0 — the `-q` form would have skipped a
pull request that changed a README *and* a Swift file. The runner's own grep
does not behave that way, so this would have been invisible in CI and wrong
only for whoever ran it locally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…eachable

Measured on #34's run — 44 minutes, of which the two test destinations were 31.
Splitting that 31 by log timestamps says half of it never ran a test:

  iPhone  prepare simulator 3m31s, build and install ~5m, tests 5m03s
  iPad    prepare simulator 3m31s, build and install 3m45s, tests 9m53s

The rebuild before the iPad's first test is the part worth explaining. A
destination change gives Xcode a different build description, so
`generic/platform=iOS Simulator` for `make build`, then the iPhone, then the
iPad each built from scratch into the same derived data — three builds of the
same sources, two of which produced nothing the previous one had not.

So the app and its test bundles are built once, for both destinations, with
`build-for-testing`, and each idiom runs `test-without-building` against it.
`make build`'s generic destination goes with it: the two concrete simulators
cover the same compilation, and what they do not cover is a simulator
architecture no runner has.

The iPad step now runs even when the iPhone step failed. The build is already
paid for by then, and one run that reports both idioms is one round trip rather
than two, which is the thing that actually costs time when a pull request is
waiting.

Separately, every pull request was spending about four minutes installing Zig
and compiling libghostty-vt at a pin that has not moved in weeks. Not a key
problem — a scoping one. `ci.yml` only runs on `pull_request`, so the only
caches it ever wrote were under `refs/pull/N/merge`, which no sibling pull
request can read: five entries existed, under five different pull requests, all
under the same key, none of them reachable by anyone. cache-ghostty.yml writes
one from a push to main, where every pull request opened against main can
restore it.

Untouched on purpose: the two `scripts/prepare_simulator.sh` calls are 3m31s
each and still sequential. Preparing them concurrently means two processes
writing `com.apple.iphonesimulator DevicePreferences` at once, and that
preference is the one keeping the hardware keyboard away from the test that
#32 added. Seven minutes is not worth reintroducing that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@m96-chan m96-chan changed the title Stop spending 45 minutes proving a typo in a README is safe Cut CI from 44 minutes: build once, make the ghostty cache reachable, skip docs-only runs Sep 14, 2026
m96-chan and others added 3 commits September 14, 2026 23:22
The iPhone and iPad passes were sequential and were half the run on their own.
They share nothing except the build, so they are now a matrix of two jobs, with
`fail-fast: false` so one idiom failing still reports the other — one round trip
rather than two, which is what actually costs time when a pull request is
waiting.

Four jobs now:

  scope     the docs-only decision, on Linux, seconds
  packages  the three package suites, which never needed the app
  build     build-for-testing once, the notices check, and the bundles
  test      iPhone and iPad in parallel, test-without-building

`packages` no longer waits behind an app build it does not use, so a package
failure surfaces in about six minutes rather than ten.

The build is `generic/platform=iOS Simulator` again, which is right for this
shape: `build-for-testing` produces one .xctestrun both idioms consume, and the
test jobs never build, so no destination gives Xcode a reason to rebuild. Both
runners use the same working directory, so the .xctestrun's paths resolve on the
machine that downloads it.

`ios` is kept as a job whose only purpose is to carry the verdict. It is the
required status check on main and `enforce_admins` is on, so exactly one check
has to report under that name however the work is arranged — and it has to
report on a documentation-only pull request too, where every other job is
skipped. A required check that never reports leaves the pull request unmergeable
by anybody, including an administrator.

Simulator preparation starts in the background before the artifact download
rather than after it, because it is mostly waiting for a boot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`generic/platform=iOS Simulator` cannot build AppTests: it reaches into the app
with `@testable import iOSSH`, and the generic destination builds for more than
one architecture, which leaves the test host's module unresolvable —
"unable to resolve module dependency: 'iOSSH'".

The simulator picked here is neither booted nor the device the tests run on.
Every simulator on a runner is the same architecture, so the one .xctestrun this
produces still runs on both idioms.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Each `run:` step is a separate process, so backgrounding the preparation in one
step and waiting for it in the next hands `wait` a pid that is not its child:
"wait: pid 1666 is not a child of this shell", exit 127, on both idioms.

The overlap it was buying was a minute or two of boot against the artifact
download. Not worth carrying a process across steps for, so it runs in order.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@m96-chan m96-chan mentioned this pull request Sep 14, 2026
@m96-chan
m96-chan merged commit a1b8031 into main Sep 14, 2026
6 checks passed
@m96-chan
m96-chan deleted the ci-skip-docs-only branch September 14, 2026 15:25
m96-chan added a commit that referenced this pull request Sep 15, 2026
… not there (#42)

main has been red on every push since #38. The `scope` job reads the changed
files from `repos/OWNER/REPO/pulls/NUMBER/files`, and on a push event
`github.event.pull_request.number` is empty, so the request goes to `/pulls//files`
and comes back 404. `scope` fails, every job that needs it is skipped, and the
`ios` check reports the failure.

#37 added `scope` for pull requests and #38 added the push trigger. Each was
green on its own; the combination was never run before it was on main.

A push has nothing to skip anyway. What reached main is worth building, and that
run is the only thing that reports on it now that the required check cannot.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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