Skip to content

Commit 4da833f

Browse files
committed
Migrate Windows CI to Github Actions
1 parent 2f0918c commit 4da833f

File tree

8 files changed

+139
-69
lines changed

8 files changed

+139
-69
lines changed

.github/workflows/push.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,39 @@ jobs:
8484
-d opcache.enable_cli=1
8585
-d opcache.protect_memory=1
8686
-d opcache.jit_buffer_size=16M
87+
WINDOWS_X64:
88+
strategy:
89+
fail-fast: false
90+
matrix:
91+
include:
92+
- x64: true
93+
zts: false
94+
opcache: false
95+
- x64: true
96+
zts: true
97+
opcache: true
98+
- x64: false
99+
zts: false
100+
opcache: true
101+
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}_${{ matrix.opcache && 'wOPcache' || 'woOPcache' }}"
102+
runs-on: windows-2019
103+
env:
104+
APPVEYOR_BUILD_FOLDER: "${{ github.workspace }}"
105+
APPVEYOR_REPO_BRANCH: "${{ github.ref_name }}"
106+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
107+
PHP_BUILD_OBJ_DIR: c:\obj
108+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
109+
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
110+
PHP_BUILD_CRT: vs16
111+
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
112+
THREAD_SAFE: "${{ matrix.zts && '1' || '' }}"
113+
OPCACHE: "${{ matrix.opcache && '1' || '' }}"
114+
PARALLEL: -j2
115+
INTRINSICS: "${{ matrix.zts && 'AVX' || '' }}"
116+
steps:
117+
- name: git checkout
118+
uses: actions/checkout@v2
119+
- name: Build
120+
run: appveyor/build.bat
121+
- name: Test
122+
run: appveyor/test.bat

appveyor/build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@echo off
1+
@echo on
22

33
set SDK_REMOTE=https://github.com/php/php-sdk-binary-tools.git
44
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
@@ -20,7 +20,7 @@ if not exist "%SDK_RUNNER%" (
2020

2121
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
2222
echo Cloning remote SDK repository
23-
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
23+
git clone --branch %SDK_BRANCH% %SDK_REMOTE% --depth 1 "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
2424
)
2525

2626
for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a

appveyor/build_task.bat

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
1-
@echo off
1+
@echo on
22

3-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
4-
if %errorlevel% neq 0 exit /b 3
5-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin64 >NUL 2>NUL
6-
if %errorlevel% neq 0 exit /b 3
7-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
8-
if %errorlevel% neq 0 exit /b 3
9-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
10-
if %errorlevel% neq 0 exit /b 3
11-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >NUL 2>NUL
12-
if %errorlevel% neq 0 exit /b 3
13-
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
14-
if %errorlevel% neq 0 exit /b 3
15-
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
16-
if %errorlevel% neq 0 exit /b 3
17-
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
18-
if %errorlevel% neq 0 exit /b 3
19-
if "%APPVEYOR%" equ "True" rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
20-
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
22-
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
24-
if %errorlevel% neq 0 exit /b 3
3+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" equ "True" (
4+
rem rmdir takes several minutes for large directories, rename instead
5+
if /i "%APPVEYOR%" equ "True" (
6+
rmdir /s /q C:\cygwin >NUL 2>NUL
7+
if %errorlevel% neq 0 exit /b 3
8+
rmdir /s /q C:\cygwin64 >NUL 2>NUL
9+
if %errorlevel% neq 0 exit /b 3
10+
rmdir /s /q C:\mingw >NUL 2>NUL
11+
if %errorlevel% neq 0 exit /b 3
12+
rmdir /s /q C:\mingw-w64 >NUL 2>NUL
13+
if %errorlevel% neq 0 exit /b 3
14+
rmdir /s /q C:\msys64 >NUL 2>NUL
15+
if %errorlevel% neq 0 exit /b 3
16+
) else (
17+
rename C:\cygwin C:\trash-cygwin
18+
if %errorlevel% neq 0 exit /b 3
19+
rename C:\cygwin64 C:\trash-cygwin64
20+
if %errorlevel% neq 0 exit /b 3
21+
rename C:\mingw C:\trash-mingw
22+
if %errorlevel% neq 0 exit /b 3
23+
rename C:\mingw-w64 C:\trash-mingw-w64
24+
if %errorlevel% neq 0 exit /b 3
25+
rename C:\msys64 C:\trash-msys64
26+
if %errorlevel% neq 0 exit /b 3
27+
)
28+
rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
29+
if %errorlevel% neq 0 exit /b 3
30+
rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
31+
if %errorlevel% neq 0 exit /b 3
32+
rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
33+
if %errorlevel% neq 0 exit /b 3
34+
rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
35+
if %errorlevel% neq 0 exit /b 3
36+
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
37+
if %errorlevel% neq 0 exit /b 3
38+
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
39+
if %errorlevel% neq 0 exit /b 3
40+
)
2541

2642
cd /D %APPVEYOR_BUILD_FOLDER%
2743
if %errorlevel% neq 0 exit /b 3
@@ -51,9 +67,6 @@ if %errorlevel% neq 0 exit /b 3
5167
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
5268
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
5369

54-
set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap,ftp
55-
if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
56-
5770
set CFLAGS=/W1 /WX
5871

5972
cmd /c configure.bat ^
@@ -64,7 +77,7 @@ cmd /c configure.bat ^
6477
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
6578
--with-php-build=%DEPS_DIR% ^
6679
%ADD_CONF% ^
67-
--with-test-ini-ext-exclude=%EXT_EXCLUDE_FROM_TEST%
80+
--disable-test-ini
6881
if %errorlevel% neq 0 exit /b 3
6982

7083
nmake /NOLOGO

appveyor/test.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@echo off
1+
@echo on
22

33
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
44
if not exist "%SDK_RUNNER%" (

appveyor/test_task.bat

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@echo off
1+
@echo on
22

33
set NO_INTERACTION=1
44
set REPORT_EXIT_STATUS=1
@@ -17,43 +17,50 @@ if not exist "%DEPS_DIR%" (
1717
exit /b 3
1818
)
1919

20-
rem setup MySQL related exts
21-
set MYSQL_PWD=Password12!
22-
set MYSQL_TEST_PASSWD=%MYSQL_PWD%
23-
set MYSQL_TEST_USER=root
24-
set MYSQL_TEST_HOST=127.0.0.1
25-
set MYSQL_TEST_PORT=3306
26-
set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
27-
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
28-
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
29-
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
30-
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"
32-
if %errorlevel% neq 0 exit /b 3
20+
if /i "%APPVEYOR%" equ "True" (
21+
rem setup MySQL related exts
22+
set MYSQL_PWD=Password12!
23+
set MYSQL_TEST_PASSWD=%MYSQL_PWD%
24+
set MYSQL_TEST_USER=root
25+
set MYSQL_TEST_HOST=127.0.0.1
26+
set MYSQL_TEST_PORT=3306
27+
set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
28+
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
29+
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
30+
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
31+
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test
32+
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
33+
if %errorlevel% neq 0 exit /b 3
3334

34-
rem setup PostgreSQL related exts
35-
set PGUSER=postgres
36-
set PGPASSWORD=Password12!
37-
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
38-
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
39-
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
41-
if %errorlevel% neq 0 exit /b 3
35+
rem setup PostgreSQL related exts
36+
set PGUSER=postgres
37+
set PGPASSWORD=Password12!
38+
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
39+
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> ext\pgsql\tests\config.inc
40+
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
41+
"C:\Program Files\PostgreSQL\10\bin\createdb.exe" test
42+
if %errorlevel% neq 0 exit /b 3
4243

43-
rem setup ODBC related exts
44-
set ODBC_TEST_USER=sa
45-
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%
47-
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
44+
rem setup ODBC related exts
45+
set ODBC_TEST_USER=sa
46+
set ODBC_TEST_PASS=Password12!
47+
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=^(local^)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
48+
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
49+
)
4850

4951
rem prepare for ext/openssl
50-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
51-
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
52+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" equ "True" (
53+
rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
54+
rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
55+
)
5256
if "%PLATFORM%" == "x64" (
5357
set OPENSSLDIR="C:\Program Files\Common Files\SSL"
5458
) else (
5559
set OPENSSLDIR="C:\Program Files (x86)\Common Files\SSL"
5660
)
61+
if /i "%GITHUB_ACTIONS%" equ "True" (
62+
rmdir /s /q %OPENSSLDIR% >NUL 2>NUL
63+
)
5764
mkdir %OPENSSLDIR%
5865
if %errorlevel% neq 0 exit /b 3
5966
copy %DEPS_DIR%\template\ssl\openssl.cnf %OPENSSLDIR%
@@ -62,7 +69,7 @@ rem set OPENSSL_CONF=%OPENSSLDIR%\openssl.cnf
6269
set OPENSSL_CONF=
6370
rem set SSLEAY_CONF=
6471

65-
rem prepare for Opcache
72+
rem prepare for OPcache
6673
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M
6774

6875
rem prepare for enchant
@@ -89,19 +96,30 @@ if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
8996
mkdir %LOCALAPPDATA%\enchant\hunspell
9097
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %LOCALAPPDATA%\enchant\hunspell
9198

92-
set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_OBJ_DIR%\Release
93-
if "%THREAD_SAFE%" equ "1" set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%_TS
94-
set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%\phpdbg.exe
99+
set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
100+
if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
101+
102+
mkdir %PHP_BUILD_DIR%\test_file_cache
103+
rem generate php.ini
104+
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
105+
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
106+
if "%OPCACHE%" equ "1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR%\php.ini
107+
rem work-around for some spawned PHP processes requiring OpenSSL
108+
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini
109+
110+
rem remove ext dlls for which tests are not supported
111+
for %%i in (imap ldap oci8_12c pdo_firebird pdo_oci snmp) do (
112+
del %PHP_BUILD_DIR%\php_%%i.dll
113+
)
114+
115+
set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe
95116

96117
mkdir c:\tests_tmp
97118

98119
set TEST_PHP_JUNIT=c:\junit.out.xml
99120

100121
cd "%APPVEYOR_BUILD_FOLDER%"
101-
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 %PARALLEL%"
102-
103-
set EXIT_CODE=%errorlevel%
104-
105-
appveyor PushArtifact %TEST_PHP_JUNIT%
122+
nmake test TESTS="%OPCACHE_OPTS% -q -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP --color --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp %PARALLEL%"
123+
if %errorlevel% neq 0 exit /b 3
106124

107-
exit /b %EXIT_CODE%
125+
exit /b 0

buildconf.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
2+
23
cscript /nologo /e:jscript win32\build\buildconf.js %*
34
SET PHP_BUILDCONF_PATH=%~dp0
45
copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH% > nul

win32/build/configure.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@echo off
2+
23
cscript /nologo /e:jscript configure.js %*

win32/build/phpize.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
2+
23
SET PHP_BUILDCONF_PATH=%~dp0
34
cscript /nologo /e:jscript %PHP_BUILDCONF_PATH%\script\phpize.js %*
45
IF NOT EXIST configure.bat (

0 commit comments

Comments
 (0)