Skip to content

Switch to windows-2022 in CI #18927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/scripts/windows/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ if not exist "%SDK_RUNNER%" (
exit /b 3
)

cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
for /f "delims=" %%T in ('call .github\scripts\windows\find-vs-toolset.bat %PHP_BUILD_CRT%') do set "VS_TOOLSET=%%T"
echo Got VS Toolset %VS_TOOLSET%
cmd /c %SDK_RUNNER% -s %VS_TOOLSET% -t .github\scripts\windows\build_task.bat
if %errorlevel% neq 0 exit /b 3

exit /b 0
49 changes: 49 additions & 0 deletions .github/scripts/windows/find-vs-toolset.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@echo off

setlocal enabledelayedexpansion

if "%~1"=="" (
echo ERROR: Usage: %~nx0 [vc14^|vc15^|vs16^|vs17]
exit /b 1
)

set "toolsets_vc14=14.0"
set "toolsets_vc15="
set "toolsets_vs16="
set "toolsets_vs17="


for /f "usebackq tokens=*" %%I in (`vswhere.exe -latest -find "VC\Tools\MSVC"`) do set "MSVCDIR=%%I"

if not defined MSVCDIR (
echo ERROR: could not locate VC\Tools\MSVC
exit /b 1
)

for /f "delims=" %%D in ('dir /b /ad "%MSVCDIR%"') do (
for /f "tokens=1,2 delims=." %%A in ("%%D") do (
set "maj=%%A" & set "min=%%B"
if "!maj!"=="14" (
if !min! LEQ 9 (
set "toolsets_vc14=%%D"
) else if !min! LEQ 19 (
set "toolsets_vc15=%%D"
) else if !min! LEQ 29 (
set "toolsets_vs16=%%D"
) else (
set "toolsets_vs17=%%D"
)
)
)
)

set "KEY=%~1"
set "VAR=toolsets_%KEY%"
call set "RESULT=%%%VAR%%%"
if defined RESULT (
echo %RESULT%
exit /b 0
) else (
echo ERROR: no toolset found for %KEY%
exit /b 1
)
3 changes: 2 additions & 1 deletion .github/scripts/windows/test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if not exist "%SDK_RUNNER%" (
exit /b 3
)

cmd /c %SDK_RUNNER% -t .github\scripts\windows\test_task.bat
for /f "delims=" %%T in ('call .github\scripts\windows\find-vs-toolset.bat %PHP_BUILD_CRT%') do set "VS_TOOLSET=%%T"
cmd /c %SDK_RUNNER% -s %VS_TOOLSET% -t .github\scripts\windows\test_task.bat
if %errorlevel% neq 0 exit /b 3

exit /b 0
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
WINDOWS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: WINDOWS_X64_ZTS
runs-on: windows-2019
runs-on: windows-2022
env:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
ubuntu_version: ${{
(((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04')
|| '22.04' }}
windows_version: ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9) && '2022' || '2019' }}
windows_version: '2022'
skip_laravel: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
skip_symfony: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
skip_wordpress: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
Expand Down
3 changes: 3 additions & 0 deletions Zend/tests/bug70258.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Bug #70258 (Segfault if do_resize fails to allocated memory)
memory_limit=2M
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') {
die("xfail fails on Windows Server 2022 and newer.");
}
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") {
die("skip Zend MM disabled");
Expand Down
3 changes: 3 additions & 0 deletions Zend/tests/gh11189.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
GH-11189: Exceeding memory limit in zend_hash_do_resize leaves the array in an invalid state (packed array)
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') {
die("xfail fails on Windows Server 2022 and newer.");
}
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
?>
--INI--
Expand Down
3 changes: 3 additions & 0 deletions Zend/tests/gh11189_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
GH-11189: Exceeding memory limit in zend_hash_do_resize leaves the array in an invalid state (not packed array)
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') {
die("xfail fails on Windows Server 2022 and newer.");
}
if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
?>
--INI--
Expand Down
Loading