mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Add Windows GitHub actions build
Closes GH-10664
This commit is contained in:
parent
729f006de8
commit
916b132ea0
2
.github/scripts/windows/build.bat
vendored
2
.github/scripts/windows/build.bat
vendored
@ -38,7 +38,7 @@ if not exist "%SDK_RUNNER%" (
|
||||
exit /b 3
|
||||
)
|
||||
|
||||
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\build_task.bat
|
||||
cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
exit /b 0
|
||||
|
20
.github/scripts/windows/build_task.bat
vendored
20
.github/scripts/windows/build_task.bat
vendored
@ -18,19 +18,12 @@ if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
|
||||
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
|
||||
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
cd /D %APPVEYOR_BUILD_FOLDER%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
|
||||
) else (
|
||||
set BRANCH=master
|
||||
)
|
||||
call %~dp0find-target-branch.bat
|
||||
set STABILITY=staging
|
||||
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
|
||||
rem SDK is cached, deps info is cached as well
|
||||
@ -51,7 +44,12 @@ if %errorlevel% neq 0 exit /b 3
|
||||
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
|
||||
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
|
||||
|
||||
set CFLAGS=/W1 /WX
|
||||
rem Some undefined behavior is reported on 32-bit, this should be fixed
|
||||
if "%PLATFORM%" == "x86" (
|
||||
set CFLAGS=/W1
|
||||
) else (
|
||||
set CFLAGS=/W1 /WX
|
||||
)
|
||||
|
||||
cmd /c configure.bat ^
|
||||
--enable-snapshot-build ^
|
||||
|
8
.github/scripts/windows/find-target-branch.bat
vendored
Normal file
8
.github/scripts/windows/find-target-branch.bat
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
|
||||
for /f "usebackq tokens=3" %%i in (`findstr PHP_MAJOR_VERSION main\php_version.h`) do set BRANCH=%%i
|
||||
for /f "usebackq tokens=3" %%i in (`findstr PHP_MINOR_VERSION main\php_version.h`) do set BRANCH=%BRANCH%.%%i
|
||||
|
||||
if /i "%BRANCH%" equ "8.3" (
|
||||
set BRANCH=master
|
||||
)
|
2
.github/scripts/windows/test.bat
vendored
2
.github/scripts/windows/test.bat
vendored
@ -6,7 +6,7 @@ if not exist "%SDK_RUNNER%" (
|
||||
exit /b 3
|
||||
)
|
||||
|
||||
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\test_task.bat
|
||||
cmd /c %SDK_RUNNER% -t .github\scripts\windows\test_task.bat
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
exit /b 0
|
||||
|
69
.github/scripts/windows/test_task.bat
vendored
69
.github/scripts/windows/test_task.bat
vendored
@ -4,11 +4,10 @@ set NO_INTERACTION=1
|
||||
set REPORT_EXIT_STATUS=1
|
||||
set SKIP_IO_CAPTURE_TESTS=1
|
||||
|
||||
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
|
||||
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
|
||||
call %~dp0find-target-branch.bat
|
||||
if "%BRANCH%" neq "master" (
|
||||
set STABILITY=stable
|
||||
) else (
|
||||
set BRANCH=master
|
||||
set STABILITY=staging
|
||||
)
|
||||
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%
|
||||
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
|
||||
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
|
||||
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test
|
||||
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
|
||||
if /i "%APPVEYOR%" equ "True" (
|
||||
set TMP_MYSQL_BIN=%ProgramFiles%\MySql\MySQL Server 5.7\bin
|
||||
) else (
|
||||
set TMP_MYSQL_BIN=C:\mysql\bin
|
||||
)
|
||||
"%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"
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
rem setup PostgreSQL related exts
|
||||
@ -37,23 +41,35 @@ set PGPASSWORD=Password12!
|
||||
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
|
||||
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
|
||||
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
|
||||
"C:\Program Files\PostgreSQL\10\bin\createdb.exe" test
|
||||
if /i "%APPVEYOR%" equ "True" (
|
||||
set TMP_POSTGRESQL_BIN=%ProgramFiles%\PostgreSQL\10\bin
|
||||
) else (
|
||||
set TMP_POSTGRESQL_BIN=%PGBIN%
|
||||
)
|
||||
"%TMP_POSTGRESQL_BIN%\createdb.exe" test
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
rem setup ODBC related exts
|
||||
set ODBC_TEST_USER=sa
|
||||
set ODBC_TEST_PASS=Password12!
|
||||
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=(local)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
|
||||
if /i "%APPVEYOR%" equ "True" (
|
||||
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=^(local^)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
|
||||
) else (
|
||||
set ODBC_TEST_DSN=Driver={ODBC Driver 17 for SQL Server};Server=^(local^)\SQLEXPRESS;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
|
||||
)
|
||||
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
|
||||
|
||||
rem prepare for ext/openssl
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
|
||||
rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
|
||||
rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
|
||||
if "%PLATFORM%" == "x64" (
|
||||
set OPENSSLDIR="C:\Program Files\Common Files\SSL"
|
||||
) else (
|
||||
set OPENSSLDIR="C:\Program Files (x86)\Common Files\SSL"
|
||||
)
|
||||
if /i "%GITHUB_ACTIONS%" equ "True" (
|
||||
rmdir /s /q %OPENSSLDIR% >nul 2>&1
|
||||
)
|
||||
mkdir %OPENSSLDIR%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
copy %DEPS_DIR%\template\ssl\openssl.cnf %OPENSSLDIR%
|
||||
@ -68,28 +84,18 @@ rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/p
|
||||
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli
|
||||
|
||||
rem prepare for enchant
|
||||
mkdir C:\usr\local\lib\enchant-2
|
||||
mkdir %~d0\usr\local\lib\enchant-2
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
copy %DEPS_DIR%\bin\libenchant2_hunspell.dll C:\usr\local\lib\enchant-2
|
||||
copy %DEPS_DIR%\bin\libenchant2_hunspell.dll %~d0\usr\local\lib\enchant-2
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
|
||||
mkdir %~d0\usr\local\share\enchant\hunspell
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
|
||||
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
|
||||
echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
|
||||
mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
|
||||
)
|
||||
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
|
||||
echo Fetching enchant dicts
|
||||
pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
|
||||
del /q *
|
||||
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
|
||||
unzip dict.zip
|
||||
del /q dict.zip
|
||||
popd
|
||||
)
|
||||
mkdir %LOCALAPPDATA%\enchant\hunspell
|
||||
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %LOCALAPPDATA%\enchant\hunspell
|
||||
echo Fetching enchant dicts
|
||||
pushd %~d0\usr\local\share\enchant\hunspell
|
||||
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
|
||||
unzip dict.zip
|
||||
del /q dict.zip
|
||||
popd
|
||||
|
||||
set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
|
||||
if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
|
||||
@ -113,17 +119,20 @@ mkdir c:\tests_tmp
|
||||
|
||||
set TEST_PHP_JUNIT=c:\junit.out.xml
|
||||
|
||||
cd "%APPVEYOR_BUILD_FOLDER%"
|
||||
nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%"
|
||||
|
||||
set EXIT_CODE=%errorlevel%
|
||||
|
||||
appveyor PushArtifact %TEST_PHP_JUNIT%
|
||||
|
||||
if %EXIT_CODE% GEQ 1 (
|
||||
git checkout ext\pgsql\tests\config.inc
|
||||
git diff > bless_tests.patch
|
||||
)
|
||||
|
||||
if /i "%APPVEYOR%" equ "True" (
|
||||
appveyor PushArtifact %TEST_PHP_JUNIT%
|
||||
if %EXIT_CODE% GEQ 1 (
|
||||
appveyor PushArtifact bless_tests.patch
|
||||
)
|
||||
)
|
||||
|
||||
exit /b %EXIT_CODE%
|
||||
|
41
.github/workflows/push.yml
vendored
41
.github/workflows/push.yml
vendored
@ -152,3 +152,44 @@ jobs:
|
||||
-d opcache.jit_buffer_size=16M
|
||||
- name: Verify generated files are up to date
|
||||
uses: ./.github/actions/verify-generated-files
|
||||
WINDOWS:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- x64: true
|
||||
zts: false
|
||||
- x64: false
|
||||
zts: true
|
||||
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: C:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
|
||||
PHP_BUILD_CRT: vs16
|
||||
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
|
||||
THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}"
|
||||
INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}"
|
||||
PARALLEL: -j2
|
||||
steps:
|
||||
- name: git config
|
||||
run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- name: git checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup MySQL
|
||||
run: |
|
||||
choco install mysql -y --no-progress --params="/port:3306"
|
||||
mysql.exe --port=3306 --user=root --password="" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password12!'; FLUSH PRIVILEGES;"
|
||||
- name: Setup MSSQL
|
||||
run: |
|
||||
choco install sql-server-express -y --no-progress --install-arguments="/SECURITYMODE=SQL /SAPWD=Password12!"
|
||||
- name: Setup PostgreSQL
|
||||
run: |
|
||||
Set-Service -Name "postgresql-x64-14" -StartupType manual -Status Running
|
||||
pwsh -Command { $env:PGPASSWORD="root"; & "$env:PGBIN\psql" -U postgres -c "ALTER USER postgres WITH PASSWORD 'Password12!';" }
|
||||
- name: Build
|
||||
run: .github/scripts/windows/build.bat
|
||||
- name: Test
|
||||
run: .github/scripts/windows/test.bat
|
||||
|
@ -5,6 +5,7 @@ gd
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN' && PHP_INT_SIZE === 4) die("skip not for Windows x86");
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=2G
|
||||
|
@ -8,6 +8,7 @@ gd
|
||||
<?php
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN' && PHP_INT_SIZE === 4) die("skip not for Windows x86");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -7,6 +7,7 @@ sysvshm
|
||||
|
||||
if (4 < PHP_INT_SIZE) { print "skip 32-bit only"; }
|
||||
if (substr(PHP_OS, 0, 3) != "WIN") { print "skip windows only"; }
|
||||
if (getenv('GITHUB_ACTIONS')) die('skip on GitHub actions');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
Loading…
Reference in New Issue
Block a user