|
| 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 | +jobs: |
| 17 | + windows: |
| 18 | + name: "Windows PHP ${{ matrix.php-version }}" |
| 19 | + runs-on: "windows-latest" |
| 20 | + timeout-minutes: 40 |
| 21 | + |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + php-version: ["8.4", "8.5"] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: "Checkout" |
| 29 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 30 | + with: |
| 31 | + persist-credentials: false |
| 32 | + # full history: the extension version is baked from git log over |
| 33 | + # the watched paths |
| 34 | + fetch-depth: 0 |
| 35 | + |
| 36 | + - name: "Install PHP" |
| 37 | + uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # v2.37.2 |
| 38 | + with: |
| 39 | + coverage: "none" |
| 40 | + php-version: "${{ matrix.php-version }}" |
| 41 | + |
| 42 | + - name: "Compute extension version and devel-pack URL" |
| 43 | + id: meta |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + MAPPED_PHP=$(php -n -r 'echo implode(" ", array_map(static fn ($e) => $e["php"], array_filter(json_decode(file_get_contents("turbo-ext/shadowed-classes.json"), true), static fn ($e) => !($e["vendored"] ?? false))));') |
| 47 | + SHA=$(git log -1 --format=%H -- turbo-ext/src $MAPPED_PHP | cut -c1-7) |
| 48 | + echo "PHPSTANTURBO_VERSION=$SHA" >> "$GITHUB_ENV" |
| 49 | + FULL=$(php -r 'echo PHP_VERSION;') |
| 50 | + echo "php full version: $FULL, extension version: $SHA" |
| 51 | + echo "devel-pack=php-devel-pack-$FULL-nts-Win32-vs17-x64.zip" >> "$GITHUB_OUTPUT" |
| 52 | +
|
| 53 | + - name: "Download PHP devel pack" |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + PACK="${{ steps.meta.outputs.devel-pack }}" |
| 57 | + curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/$PACK" \ |
| 58 | + || curl -fsSLo devel-pack.zip "https://windows.php.net/downloads/releases/archives/$PACK" |
| 59 | + unzip -q devel-pack.zip -d /c/php-devel |
| 60 | + ls /c/php-devel |
| 61 | +
|
| 62 | + - name: "Set up MSVC environment" |
| 63 | + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 |
| 64 | + with: |
| 65 | + arch: x64 |
| 66 | + |
| 67 | + - name: "Build the extension" |
| 68 | + shell: cmd |
| 69 | + working-directory: turbo-ext |
| 70 | + run: | |
| 71 | + for /d %%d in (C:\php-devel\php-*-devel-*) do set DEVEL=%%d |
| 72 | + set PATH=%DEVEL%;%PATH% |
| 73 | + call phpize.bat |
| 74 | + call configure.bat --enable-phpstan-turbo |
| 75 | + nmake |
| 76 | +
|
| 77 | + - name: "Verify the built extension reports the expected version" |
| 78 | + shell: bash |
| 79 | + run: | |
| 80 | + DLL=$(ls turbo-ext/x64/Release*/php_phpstan_turbo.dll | head -1) |
| 81 | + echo "built: $DLL" |
| 82 | + REPORTED="$(php -d extension="$(cygpath -w "$PWD/$DLL")" -r 'echo phpversion("phpstan_turbo");')" |
| 83 | + EXPECTED="$(sed -n "s/.*EXPECTED_EXTENSION_VERSION = '\([^']*\)'.*/\1/p" src/Turbo/TurboExtensionEnabler.php)" |
| 84 | + echo "built extension reports: $REPORTED, enabler expects: $EXPECTED" |
| 85 | + [ "$REPORTED" = "$EXPECTED" ] |
| 86 | + echo "TURBO_DLL=$(cygpath -w "$PWD/$DLL")" >> "$GITHUB_ENV" |
| 87 | +
|
| 88 | + - uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0 |
| 89 | + |
| 90 | + - name: "Smoke test (differential: native vs PHP implementations)" |
| 91 | + shell: bash |
| 92 | + run: php -d extension="$TURBO_DLL" turbo-ext/tests/smoke.php |
| 93 | + |
| 94 | + - name: "Signature parity (reflect native classes against the PHP twins)" |
| 95 | + shell: bash |
| 96 | + run: php -d extension="$TURBO_DLL" turbo-ext/tests/signature-parity.php |
| 97 | + |
| 98 | + - name: "Parser corpus (differential: native vs PHP ASTs must be byte-identical)" |
| 99 | + shell: bash |
| 100 | + run: php -d extension="$TURBO_DLL" -d memory_limit=4G turbo-ext/tests/parser-corpus.php |
0 commit comments