Skip to content

Commit 6033679

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Add Windows GitHub actions build
2 parents 2b5aac9 + 916b132 commit 6033679

File tree

8 files changed

+102
-44
lines changed

8 files changed

+102
-44
lines changed

.github/scripts/windows/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if not exist "%SDK_RUNNER%" (
3838
exit /b 3
3939
)
4040

41-
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\build_task.bat
41+
cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
4242
if %errorlevel% neq 0 exit /b 3
4343

4444
exit /b 0

.github/scripts/windows/build_task.bat

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,12 @@ if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
1818
if %errorlevel% neq 0 exit /b 3
1919
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
2020
if %errorlevel% neq 0 exit /b 3
21-
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
21+
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
2222
if %errorlevel% neq 0 exit /b 3
23-
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
23+
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
2424
if %errorlevel% neq 0 exit /b 3
2525

26-
cd /D %APPVEYOR_BUILD_FOLDER%
27-
if %errorlevel% neq 0 exit /b 3
28-
29-
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
30-
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
31-
) else (
32-
set BRANCH=master
33-
)
26+
call %~dp0find-target-branch.bat
3427
set STABILITY=staging
3528
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
3629
rem SDK is cached, deps info is cached as well
@@ -51,7 +44,12 @@ if %errorlevel% neq 0 exit /b 3
5144
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
5245
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
5346

54-
set CFLAGS=/W1 /WX
47+
rem Some undefined behavior is reported on 32-bit, this should be fixed
48+
if "%PLATFORM%" == "x86" (
49+
set CFLAGS=/W1
50+
) else (
51+
set CFLAGS=/W1 /WX
52+
)
5553

5654
cmd /c configure.bat ^
5755
--enable-snapshot-build ^
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@echo off
2+
3+
for /f "usebackq tokens=3" %%i in (`findstr PHP_MAJOR_VERSION main\php_version.h`) do set BRANCH=%%i
4+
for /f "usebackq tokens=3" %%i in (`findstr PHP_MINOR_VERSION main\php_version.h`) do set BRANCH=%BRANCH%.%%i
5+
6+
if /i "%BRANCH%" equ "8.3" (
7+
set BRANCH=master
8+
)

.github/scripts/windows/test.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if not exist "%SDK_RUNNER%" (
66
exit /b 3
77
)
88

9-
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\test_task.bat
9+
cmd /c %SDK_RUNNER% -t .github\scripts\windows\test_task.bat
1010
if %errorlevel% neq 0 exit /b 3
1111

1212
exit /b 0

.github/scripts/windows/test_task.bat

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ set NO_INTERACTION=1
44
set REPORT_EXIT_STATUS=1
55
set SKIP_IO_CAPTURE_TESTS=1
66

7-
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
8-
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
7+
call %~dp0find-target-branch.bat
8+
if "%BRANCH%" neq "master" (
99
set STABILITY=stable
1010
) else (
11-
set BRANCH=master
1211
set STABILITY=staging
1312
)
1413
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
@@ -28,7 +27,12 @@ set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
2827
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
2928
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
3029
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test
31-
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
30+
if /i "%APPVEYOR%" equ "True" (
31+
set TMP_MYSQL_BIN=%ProgramFiles%\MySql\MySQL Server 5.7\bin
32+
) else (
33+
set TMP_MYSQL_BIN=C:\mysql\bin
34+
)
35+
"%TMP_MYSQL_BIN%\mysql.exe" --host=%PDO_MYSQL_TEST_HOST% --port=%MYSQL_TEST_PORT% --user=%MYSQL_TEST_USER% --password=%MYSQL_TEST_PASSWD% -e "CREATE DATABASE IF NOT EXISTS test"
3236
if %errorlevel% neq 0 exit /b 3
3337

3438
rem setup PostgreSQL related exts
@@ -37,13 +41,22 @@ set PGPASSWORD=Password12!
3741
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
3842
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
3943
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
40-
"C:\Program Files\PostgreSQL\10\bin\createdb.exe" test
44+
if /i "%APPVEYOR%" equ "True" (
45+
set TMP_POSTGRESQL_BIN=%ProgramFiles%\PostgreSQL\10\bin
46+
) else (
47+
set TMP_POSTGRESQL_BIN=%PGBIN%
48+
)
49+
"%TMP_POSTGRESQL_BIN%\createdb.exe" test
4150
if %errorlevel% neq 0 exit /b 3
4251

4352
rem setup ODBC related exts
4453
set ODBC_TEST_USER=sa
4554
set ODBC_TEST_PASS=Password12!
46-
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=(local)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
55+
if /i "%APPVEYOR%" equ "True" (
56+
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=^(local^)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
57+
) else (
58+
set ODBC_TEST_DSN=Driver={ODBC Driver 17 for SQL Server};Server=^(local^)\SQLEXPRESS;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
59+
)
4760
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
4861

4962
rem setup Firebird related exts
@@ -61,13 +74,16 @@ if %errorlevel% neq 0 exit /b 3
6174
path C:\Firebird;%PATH%
6275

6376
rem prepare for ext/openssl
64-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
65-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
77+
rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
78+
rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
6679
if "%PLATFORM%" == "x64" (
6780
set OPENSSLDIR="C:\Program Files\Common Files\SSL"
6881
) else (
6982
set OPENSSLDIR="C:\Program Files (x86)\Common Files\SSL"
7083
)
84+
if /i "%GITHUB_ACTIONS%" equ "True" (
85+
rmdir /s /q %OPENSSLDIR% >nul 2>&1
86+
)
7187
mkdir %OPENSSLDIR%
7288
if %errorlevel% neq 0 exit /b 3
7389
copy %DEPS_DIR%\template\ssl\openssl.cnf %OPENSSLDIR%
@@ -82,28 +98,18 @@ rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/p
8298
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli
8399

84100
rem prepare for enchant
85-
mkdir C:\usr\local\lib\enchant-2
101+
mkdir %~d0\usr\local\lib\enchant-2
86102
if %errorlevel% neq 0 exit /b 3
87-
copy %DEPS_DIR%\bin\libenchant2_hunspell.dll C:\usr\local\lib\enchant-2
103+
copy %DEPS_DIR%\bin\libenchant2_hunspell.dll %~d0\usr\local\lib\enchant-2
88104
if %errorlevel% neq 0 exit /b 3
89-
reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
105+
mkdir %~d0\usr\local\share\enchant\hunspell
90106
if %errorlevel% neq 0 exit /b 3
91-
set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
92-
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
93-
echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
94-
mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
95-
)
96-
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
97-
echo Fetching enchant dicts
98-
pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
99-
del /q *
100-
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
101-
unzip dict.zip
102-
del /q dict.zip
103-
popd
104-
)
105-
mkdir %LOCALAPPDATA%\enchant\hunspell
106-
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %LOCALAPPDATA%\enchant\hunspell
107+
echo Fetching enchant dicts
108+
pushd %~d0\usr\local\share\enchant\hunspell
109+
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
110+
unzip dict.zip
111+
del /q dict.zip
112+
popd
107113

108114
rem prepare for snmp
109115
set MIBDIRS=%DEPS_DIR%\share\mibs
@@ -137,19 +143,22 @@ mkdir c:\tests_tmp
137143

138144
set TEST_PHP_JUNIT=c:\junit.out.xml
139145

140-
cd "%APPVEYOR_BUILD_FOLDER%"
141146
nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%"
142147

143148
set EXIT_CODE=%errorlevel%
144149

145150
taskkill /f /im snmpd.exe
146151

147-
appveyor PushArtifact %TEST_PHP_JUNIT%
148-
149152
if %EXIT_CODE% GEQ 1 (
150153
git checkout ext\pgsql\tests\config.inc
151154
git diff > bless_tests.patch
152-
appveyor PushArtifact bless_tests.patch
155+
)
156+
157+
if /i "%APPVEYOR%" equ "True" (
158+
appveyor PushArtifact %TEST_PHP_JUNIT%
159+
if %EXIT_CODE% GEQ 1 (
160+
appveyor PushArtifact bless_tests.patch
161+
)
153162
)
154163

155164
exit /b %EXIT_CODE%

.github/workflows/push.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,44 @@ jobs:
159159
-d opcache.jit_buffer_size=16M
160160
- name: Verify generated files are up to date
161161
uses: ./.github/actions/verify-generated-files
162+
WINDOWS:
163+
strategy:
164+
fail-fast: false
165+
matrix:
166+
include:
167+
- x64: true
168+
zts: false
169+
- x64: false
170+
zts: true
171+
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
172+
runs-on: windows-2019
173+
env:
174+
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
175+
PHP_BUILD_OBJ_DIR: C:\obj
176+
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
177+
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
178+
PHP_BUILD_CRT: vs16
179+
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
180+
THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}"
181+
INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}"
182+
PARALLEL: -j2
183+
steps:
184+
- name: git config
185+
run: git config --global core.autocrlf false && git config --global core.eol lf
186+
- name: git checkout
187+
uses: actions/checkout@v2
188+
- name: Setup MySQL
189+
run: |
190+
choco install mysql -y --no-progress --params="/port:3306"
191+
mysql.exe --port=3306 --user=root --password="" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password12!'; FLUSH PRIVILEGES;"
192+
- name: Setup MSSQL
193+
run: |
194+
choco install sql-server-express -y --no-progress --install-arguments="/SECURITYMODE=SQL /SAPWD=Password12!"
195+
- name: Setup PostgreSQL
196+
run: |
197+
Set-Service -Name "postgresql-x64-14" -StartupType manual -Status Running
198+
pwsh -Command { $env:PGPASSWORD="root"; & "$env:PGBIN\psql" -U postgres -c "ALTER USER postgres WITH PASSWORD 'Password12!';" }
199+
- name: Build
200+
run: .github/scripts/windows/build.bat
201+
- name: Test
202+
run: .github/scripts/windows/test.bat

ext/gd/tests/bug77272.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gd
88
<?php
99
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
1010
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
11+
if (substr(PHP_OS, 0, 3) == 'WIN' && PHP_INT_SIZE === 4) die("skip not for Windows x86");
1112
?>
1213
--FILE--
1314
<?php

ext/sysvshm/tests/bug72858.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sysvshm
77

88
if (4 < PHP_INT_SIZE) { print "skip 32-bit only"; }
99
if (substr(PHP_OS, 0, 3) != "WIN") { print "skip windows only"; }
10+
if (getenv('GITHUB_ACTIONS')) die('skip on GitHub actions');
1011
?>
1112
--FILE--
1213
<?php

0 commit comments

Comments
 (0)