From e799188e2c401d54dfc39bd10eb338e05d5bf474 Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Fri, 18 Sep 2026 15:14:59 +0200 Subject: [PATCH 1/2] Use the runner's preinstalled PHP to run static-php-cli on macOS Co-Authored-By: Claude Opus 5 --- .github/workflows/build-php-cli-binaries.yml | 35 +++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-php-cli-binaries.yml b/.github/workflows/build-php-cli-binaries.yml index 6d17471f61..4b68b27cb9 100644 --- a/.github/workflows/build-php-cli-binaries.yml +++ b/.github/workflows/build-php-cli-binaries.yml @@ -129,16 +129,33 @@ jobs: - name: Setup PHP for static-php-cli # Linux runs SPC inside the spc-gnu-docker container, which ships # its own PHP + Composer; host PHP is only needed for the macOS path. + # + # Uses the runner image's own PHP rather than shivammathur/setup-php: + # that action installs from the shivammathur/php tap, which no longer + # publishes x86_64 macOS bottles. On macos-15-intel brew then fell back + # to building PHP from source and the step timed out after ~30 minutes, + # failing every macos-x86_64 build. SPC only needs PHP >= 8.3 with + # mbstring and zlib, all of which the image already provides. if: runner.os == 'macOS' - uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 - with: - coverage: none - tools: composer:v2 - php-version: 8.4 - ini-values: memory_limit=-1 - extensions: curl, openssl, mbstring - env: - phpts: nts + shell: bash + run: | + set -euo pipefail + + if ! command -v php >/dev/null || ! command -v composer >/dev/null; then + echo "Expected PHP and Composer to be preinstalled on the runner image." >&2 + exit 1 + fi + + php -r 'exit(version_compare(PHP_VERSION, "8.3", ">=") ? 0 : 1);' \ + || { echo "static-php-cli needs PHP >= 8.3, found $(php -r 'echo PHP_VERSION;')." >&2; exit 1; } + + for extension in mbstring zlib; do + php -m | grep -qix "$extension" \ + || { echo "Required PHP extension missing: $extension." >&2; exit 1; } + done + + php -v + composer --version - name: Install static-php-cli dependencies # See above — composer install for Linux happens inside the container. From 2506f0b075dd5c0f3e0aa82d793cec60bddbef9e Mon Sep 17 00:00:00 2001 From: Wojtek Naruniec Date: Fri, 18 Sep 2026 15:20:26 +0200 Subject: [PATCH 2/2] Keep setup-php on the arm64 macOS runner, which preinstalls no PHP Co-Authored-By: Claude Opus 5 --- .github/workflows/build-php-cli-binaries.yml | 38 ++++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-php-cli-binaries.yml b/.github/workflows/build-php-cli-binaries.yml index 4b68b27cb9..0b7f60f777 100644 --- a/.github/workflows/build-php-cli-binaries.yml +++ b/.github/workflows/build-php-cli-binaries.yml @@ -126,23 +126,39 @@ jobs: echo "PHP_MINOR=$php_minor" >> "$GITHUB_ENV" echo "PHP_PACKAGE_ID=$PHP_VERSION-$PHP_PACKAGE_VERSION" >> "$GITHUB_ENV" + # Linux runs SPC inside the spc-gnu-docker container, which ships its own + # PHP + Composer; host PHP is only needed for the macOS path. The two + # macOS runners need different treatment: + # + # - macos-15-intel preinstalls PHP and Composer, and cannot use + # shivammathur/setup-php: that action installs from the + # shivammathur/php tap, which no longer publishes x86_64 macOS + # bottles. brew then falls back to building PHP from source and the + # step times out after ~30 minutes, failing every macos-x86_64 build. + # - macos-15 (arm64) preinstalls neither, so it keeps using the action, + # which resolves an arm64 bottle quickly. + # + # SPC only needs PHP >= 8.3 with mbstring and zlib. - name: Setup PHP for static-php-cli - # Linux runs SPC inside the spc-gnu-docker container, which ships - # its own PHP + Composer; host PHP is only needed for the macOS path. - # - # Uses the runner image's own PHP rather than shivammathur/setup-php: - # that action installs from the shivammathur/php tap, which no longer - # publishes x86_64 macOS bottles. On macos-15-intel brew then fell back - # to building PHP from source and the step timed out after ~30 minutes, - # failing every macos-x86_64 build. SPC only needs PHP >= 8.3 with - # mbstring and zlib, all of which the image already provides. - if: runner.os == 'macOS' + if: matrix.target == 'macos-aarch64' + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 + with: + coverage: none + tools: composer:v2 + php-version: 8.4 + ini-values: memory_limit=-1 + extensions: mbstring, zlib + env: + phpts: nts + + - name: Verify preinstalled PHP for static-php-cli + if: matrix.target == 'macos-x86_64' shell: bash run: | set -euo pipefail if ! command -v php >/dev/null || ! command -v composer >/dev/null; then - echo "Expected PHP and Composer to be preinstalled on the runner image." >&2 + echo "Expected PHP and Composer to be preinstalled on the macOS Intel runner image." >&2 exit 1 fi