Skip to content

Test Windows x86 and x64 with Github Actions #8392

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 16 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
49 changes: 16 additions & 33 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,28 @@ skip_commits:
- UPGRADING
- UPGRADING.INTERNALS

cache:
- c:\build-cache

environment:
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
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
#MYSQL_TEST_USER: root
#PDO_MYSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=root password=Password12!"
#PDO_MYSQL_TEST_USER: root
#PDO_MYSQL_TEST_PASS: Password12!
#PGSQL_TEST_CONNSTR: "host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!"
#PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=Password12!"
#build permutations
matrix:
- THREAD_SAFE: 0
OPCACHE: 0
PARALLEL: -j2
- THREAD_SAFE: 1
OPCACHE: 1
PARALLEL: -j2
INTRINSICS: AVX2
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
matrix:
- THREAD_SAFE: ""
- THREAD_SAFE: 1
INTRINSICS: AVX2

services:
# the setup scripts have to be touched, once some other db version is used
- mysql
- postgresql101
- mssql2017
- mysql
- postgresql101
- mssql2017

platform:
- x64
#- x86
- x64
#- x86

build_script:
- .github\scripts\windows\build.bat
- .github\scripts\windows\build.bat

test_script:
- .github\scripts\windows\test.bat
- .github\scripts\windows\test.bat
40 changes: 12 additions & 28 deletions .github/scripts/windows/build.bat
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
@echo off

if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3
)

set SDK_REMOTE=https://github.com/php/php-sdk-binary-tools.git
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat

if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
)

if not exist "%PHP_BUILD_OBJ_DIR%" (
echo Creating %PHP_BUILD_OBJ_DIR%
mkdir "%PHP_BUILD_OBJ_DIR%"
)
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
mkdir "%PHP_BUILD_OBJ_DIR%"

if not exist "%SDK_RUNNER%" (
if exist "%PHP_BUILD_CACHE_SDK_DIR%" rmdir /s /q "%PHP_BUILD_CACHE_SDK_DIR%"
)

if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
echo Cloning remote SDK repository
git clone --branch %SDK_BRANCH% %SDK_REMOTE% --depth 1 "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
)
echo Cloning remote SDK repository
git clone -q -c advice.detachedHead=false --branch %SDK_BRANCH% %SDK_REMOTE% --depth 1 "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1

for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
echo Got SDK version %GOT_SDK_VER%
if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
echo Switching to the configured SDK version %SDK_BRANCH:~8%
echo Fetching remote SDK repository
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin
echo Checkout SDK repository branch
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
)

if not exist "%SDK_RUNNER%" (
echo "%SDK_RUNNER%" doesn't exist
exit /b 3
)

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

exit /b 0
cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
55 changes: 30 additions & 25 deletions .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
@echo off

if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3
)

if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin64 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin64 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-v11-Win32 >nul 2>&1
if %errorlevel% neq 0 exit /b 3
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
if /i "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-v11-Win64 >nul 2>&1
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
rem rmdir takes several minutes rename instead only
pushd C:\
if /i "%GITHUB_ACTIONS%" equ "True" ren msys64 msys64-del
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
popd
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >nul 2>&1
if %errorlevel% neq 0 exit /b 3

cd /D %APPVEYOR_BUILD_FOLDER%
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >nul 2>&1
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
echo Updating dependencies in %DEPS_DIR%
Expand All @@ -48,10 +52,14 @@ if %errorlevel% neq 0 exit /b 3
cmd /c buildconf.bat --force
if %errorlevel% neq 0 exit /b 3

if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
if "%THREAD_SAFE%" equ "" set ADD_CONF=%ADD_CONF% --disable-zts
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%

set CFLAGS=/W1 /WX
if "%PLATFORM%" == "x86" (
set CFLAGS=/W1
) else (
set CFLAGS=/W1 /WX
)

cmd /c configure.bat ^
--enable-snapshot-build ^
Expand All @@ -61,10 +69,7 @@ cmd /c configure.bat ^
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
--with-php-build=%DEPS_DIR% ^
%ADD_CONF% ^
--disable-test-ini
if %errorlevel% neq 0 exit /b 3

nmake /NOLOGO
--with-test-ini-ext-exclude=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap,ftp
if %errorlevel% neq 0 exit /b 3

exit /b 0
nmake /NOLOGO /S
4 changes: 4 additions & 0 deletions .github/scripts/windows/find-target-branch.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@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
12 changes: 5 additions & 7 deletions .github/scripts/windows/test.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
@echo off

set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
if not exist "%SDK_RUNNER%" (
echo "%SDK_RUNNER%" doesn't exist
exit /b 3
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3
)

cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\test_task.bat
if %errorlevel% neq 0 exit /b 3
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat

exit /b 0
cmd /c %SDK_RUNNER% -t .github\scripts\windows\test_task.bat
Loading