Skip to content

Build and test PHP images together on native GitHub runners - #64

Merged
baschny merged 16 commits into
masterfrom
codex/php-build-workflow
Oct 21, 2026
Merged

baschny merged 16 commits into
masterfrom
codex/php-build-workflow

Conversation

@baschny

@baschny baschny commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Build FPM/SSH images together on native GitHub runners and verify upstream PHP patch versions before publishing. Each run resolves one immutable PHP base index per version branch, verifies that AMD64 and ARM64 agree on the full patch version, and uses those same bases for testing and publishing.

Changes

  • Build both targets with Docker Bake through shared PHP/extensions and SSH-tool stages. Apply runtime configuration after expensive dependencies so configuration edits retain cached layers.
  • Use native GitHub AMD64/ARM64 runners. Scope GitHub cache API v2 entries by target, PHP/Node version, and architecture; let SSH import the matching FPM cache.
  • Define version pairs in build-versions.json. A preparation job verifies both upstream architectures, records their full PHP versions and immutable index digests in its summary, and supplies the build and manifest matrices.
  • Require a nonempty expected-versions JSON map for manual release runs. Build only listed branches and reject unavailable/wrong patches, incomplete platform updates, unknown branches, and duplicate keys before building. PR runs resolve all configured branches; publishing runs are manual-only.
  • Explicitly pull referenced images. Both Bake invocations receive the same resolved PHP base digest; runtime tests assert the exact PHP patch in both final images.
  • Generate SSH host keys at daemon startup, preserve supplied keys, and protect clitools with root ownership and mode 0755.
  • Keep PR builds separate from registry credentials and require a manual release dispatch from master. Merging or pushing commits does not publish images. Test before candidate export, compare exported configuration digests with tested images, record base/patch information in digest artifacts, and verify artifact agreement before assembling public multi-platform tags.
  • Update Docker Hub descriptions once per repository after publishing. Document local builds and version-verified rebuilds in README.md and AGENTS.md.

Validation

Final GitHub Actions run: preparation plus all eight native version/architecture build/runtime jobs passed. All expensive compilation and installation steps were cache hits in every build (28–29 cached vertices per job). PR publishing steps were skipped.

  • 15 resolver unit tests passed, covering partial platform updates, old/wrong versions, invalid/duplicate inputs, branch selection, and bounded registry retries.
  • Live registry resolution verified all configured branches on both architectures. An unavailable expected patch was rejected.
  • Digest-pinned PHP 8.4 local build and complete runtime suite passed; an incorrect exact runtime version was rejected.
  • Native OrbStack builds/runtime suites passed for all four pairs. BuildKit checks, actionlint, and smoke-script ShellCheck passed.
  • Candidate export, image identity checks, and manifest creation were exercised against a temporary local registry; production Docker Hub publishing was not triggered.

Cold/warm cache benchmark: median Bake build/load/cache-export time dropped from 4m42s cold to 46s warm, approximately 6× faster. Runner setup and runtime tests are excluded from these timings.

@baschny
baschny merged commit e2ebef3 into master Oct 21, 2026
9 checks passed
@baschny
baschny deleted the codex/php-build-workflow branch October 21, 2026 23:36
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