Skip to content

Commit 767a56f

Browse files
committed
Compile and test Turbo on PHP 8.6
1 parent 0543450 commit 767a56f

2 files changed

Lines changed: 101 additions & 23 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# setup-php supplies Composer, php.ini and CA certificates, but its 8.6
5+
# nightly has no matching development pack. Replace the runtime and bundled
6+
# extensions with the official prerelease, preserving that configuration.
7+
PHP_DIR="$(cygpath -u "$(php -r 'echo dirname(PHP_BINARY);')")"
8+
case "$MATRIX_TS" in
9+
zts) INFIX="" ;;
10+
nts) INFIX="-nts" ;;
11+
*) echo "Unknown thread-safety mode: $MATRIX_TS" >&2; exit 1 ;;
12+
esac
13+
PACK="php-$PHP86_WINDOWS_VERSION$INFIX-Win32-vs18-x64.zip"
14+
ARCHIVE="$RUNNER_TEMP/$PACK"
15+
curl -fsSLo "$ARCHIVE" "https://downloads.php.net/~windows/qa/$PACK" \
16+
|| curl -fsSLo "$ARCHIVE" "https://downloads.php.net/~windows/qa/archives/$PACK"
17+
unzip -qo "$ARCHIVE" -d "$PHP_DIR"
18+
php -r '
19+
if (PHP_VERSION !== getenv("PHP86_WINDOWS_VERSION") || (bool) PHP_ZTS !== (getenv("MATRIX_TS") === "zts")) {
20+
fwrite(STDERR, "PHP prerelease version or thread-safety mismatch\n");
21+
exit(1);
22+
}
23+
echo "Using PHP ", PHP_VERSION, PHP_ZTS ? " ZTS\n" : " NTS\n";
24+
'

‎.github/workflows/phar.yml‎

Lines changed: 77 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ env:
2929
# distro-default PHP.
3030
COMPOSER_VERSION: "2.9.2"
3131
COMPOSER_PHAR_SHA256: "471f2d857abf0ec18af7b055e61472214d91adb24f9bdbbb864c1c64faad7dd6"
32+
# setup-php installs an 8.6 nightly, which has no matching Windows devel pack.
33+
PHP86_WINDOWS_VERSION: "8.6.0beta3"
3234

3335
jobs:
3436
compiler-tests:
@@ -319,9 +321,9 @@ jobs:
319321
320322
turbo-compile:
321323
name: "Compile Turbo Extension"
322-
runs-on: ${{ matrix.target.runs-on }}
324+
runs-on: ${{ matrix.php-version == '8.6' && matrix.target.family == 'gnu' && (matrix.target.name == 'linux-gnu-arm64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04') || matrix.target.runs-on }}
323325
# Container legs pin the built binaries' userland floor independently of
324-
# the runner image. The gnu legs run in a prebuilt ubuntu:22.04-based
326+
# the runner image. The 8.3–8.5 gnu legs run in a prebuilt ubuntu:22.04-based
325327
# image (.github/turbo-build/Dockerfile, published to GHCR by
326328
# turbo-build-image.yml) with the PHP toolchain baked in: the glibc
327329
# symbol floor stays at 2.34 (RHEL 9, Ubuntu 22.04+, Debian 12+) and the
@@ -339,7 +341,10 @@ jobs:
339341
# packages ZTS PHP (neither ppa:ondrej/php nor Alpine); setup-php
340342
# provides thread-safe builds. No musl ZTS for the same packaging
341343
# reason.
342-
container: ${{ matrix.target.family == 'gnu' && format('ghcr.io/phpstan/turbo-build:gnu-php{0}', matrix.php-version) || matrix.target.container }}
344+
# PHP 8.6 has no ondrej/php packages or prebuilt GNU image yet. Use
345+
# setup-php on Jammy runners, preserving the shipped binary's glibc floor.
346+
# Alpine's php86 packages are currently only in edge/testing.
347+
container: ${{ matrix.target.family == 'gnu' && matrix.php-version != '8.6' && format('ghcr.io/phpstan/turbo-build:gnu-php{0}', matrix.php-version) || matrix.target.family == 'musl' && matrix.php-version == '8.6' && 'alpine:edge' || matrix.target.container }}
343348
timeout-minutes: 30
344349

345350
env:
@@ -348,7 +353,7 @@ jobs:
348353
strategy:
349354
fail-fast: false
350355
matrix:
351-
php-version: ["8.3", "8.4", "8.5"]
356+
php-version: ["8.3", "8.4", "8.5", "8.6"]
352357
target:
353358
- name: "linux-gnu-x86_64"
354359
runs-on: "ubuntu-latest"
@@ -391,13 +396,15 @@ jobs:
391396

392397
# The Alpine leg installs PHP and tooling before checkout:
393398
# actions/checkout needs git inside the container, and the build needs
394-
# php/php-config symlinks pointing at the matrix PHP version. The gnu
395-
# legs need no install step — their prebuilt turbo-build image bakes
396-
# all of this in.
399+
# php/php-config symlinks pointing at the matrix PHP version. The GNU
400+
# container legs have the toolchain baked in; 8.6 uses setup-php below.
397401
- name: "Install PHP and build tools (Alpine container)"
398402
if: matrix.target.family == 'musl'
399403
run: |
400404
V="$(echo "$PHP_MINOR" | tr -d .)"
405+
if [ "$PHP_MINOR" = "8.6" ]; then
406+
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
407+
fi
401408
apk add --no-cache bash curl git make g++ musl-dev linux-headers patch tar zstd \
402409
"php$V" "php$V-dev" "php$V-ctype" "php$V-curl" "php$V-mbstring" \
403410
"php$V-tokenizer" "php$V-iconv" "php$V-openssl" "php$V-phar" \
@@ -429,11 +436,11 @@ jobs:
429436
coverage: "none"
430437
php-version: "${{ matrix.php-version }}"
431438

432-
- name: "Install PHP (ZTS runner)"
433-
if: matrix.target.family == 'zts'
439+
- name: "Install PHP (GNU runners)"
440+
if: matrix.target.family == 'zts' || (matrix.target.family == 'gnu' && matrix.php-version == '8.6')
434441
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # v2.37.2
435442
env:
436-
phpts: "ts"
443+
phpts: "${{ matrix.target.family == 'zts' && 'ts' || 'nts' }}"
437444
with:
438445
coverage: "none"
439446
php-version: "${{ matrix.php-version }}"
@@ -545,7 +552,7 @@ jobs:
545552
strategy:
546553
fail-fast: false
547554
matrix:
548-
php-version: ["8.3", "8.4", "8.5"]
555+
php-version: ["8.3", "8.4", "8.5", "8.6"]
549556

550557
steps:
551558
- name: Harden the runner (Audit all outbound calls)
@@ -564,16 +571,21 @@ jobs:
564571
fetch-depth: 0
565572

566573
- name: "Start the Alpine build container"
574+
env:
575+
ALPINE_IMAGE: ${{ matrix.php-version == '8.6' && 'alpine:edge' || 'alpine:3.24' }}
567576
run: |
568577
docker run -d --name alpine-build \
569578
-v "$PWD:/work" -w /work \
570579
-e PHP_MINOR -e COMPOSER_VERSION -e COMPOSER_PHAR_SHA256 \
571-
alpine:3.24 sleep 7200
580+
"$ALPINE_IMAGE" sleep 7200
572581
573582
- name: "Install PHP and build tools"
574583
run: |
575584
docker exec -i alpine-build sh -e <<'EOF'
576585
V="$(echo "$PHP_MINOR" | tr -d .)"
586+
if [ "$PHP_MINOR" = "8.6" ]; then
587+
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
588+
fi
577589
apk add --no-cache bash curl git make g++ musl-dev linux-headers patch tar zstd \
578590
"php$V" "php$V-dev" "php$V-ctype" "php$V-curl" "php$V-mbstring" \
579591
"php$V-tokenizer" "php$V-iconv" "php$V-openssl" "php$V-phar" \
@@ -666,7 +678,7 @@ jobs:
666678
# token-numbering bug: 2462 of 21065 tests fail and self-analysis
667679
# crashes on the Bison 3.0.4 image, both green on the matched one).
668680
# The 8.3 images are pinned to one release of each known numbering;
669-
# 8.4/8.5 float on the minor tag on purpose so that a future patch
681+
# 8.4/8.5 float on the minor tag and 8.6 on the prerelease tag so a future
670682
# release with a surprising build is picked up on the next run without
671683
# a workflow change. Legs run on linux-gnu-x86_64 only: the token
672684
# numbering comes from the bison that generated the tarball's parser,
@@ -677,6 +689,9 @@ jobs:
677689
runs-on: "ubuntu-latest"
678690
timeout-minutes: 60
679691

692+
env:
693+
IMAGE: ${{ matrix.php-version == '8.6' && 'phpstan-turbo-test:8.6' || matrix.image }}
694+
680695
permissions:
681696
contents: read
682697

@@ -688,6 +703,7 @@ jobs:
688703
- "php:8.3.22-cli-bookworm"
689704
- "php:8.4-cli-bookworm"
690705
- "php:8.5-cli-bookworm"
706+
- "php:8.6-rc-cli-bookworm"
691707
check: ["tests", "phpstan"]
692708
include:
693709
- image: "php:8.3.21-cli-bookworm"
@@ -698,6 +714,8 @@ jobs:
698714
php-version: "8.4"
699715
- image: "php:8.5-cli-bookworm"
700716
php-version: "8.5"
717+
- image: "php:8.6-rc-cli-bookworm"
718+
php-version: "8.6"
701719
# The tests legs invoke paratest directly instead of a literal
702720
# `make tests`: its install-paratest step needs a composer, which
703721
# the images do not carry — tests/vendor is installed on the
@@ -741,12 +759,25 @@ jobs:
741759
name: "phpstan_turbo-linux-gnu-x86_64-php${{ matrix.php-version }}"
742760
path: "turbo-ext"
743761

762+
- name: "Add mbstring to the PHP 8.6 prerelease image"
763+
if: matrix.php-version == '8.6'
764+
env:
765+
PHP_IMAGE: ${{ matrix.image }}
766+
# Unlike the stable images, the 8.6 prerelease omits mbstring,
767+
# which PHPUnit and PHPStan's test fixtures require.
768+
run: |
769+
docker build --build-arg "PHP_IMAGE=$PHP_IMAGE" -t "$IMAGE" - <<'DOCKERFILE'
770+
ARG PHP_IMAGE
771+
FROM ${PHP_IMAGE}
772+
RUN apt-get update && apt-get install -y --no-install-recommends libonig-dev \
773+
&& docker-php-ext-install mbstring \
774+
&& rm -rf /var/lib/apt/lists/*
775+
DOCKERFILE
776+
744777
# Fast fail with a one-line diagnosis: a token-numbering mismatch
745778
# would otherwise surface as thousands of unrelated-looking failures
746779
# in the suite run below.
747780
- name: "Token-id probe in ${{ matrix.image }}"
748-
env:
749-
IMAGE: ${{ matrix.image }}
750781
run: docker run --rm -v "$PWD:/work" -w /work "$IMAGE" php -d extension=/work/turbo-ext/phpstan_turbo.so turbo-ext/tests/token-id-probe.php
751782

752783
# Bind-mounted into conf.d of every docker run below. The images
@@ -756,8 +787,6 @@ jobs:
756787
run: printf 'extension=/work/turbo-ext/phpstan_turbo.so\nmemory_limit=-1\n' > "$RUNNER_TEMP/turbo-docker.ini"
757788

758789
- name: "Verify the extension is active in ${{ matrix.image }}"
759-
env:
760-
IMAGE: ${{ matrix.image }}
761790
run: |
762791
docker run --rm -v "$PWD:/work" -v "$RUNNER_TEMP/turbo-docker.ini:/usr/local/etc/php/conf.d/zz-turbo.ini" -w /work "$IMAGE" php -r '
763792
require "src/Turbo/TurboExtensionEnabler.php";
@@ -773,7 +802,6 @@ jobs:
773802
# --shm-size: the arena allocates cross-worker shared memory, and
774803
# docker's default 64M /dev/shm makes parallel analysis SIGBUS.
775804
env:
776-
IMAGE: ${{ matrix.image }}
777805
SCRIPT: ${{ matrix.script }}
778806
run: docker run --rm --shm-size=1g -v "$PWD:/work" -v "$RUNNER_TEMP/turbo-docker.ini:/usr/local/etc/php/conf.d/zz-turbo.ini" -w /work "$IMAGE" bash -c "$SCRIPT"
779807

@@ -784,7 +812,8 @@ jobs:
784812
# toolset 14.4x) refuse to load — PHP's loader rejects modules linked
785813
# with a newer toolset generation than the core. The windows-2022 image
786814
# is the one that ships VS2022.
787-
runs-on: "windows-2022"
815+
# PHP 8.6's vs18 development packs need the VS2026 toolchain.
816+
runs-on: ${{ matrix.php-version == '8.6' && 'windows-2025-vs2026' || 'windows-2022' }}
788817
timeout-minutes: 40
789818

790819
env:
@@ -795,7 +824,7 @@ jobs:
795824
strategy:
796825
fail-fast: false
797826
matrix:
798-
php-version: ["8.3", "8.4", "8.5"]
827+
php-version: ["8.3", "8.4", "8.5", "8.6"]
799828
ts: ["nts", "zts"]
800829
# The official 8.3 Windows binaries are built with VS16 (linker
801830
# 14.2x) and PHP's module loader is one-directional (module toolset
@@ -810,6 +839,8 @@ jobs:
810839
vs: "vs17"
811840
- php-version: "8.5"
812841
vs: "vs17"
842+
- php-version: "8.6"
843+
vs: "vs18"
813844

814845
steps:
815846
- name: "Checkout"
@@ -828,6 +859,13 @@ jobs:
828859
coverage: "none"
829860
php-version: "${{ matrix.php-version }}"
830861

862+
- name: "Install the matching PHP 8.6 prerelease runtime"
863+
if: matrix.php-version == '8.6'
864+
shell: bash
865+
env:
866+
MATRIX_TS: ${{ matrix.ts }}
867+
run: bash .github/scripts/install-php86-windows.sh
868+
831869
- name: "Compute the extension version and download the build tools"
832870
shell: bash
833871
env:
@@ -844,7 +882,9 @@ jobs:
844882
PACK="php-devel-pack-$FULL$INFIX-Win32-$MATRIX_VS-x64.zip"
845883
echo "devel pack: $PACK"
846884
curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/$PACK" \
847-
|| curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/archives/$PACK"
885+
|| curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/archives/$PACK" \
886+
|| curl -fsSLo devel-pack.zip "https://downloads.php.net/~windows/qa/$PACK" \
887+
|| curl -fsSLo devel-pack.zip "https://downloads.php.net/~windows/qa/archives/$PACK"
848888
unzip -q devel-pack.zip -d /c/php-devel
849889
850890
git clone -q https://github.com/php/php-sdk-binary-tools.git /c/php-sdk
@@ -854,7 +894,7 @@ jobs:
854894
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
855895
with:
856896
arch: x64
857-
# empty on the vs17 legs = the image's default (latest) toolset
897+
# empty on the vs17/vs18 legs = the image's default toolset
858898
toolset: ${{ matrix.toolset }}
859899

860900
- name: "Build the extension"
@@ -989,7 +1029,7 @@ jobs:
9891029
# vs17-built official PHP loads it fine.
9901030
matrix:
9911031
operating-system: ["ubuntu-latest", "windows-latest"]
992-
php-version: ["8.3", "8.4", "8.5"]
1032+
php-version: ["8.3", "8.4", "8.5", "8.6"]
9931033
ts: ["nts", "zts"]
9941034
script: ["make tests", "make phpstan"]
9951035
# macOS runs the shipped ad-hoc-signed arm64 binary; there is no
@@ -1003,6 +1043,14 @@ jobs:
10031043
php-version: "8.5"
10041044
ts: "nts"
10051045
script: "make phpstan"
1046+
- operating-system: "macos-latest"
1047+
php-version: "8.6"
1048+
ts: "nts"
1049+
script: "make tests"
1050+
- operating-system: "macos-latest"
1051+
php-version: "8.6"
1052+
ts: "nts"
1053+
script: "make phpstan"
10061054

10071055
steps:
10081056
- name: Harden the runner (Audit all outbound calls)
@@ -1023,6 +1071,12 @@ jobs:
10231071
coverage: "none"
10241072
php-version: "${{ matrix.php-version }}"
10251073

1074+
- name: "Install the matching PHP 8.6 prerelease runtime"
1075+
if: matrix.operating-system == 'windows-latest' && matrix.php-version == '8.6'
1076+
env:
1077+
MATRIX_TS: ${{ matrix.ts }}
1078+
run: bash .github/scripts/install-php86-windows.sh
1079+
10261080
- name: "Download extension artifact"
10271081
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
10281082
with:

0 commit comments

Comments
 (0)