@@ -206,13 +206,15 @@ jobs:
206206 # Container legs pin the built binaries' userland floor independently of
207207 # the runner image: ubuntu:22.04 keeps the glibc symbol floor at 2.34
208208 # (RHEL 9, Ubuntu 22.04+, Debian 12+), alpine:3.24 builds the musl
209- # variant. There is no linux-musl-arm64 leg: JavaScript-based actions
210- # cannot run in Alpine containers on arm64 runners (the runner only
211- # ships an x64 musl Node). The ZTS legs (for hosts with a thread-safe
212- # PHP, like PMMP's bundled build) run directly on ubuntu-22.04 runners —
213- # same glibc floor — because no distro packages ZTS PHP (neither
214- # ppa:ondrej/php nor Alpine); setup-php provides thread-safe builds.
215- # No musl ZTS for the same packaging reason.
209+ # variant. The linux-musl-arm64 leg lives in the separate
210+ # turbo-compile-musl-arm64 job below: JavaScript-based actions cannot run
211+ # in Alpine containers on arm64 runners (the runner only ships an x64
212+ # musl Node), so that job drives the Alpine container through docker exec
213+ # instead of a `container:` leg. The ZTS legs (for hosts with a
214+ # thread-safe PHP, like PMMP's bundled build) run directly on
215+ # ubuntu-22.04 runners — same glibc floor — because no distro packages
216+ # ZTS PHP (neither ppa:ondrej/php nor Alpine); setup-php provides
217+ # thread-safe builds. No musl ZTS for the same packaging reason.
216218 container : ${{ matrix.target.container }}
217219 timeout-minutes : 30
218220
@@ -407,6 +409,118 @@ jobs:
407409 path : " turbo-ext/phpstan_turbo.so"
408410 if-no-files-found : " error"
409411
412+ turbo-compile-musl-arm64 :
413+ name : " Compile Turbo Extension (musl arm64)"
414+ # The arm64 counterpart of the linux-musl-x86_64 leg in turbo-compile.
415+ # It cannot be a `container: alpine` leg there: JavaScript-based actions
416+ # cannot run in Alpine containers on arm64 runners (the runner only
417+ # ships an x64 musl Node). Instead the workflow steps run on the arm64
418+ # host and only the build and test commands run inside a long-lived
419+ # Alpine container via docker exec — native arm64, no QEMU. The steps
420+ # mirror the musl leg of turbo-compile one for one.
421+ runs-on : " ubuntu-24.04-arm"
422+ timeout-minutes : 30
423+
424+ env :
425+ PHP_MINOR : ${{ matrix.php-version }}
426+
427+ strategy :
428+ fail-fast : false
429+ matrix :
430+ php-version : ["8.3", "8.4", "8.5"]
431+
432+ steps :
433+ - name : Harden the runner (Audit all outbound calls)
434+ uses : step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
435+ with :
436+ egress-policy : audit
437+
438+ - name : " Checkout"
439+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
440+ with :
441+ persist-credentials : false
442+ # The Makefile bakes the extension version via git log over the
443+ # watched paths; a shallow clone would resolve every build to the
444+ # checked-out commit itself — on pull requests the synthetic merge
445+ # commit, which matches nothing.
446+ fetch-depth : 0
447+
448+ - name : " Start the Alpine build container"
449+ run : |
450+ docker run -d --name alpine-build \
451+ -v "$PWD:/work" -w /work \
452+ -e PHP_MINOR -e COMPOSER_VERSION -e COMPOSER_PHAR_SHA256 \
453+ alpine:3.24 sleep 7200
454+
455+ - name : " Install PHP and build tools"
456+ run : |
457+ docker exec -i alpine-build sh -e <<'EOF'
458+ V="$(echo "$PHP_MINOR" | tr -d .)"
459+ apk add --no-cache bash curl git make g++ musl-dev linux-headers patch tar zstd \
460+ "php$V" "php$V-dev" "php$V-ctype" "php$V-curl" "php$V-mbstring" \
461+ "php$V-tokenizer" "php$V-iconv" "php$V-openssl" "php$V-phar" \
462+ "php$V-dom" "php$V-xml" "php$V-xmlwriter" "php$V-simplexml"
463+ ln -sf "/usr/bin/php$V" /usr/local/bin/php
464+ ln -sf "/usr/bin/php-config$V" /usr/local/bin/php-config
465+ EOF
466+
467+ # The workspace volume is owned by the host runner user while the
468+ # container runs as root, so git refuses the repo ("dubious
469+ # ownership") — which would silently bake the version as "dev" via
470+ # the Makefile's $(shell git log ...) fallback.
471+ - name : " Trust the checkout despite the container/host uid mismatch"
472+ run : docker exec alpine-build git config --global --add safe.directory /work
473+
474+ - name : " Compile phpstan_turbo with strict warnings"
475+ run : |
476+ docker exec -i -w /work/turbo-ext alpine-build sh -e <<'EOF'
477+ make WARN_FLAGS="-Wall -Wextra -Werror -Wno-assume -Wno-unused-parameter -Wno-unicode" -j"$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc)"
478+ EOF
479+
480+ - name : " Verify the built extension reports the expected version"
481+ run : |
482+ docker exec -i alpine-build sh -e <<'EOF'
483+ REPORTED="$(php -d extension="$PWD/turbo-ext/phpstan_turbo.so" -r 'echo phpversion("phpstan_turbo");')"
484+ EXPECTED="$(sed -n "s/.*EXPECTED_EXTENSION_VERSION = '\([^']*\)'.*/\1/p" src/Turbo/TurboExtensionEnabler.php)"
485+ echo "built extension reports: $REPORTED, enabler expects: $EXPECTED"
486+ [ "$REPORTED" = "$EXPECTED" ]
487+ EOF
488+
489+ - name : " Install Composer dependencies (pinned composer)"
490+ run : |
491+ docker exec -i alpine-build sh -e <<'EOF'
492+ curl -fsSLo composer.phar "https://getcomposer.org/download/$COMPOSER_VERSION/composer.phar"
493+ echo "$COMPOSER_PHAR_SHA256 composer.phar" | sha256sum -c -
494+ COMPOSER_HOME="$(mktemp -d)" php composer.phar install --no-interaction --no-progress
495+ rm composer.phar
496+ EOF
497+
498+ - name : " Smoke test (differential: native vs PHP implementations)"
499+ run : docker exec alpine-build php -d extension=/work/turbo-ext/phpstan_turbo.so turbo-ext/tests/smoke.php
500+
501+ - name : " Arena smoke test (cross-process shared-memory records)"
502+ run : docker exec alpine-build php -d extension=/work/turbo-ext/phpstan_turbo.so turbo-ext/tests/arena-smoke.php
503+
504+ - name : " Signature parity (reflect native classes against the PHP twins)"
505+ run : docker exec alpine-build php -d extension=/work/turbo-ext/phpstan_turbo.so turbo-ext/tests/signature-parity.php
506+
507+ - name : " Parser actions are generated (regenerate and diff)"
508+ run : |
509+ docker exec -i alpine-build sh -e <<'EOF'
510+ php turbo-ext/bin/generate-parser-actions.php
511+ git diff --exit-code turbo-ext/src/parser/
512+ EOF
513+
514+ - name : " Parser corpus (differential: native vs PHP ASTs must be byte-identical)"
515+ run : docker exec alpine-build php -d extension=/work/turbo-ext/phpstan_turbo.so -d memory_limit=4G turbo-ext/tests/parser-corpus.php
516+
517+ - name : " Upload extension artifact"
518+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
519+ with :
520+ name : " phpstan_turbo-linux-musl-arm64-php${{ matrix.php-version }}"
521+ path : " turbo-ext/phpstan_turbo.so"
522+ if-no-files-found : " error"
523+
410524 turbo-macos-universal :
411525 name : " Turbo macOS Universal Binary"
412526 needs : " turbo-compile"
@@ -605,6 +719,7 @@ jobs:
605719 name : " Aggregate Turbo Extension Artifact"
606720 needs :
607721 - turbo-compile
722+ - turbo-compile-musl-arm64
608723 - turbo-compile-windows
609724 - turbo-macos-universal
610725 runs-on : " ubuntu-latest"
@@ -937,6 +1052,7 @@ jobs:
9371052 - compiler-tests
9381053 - turbo-version
9391054 - turbo-compile
1055+ - turbo-compile-musl-arm64
9401056 - turbo-compile-windows
9411057 - turbo-macos-universal
9421058 runs-on : " ubuntu-latest"
0 commit comments