|
| 1 | +# Temporary iteration workflow for the Windows turbo extension build. |
| 2 | +# Runs alone on pushes to the turbo-windows branch; folded into phar.yml |
| 3 | +# (and this file deleted) once the build and the differential tests are |
| 4 | +# green on windows-latest. |
| 5 | + |
| 6 | +name: "Turbo Windows Spike" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - "turbo-windows" |
| 15 | + |
| 16 | +env: |
| 17 | + # php/php-sdk-binary-tools — the toolchain every PHP Windows build uses |
| 18 | + # (ships bison and the unix tools the phpize/configure scripts expect). |
| 19 | + PHP_SDK_COMMIT: "c73faaf1cce914e2fc04da5587132f8f425996af" # php-sdk-2.7.1 |
| 20 | + |
| 21 | +jobs: |
| 22 | + windows: |
| 23 | + name: "Windows PHP ${{ matrix.php-version }}" |
| 24 | + runs-on: "windows-latest" |
| 25 | + timeout-minutes: 40 |
| 26 | + |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + php-version: ["8.4", "8.5"] |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: "Checkout" |
| 34 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 35 | + with: |
| 36 | + persist-credentials: false |
| 37 | + # full history: the extension version is baked from git log over |
| 38 | + # the watched paths |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + - name: "Install PHP" |
| 42 | + uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # v2.37.2 |
| 43 | + with: |
| 44 | + coverage: "none" |
| 45 | + php-version: "${{ matrix.php-version }}" |
| 46 | + |
| 47 | + - name: "Compute the extension version and download the build tools" |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + MAPPED_PHP=$(jq -r '[.[] | select(.vendored != true) | .php] | join(" ")' turbo-ext/shadowed-classes.json) |
| 51 | + SHA=$(git log -1 --format=%H -- turbo-ext/src $MAPPED_PHP | cut -c1-7) |
| 52 | + echo "extension version: $SHA" |
| 53 | + echo "PHPSTANTURBO_VERSION=$SHA" >> "$GITHUB_ENV" |
| 54 | +
|
| 55 | + FULL=$(php -r 'echo PHP_VERSION;') |
| 56 | + PACK="php-devel-pack-$FULL-nts-Win32-vs17-x64.zip" |
| 57 | + echo "devel pack: $PACK" |
| 58 | + curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/$PACK" \ |
| 59 | + || curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/archives/$PACK" |
| 60 | + unzip -q devel-pack.zip -d /c/php-devel |
| 61 | +
|
| 62 | + git clone -q https://github.com/php/php-sdk-binary-tools.git /c/php-sdk |
| 63 | + git -C /c/php-sdk checkout -q "$PHP_SDK_COMMIT" |
| 64 | +
|
| 65 | + - name: "Set up MSVC environment" |
| 66 | + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 |
| 67 | + with: |
| 68 | + arch: x64 |
| 69 | + |
| 70 | + - name: "Build the extension" |
| 71 | + shell: cmd |
| 72 | + working-directory: turbo-ext |
| 73 | + run: | |
| 74 | + for /d %%d in (C:\php-devel\php-*-devel-*) do set DEVEL=%%d |
| 75 | + set PATH=%DEVEL%;C:\php-sdk\bin;C:\php-sdk\usr\bin;%PATH% |
| 76 | + call phpize.bat |
| 77 | + if errorlevel 1 exit /b 1 |
| 78 | + call configure.bat --enable-phpstan-turbo |
| 79 | + if errorlevel 1 exit /b 1 |
| 80 | + nmake |
| 81 | +
|
| 82 | + - name: "Verify the built extension reports the expected version" |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + find turbo-ext -name "php_phpstan_turbo.dll" | head -3 |
| 86 | + DLL=$(find turbo-ext -name "php_phpstan_turbo.dll" | head -1) |
| 87 | + [ -n "$DLL" ] |
| 88 | + TURBO_DLL=$(cygpath -w "$PWD/$DLL") |
| 89 | + echo "TURBO_DLL=$TURBO_DLL" >> "$GITHUB_ENV" |
| 90 | + REPORTED="$(php -d extension="$TURBO_DLL" -r 'echo phpversion("phpstan_turbo");')" |
| 91 | + EXPECTED="$(sed -n "s/.*EXPECTED_EXTENSION_VERSION = '\([^']*\)'.*/\1/p" src/Turbo/TurboExtensionEnabler.php)" |
| 92 | + echo "built extension reports: $REPORTED, enabler expects: $EXPECTED" |
| 93 | + [ "$REPORTED" = "$EXPECTED" ] |
| 94 | +
|
| 95 | + - uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0 |
| 96 | + |
| 97 | + - name: "Smoke test (differential: native vs PHP implementations)" |
| 98 | + shell: bash |
| 99 | + run: php -d extension="$TURBO_DLL" turbo-ext/tests/smoke.php |
| 100 | + |
| 101 | + - name: "Signature parity (reflect native classes against the PHP twins)" |
| 102 | + shell: bash |
| 103 | + run: php -d extension="$TURBO_DLL" turbo-ext/tests/signature-parity.php |
| 104 | + |
| 105 | + - name: "Parser corpus (differential: native vs PHP ASTs must be byte-identical)" |
| 106 | + shell: bash |
| 107 | + run: php -d extension="$TURBO_DLL" -d memory_limit=4G turbo-ext/tests/parser-corpus.php |
0 commit comments