Skip to content

Commit 358f51d

Browse files
committed
Merge branch 2.2.x into 2.3.x
2 parents e5508a7 + a62e61a commit 358f51d

2 files changed

Lines changed: 43 additions & 30 deletions

File tree

‎.github/workflows/phar.yml‎

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ permissions:
2020
contents: read
2121

2222
env:
23+
# Turbo binaries phpstan/phpstan used to carry but no compile leg builds any
24+
# more (paths under turbo-ext/, shell globs). The commit job deletes them
25+
# from the dist; without this, the torn-set guard there would refuse every
26+
# version bump, since a retired binary has no freshly built replacement.
27+
TURBO_RETIRED_BINARIES: "linux-gnu-x86_64/phpstan_turbo-*-zts.so linux-gnu-arm64/phpstan_turbo-*-zts.so"
2328
# The php-parser version whose grammar tables and semantic actions the
2429
# native parser engine (turbo-ext/src/parser/) was ported against.
2530
SUPPORTED_PHP_PARSER_VERSION: "v5.9.0"
@@ -340,12 +345,13 @@ jobs:
340345
# separate turbo-compile-musl-arm64 job below: JavaScript-based actions
341346
# cannot run in Alpine containers on arm64 runners (the runner only
342347
# ships an x64 musl Node), so that job drives the Alpine container
343-
# through docker exec instead of a `container:` leg. The ZTS legs (for
344-
# hosts with a thread-safe PHP, like PMMP's bundled build) run directly
345-
# on ubuntu-22.04 runners — same glibc floor — because no distro
346-
# packages ZTS PHP (neither ppa:ondrej/php nor Alpine); setup-php
347-
# provides thread-safe builds. No musl ZTS for the same packaging
348-
# reason.
348+
# through docker exec instead of a `container:` leg. There are no Linux
349+
# ZTS legs: every distro, ppa:ondrej/php, sury, Remi's default `php`, the
350+
# official Docker image and setup-php ship an NTS CLI, and thread-safe
351+
# PHP on Linux (FrankenPHP, php:*-zts images) is a few percent of hosts —
352+
# not worth two binaries per PHP minor. Their binaries are deleted from
353+
# phpstan/phpstan by the commit job (TURBO_RETIRED_BINARIES). Windows
354+
# keeps its ZTS leg: XAMPP, WampServer and Scoop default to TS PHP.
349355
# PHP 8.6 has no ondrej/php packages or prebuilt GNU image yet. Use
350356
# setup-php on Jammy runners, preserving the shipped binary's glibc floor.
351357
# Alpine's php86 packages are currently only in edge/testing.
@@ -373,16 +379,6 @@ jobs:
373379
container: "alpine:3.24"
374380
family: "musl"
375381
artifact: "phpstan_turbo"
376-
- name: "linux-gnu-x86_64"
377-
runs-on: "ubuntu-22.04"
378-
family: "zts"
379-
artifact: "phpstan_turbo"
380-
suffix: "-zts"
381-
- name: "linux-gnu-arm64"
382-
runs-on: "ubuntu-22.04-arm"
383-
family: "zts"
384-
artifact: "phpstan_turbo"
385-
suffix: "-zts"
386382
# arm64 (Apple Silicon) only: setup-php dropped Intel macOS. An
387383
# x86_64 PHP — native Intel, or Rosetta on Apple Silicon, which
388384
# reports x86_64 too — finds no binary: TurboExtensionSelector
@@ -442,20 +438,12 @@ jobs:
442438
php-version: "${{ matrix.php-version }}"
443439

444440
- name: "Install PHP (GNU runners)"
445-
if: matrix.target.family == 'zts' || (matrix.target.family == 'gnu' && matrix.php-version == '8.6')
441+
if: matrix.target.family == 'gnu' && matrix.php-version == '8.6'
446442
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # v2.37.2
447-
env:
448-
phpts: "${{ matrix.target.family == 'zts' && 'ts' || 'nts' }}"
449443
with:
450444
coverage: "none"
451445
php-version: "${{ matrix.php-version }}"
452446

453-
# Guards against setup-php silently falling back to an NTS build,
454-
# which would ship an NTS binary under the -zts name.
455-
- name: "Verify the interpreter is thread-safe"
456-
if: matrix.target.family == 'zts'
457-
run: "php -r 'exit((bool) PHP_ZTS ? 0 : 1);'"
458-
459447
# The training run of `make pgo` (bin/pgo-train.sh) runs bin/phpstan on
460448
# the checkout, so the dependencies must be in place before the build.
461449
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
@@ -467,7 +455,7 @@ jobs:
467455
if: matrix.target.family != 'macos'
468456
# checksum-pinned composer, run under the matrix PHP so platform
469457
# requirements are validated against the interpreter the tests below
470-
# run on. COMPOSER_HOME is isolated: on the runner (ZTS) legs,
458+
# run on. COMPOSER_HOME is isolated: on the runner (PHP 8.6) legs,
471459
# setup-php seeds ~/.composer/auth.json with the workflow's GitHub
472460
# token, which this pinned composer rejects at startup ("github oauth
473461
# token contains invalid characters") — everything here comes from
@@ -560,7 +548,7 @@ jobs:
560548
- name: "Upload extension artifact"
561549
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
562550
with:
563-
name: "${{ matrix.target.artifact }}-${{ matrix.target.name }}-php${{ matrix.php-version }}${{ matrix.target.suffix }}"
551+
name: "${{ matrix.target.artifact }}-${{ matrix.target.name }}-php${{ matrix.php-version }}"
564552
path: "turbo-ext/phpstan_turbo.so"
565553
if-no-files-found: "error"
566554

@@ -1072,6 +1060,10 @@ jobs:
10721060
php-version: ["8.3", "8.4", "8.5", "8.6"]
10731061
ts: ["nts", "zts"]
10741062
script: ["make tests", "make phpstan"]
1063+
# Linux ships no ZTS binary (see turbo-compile); Windows does
1064+
exclude:
1065+
- operating-system: "ubuntu-latest"
1066+
ts: "zts"
10751067
# macOS runs the shipped ad-hoc-signed arm64 binary; there is no
10761068
# macOS zts build, and 8.3/8.4 coverage comes from the other legs.
10771069
include:
@@ -1683,6 +1675,16 @@ jobs:
16831675
fi
16841676
done
16851677
done
1678+
# A retired binary still in the dist needs a commit deleting it,
1679+
# even at an unchanged extension version.
1680+
for pattern in $TURBO_RETIRED_BINARIES; do
1681+
for retired in phpstan-dist/turbo-ext/$pattern; do
1682+
if [[ -f "$retired" ]]; then
1683+
echo "retired, to be deleted from dist: $retired"
1684+
RESULT=different
1685+
fi
1686+
done
1687+
done
16861688
echo "result=$RESULT" >> "$GITHUB_OUTPUT"
16871689
echo "version-changed=$VERSION_CHANGED" >> "$GITHUB_OUTPUT"
16881690
echo "version=$EXPECTED" >> "$GITHUB_OUTPUT"
@@ -1734,6 +1736,16 @@ jobs:
17341736
TURBO_VERSION: ${{ steps.turbo-difference.outputs.version }}
17351737
VERSION_CHANGED: ${{ steps.turbo-difference.outputs.version-changed }}
17361738
run: |
1739+
# Retired targets go first: they have no replacement by design, and
1740+
# a stale one must not keep shipping (`git add .` stages the deletion).
1741+
for pattern in $TURBO_RETIRED_BINARIES; do
1742+
for retired in phpstan-dist/turbo-ext/$pattern; do
1743+
if [[ -f "$retired" ]]; then
1744+
echo "deleting retired binary: $retired"
1745+
rm -f "$retired"
1746+
fi
1747+
done
1748+
done
17371749
# A version bump must refresh EVERY binary the dist carries: staging a
17381750
# partial artifact set and bumping .version anyway would leave the
17391751
# missing platforms on a stale extension the new phar refuses to

‎src/Turbo/TurboExtensionSelector.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
* installations —
2929
* a source checkout loads its locally built extension through php.ini
3030
* instead. Only non-debug builds for PHP >= MINIMUM_PHP_VERSION_ID are
31-
* shipped; ZTS variants (-zts filename
32-
* suffix) exist for linux-gnu and Windows so hosts with a thread-safe PHP
33-
* (like PMMP's bundled build) are covered too. Workers run the regular
31+
* shipped; a ZTS variant (-zts filename
32+
* suffix) exists for Windows only, where XAMPP, WampServer and Scoop default
33+
* to thread-safe PHP — a thread-safe PHP on Linux or macOS finds no binary
34+
* and runs without the extension. Workers run the regular
3435
* entrypoint, so TurboExtensionEnabler still gates activation on the
3536
* expected extension version.
3637
*

0 commit comments

Comments
 (0)