Skip to content

Commit 2657fac

Browse files
committed
Switch to windows-2022 in CI
windows-2019 runner will be dropped by GitHub on 2025-06-30.
1 parent 391bd2a commit 2657fac

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

.github/scripts/windows/build.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ if not exist "%SDK_RUNNER%" (
4343
exit /b 3
4444
)
4545

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

4951
exit /b 0
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@echo off
2+
3+
setlocal enabledelayedexpansion
4+
5+
if "%~1"=="" (
6+
echo ERROR: Usage: %~nx0 [vc14^|vc15^|vs16^|vs17]
7+
exit /b 1
8+
)
9+
10+
set "toolsets_vc14=14.0"
11+
set "toolsets_vc15="
12+
set "toolsets_vs16="
13+
set "toolsets_vs17="
14+
15+
16+
for /f "usebackq tokens=*" %%I in (`vswhere.exe -latest -find "VC\Tools\MSVC"`) do set "MSVCDIR=%%I"
17+
18+
if not defined MSVCDIR (
19+
echo ERROR: could not locate VC\Tools\MSVC
20+
exit /b 1
21+
)
22+
23+
for /f "delims=" %%D in ('dir /b /ad "%MSVCDIR%"') do (
24+
for /f "tokens=1,2 delims=." %%A in ("%%D") do (
25+
set "maj=%%A" & set "min=%%B"
26+
if "!maj!"=="14" (
27+
if !min! LEQ 9 (
28+
set "toolsets_vc14=%%D"
29+
) else if !min! LEQ 19 (
30+
set "toolsets_vc15=%%D"
31+
) else if !min! LEQ 29 (
32+
set "toolsets_vs16=%%D"
33+
) else (
34+
set "toolsets_vs17=%%D"
35+
)
36+
)
37+
)
38+
)
39+
40+
set "KEY=%~1"
41+
set "VAR=toolsets_%KEY%"
42+
call set "RESULT=%%%VAR%%%"
43+
if defined RESULT (
44+
echo %RESULT%
45+
exit /b 0
46+
) else (
47+
echo ERROR: no toolset found for %KEY%
48+
exit /b 1
49+
)

.github/scripts/windows/test.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ if not exist "%SDK_RUNNER%" (
1111
exit /b 3
1212
)
1313

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

1718
exit /b 0

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
WINDOWS:
148148
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
149149
name: WINDOWS_X64_ZTS
150-
runs-on: windows-2019
150+
runs-on: windows-2022
151151
env:
152152
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
153153
PHP_BUILD_OBJ_DIR: C:\obj

.github/workflows/root.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
ubuntu_version: ${{
5959
(((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04')
6060
|| '22.04' }}
61-
windows_version: ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9) && '2022' || '2019' }}
61+
windows_version: '2022'
6262
skip_laravel: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
6363
skip_symfony: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
6464
skip_wordpress: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}

0 commit comments

Comments
 (0)