Skip to content

ci: stop the Windows binary check rebuilding PHP on every run - #208

Merged
jasdeepkhalsa merged 1 commit into
masterfrom
claude/speed-up-windows-check
Sep 12, 2026
Merged

jasdeepkhalsa merged 1 commit into
masterfrom
claude/speed-up-windows-check

Conversation

@jasdeepkhalsa

Copy link
Copy Markdown
Member

The Windows job takes about 15 minutes on every pull request. Profiled:

727s  Build static PHP binary
153s  Combine PHP + PHAR -> binary
 30s  Install NASM
 11s  Smoke-test binary

The build should not be running at all

The Linux job caches the same artefacts, and its build step takes 1 second on a hit. The Windows cache was never being saved:

Failed to save: Unable to reserve cache with key spc-win32-x64-v1-php8.3-…

so every run compiled PHP from scratch.

The key included a hash of the whole workflow file, which produces a different key per branch and a fresh rebuild for any edit to that file — including edits to the Linux job, or a comment.

It is now keyed on the four values that actually determine the build: the SPC version, the PHP version, and the two extension lists. That is stable across branches, so the cache is written once and hit by everything afterwards.

restore-keys are deliberately not used. A prefix match would restore a buildroot compiled with a different extension set, producing a binary quietly missing extensions — which is precisely the failure this job exists to catch.

The combine step

Get-Content -AsByteStream pipes a ~30 MB concatenation through PowerShell's object pipeline one byte at a time. A stream copy does the same work in about a second.

Linux is untouched

Its cache restores and its build takes 1s. Rewriting a working fast path for consistency would risk more than it gains — the diff here touches no Linux line.

Expected result

About 15 minutes on the first run, which populates the cache, then roughly 1–2 minutes.

🤖 Generated with Claude Code

The job takes about 15 minutes. Profiling it:

  727s  Build static PHP binary
  153s  Combine PHP + PHAR -> binary
   30s  Install NASM
   11s  Smoke-test binary

The build dominates, and it should not be running at all. The Linux job caches
the same artefacts and its build step takes 1 second on a hit. The Windows
cache was never saved:

  Failed to save: Unable to reserve cache with key spc-win32-x64-v1-php8.3-...

so every run compiled PHP from scratch. The key included a hash of the whole
workflow file, which gives a different key per branch and a fresh rebuild for
any edit to the file — including edits to the Linux job or a comment.

The key is now over the four values that actually determine the build: the SPC
version, the PHP version, and the two extension lists. That is stable across
branches, so the cache is written once and hit by everything after it.

restore-keys are deliberately not used here. A prefix match would restore a
buildroot compiled with a different extension set, and the result would be a
binary quietly missing extensions — which is the failure this job exists to
catch.

The combine step piped a ~30 MB concatenation through PowerShell's object
pipeline one byte at a time. A stream copy does it in about a second.

The Linux job is untouched: its cache is restoring and its build takes 1s.
Rewriting a working fast path for consistency would risk more than it gains.

Expected: about 15 minutes on the first run that populates the cache, then
roughly 1-2 minutes.

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@jasdeepkhalsa
jasdeepkhalsa merged commit 809b33e into master Sep 12, 2026
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant