Skip to content

Add Windows GitHub actions build #10679

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

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/scripts/windows/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 11 additions & 12 deletions .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ^
Expand All @@ -62,9 +60,10 @@ cmd /c configure.bat ^
--with-php-build=%DEPS_DIR% ^
%ADD_CONF% ^
--disable-test-ini

if %errorlevel% neq 0 exit /b 3

nmake /NOLOGO
nmake /NOLOGO /S
if %errorlevel% neq 0 exit /b 3

exit /b 0
8 changes: 8 additions & 0 deletions .github/scripts/windows/find-target-branch.bat
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion .github/scripts/windows/test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
73 changes: 41 additions & 32 deletions .github/scripts/windows/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand All @@ -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
Expand All @@ -37,13 +41,22 @@ 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 setup Firebird related exts
Expand All @@ -61,13 +74,16 @@ if %errorlevel% neq 0 exit /b 3
path C:\Firebird;%PATH%

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%
Expand All @@ -82,28 +98,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

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

set TEST_PHP_JUNIT=c:\junit.out.xml

cd "%APPVEYOR_BUILD_FOLDER%"
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%"
nmake test TESTS="%OPCACHE_OPTS% --offline -g FAIL,BORK,WARN,LEAK,XLEAK -q --color --no-progress --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%"

set EXIT_CODE=%errorlevel%

taskkill /f /im snmpd.exe

appveyor PushArtifact %TEST_PHP_JUNIT%

if %EXIT_CODE% GEQ 1 (
git checkout ext\pgsql\tests\config.inc
git diff > bless_tests.patch
appveyor PushArtifact 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%
44 changes: 44 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
CXX: ccache g++
jobs:
LINUX_X64:
if: false
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -79,6 +80,7 @@ jobs:
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
LINUX_X32:
if: false
name: LINUX_X32_DEBUG_ZTS
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -125,6 +127,7 @@ jobs:
-d opcache.enable_cli=1
-d opcache.jit_buffer_size=16M
MACOS_DEBUG_NTS:
if: false
runs-on: macos-11
steps:
- name: git checkout
Expand Down Expand Up @@ -161,3 +164,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
1 change: 1 addition & 0 deletions ext/gd/tests/bug77272.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/mbstring/tests/utf_encodings.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mbstring
--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");
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_sqlite/tests/pdo_sqlite_open_basedir_uri.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PDO_sqlite: Testing URIs with open_basedir
--EXTENSIONS--
pdo_sqlite
--INI--
open_basedir={TMP}
open_basedir="{TMP}"
--FILE--
<?php

Expand Down
1 change: 1 addition & 0 deletions ext/sysvshm/tests/bug72858.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/zend_test/tests/observer_declarations_file_cache.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ zend_test
zend_test.observer.enabled=1
zend_test.observer.observe_declaring=1
opcache.enable_cli=1
opcache.file_cache={TMP}
opcache.file_cache="{TMP}"
opcache.file_cache_only=1
--FILE--
<?php
Expand Down