Skip to content

Commit cf34f68

Browse files
committed
Migrate Windows CI to Github Actions
1 parent 4bc42d8 commit cf34f68

File tree

5 files changed

+123
-69
lines changed

5 files changed

+123
-69
lines changed

.github/workflows/push.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,34 @@ 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+
- zts: false
93+
opcache: false
94+
- zts: true
95+
opcache: true
96+
name: "WINDOWS_X64_${{ matrix.zts && 'ZTS' || 'NTS' }}_${{ matrix.opcache && 'wOPcache' || 'woOPcache' }}"
97+
runs-on: windows-2019
98+
env:
99+
APPVEYOR_BUILD_FOLDER: "${{ github.workspace }}"
100+
APPVEYOR_REPO_BRANCH: "${{ github.ref_name }}"
101+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
102+
PHP_BUILD_OBJ_DIR: c:\obj
103+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
104+
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
105+
PHP_BUILD_CRT: vs16
106+
PLATFORM: x64
107+
THREAD_SAFE: "${{ matrix.zts && '1' || '' }}"
108+
OPCACHE: "${{ matrix.opcache && '1' || '' }}"
109+
PARALLEL: -j2
110+
INTRINSICS: "${{ matrix.zts && 'AVX' || '' }}"
111+
steps:
112+
- name: git checkout
113+
uses: actions/checkout@v2
114+
- name: Build
115+
run: appveyor/build.bat
116+
- name: Test
117+
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: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
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+
rem rmdir /s /q C:\cygwin >NUL 2>NUL
6+
rename C:\cygwin C:\trash-cygwin
7+
if %errorlevel% neq 0 exit /b 3
8+
rem rmdir /s /q C:\cygwin64 >NUL 2>NUL
9+
rename C:\cygwin64 C:\trash-cygwin64
10+
if %errorlevel% neq 0 exit /b 3
11+
rem rmdir /s /q C:\mingw >NUL 2>NUL
12+
rename C:\mingw C:\trash-mingw
13+
if %errorlevel% neq 0 exit /b 3
14+
rem rmdir /s /q C:\mingw-w64 >NUL 2>NUL
15+
rename C:\mingw-w64 C:\trash-mingw-w64
16+
if %errorlevel% neq 0 exit /b 3
17+
rem rmdir /s /q C:\msys64 >NUL 2>NUL
18+
rename C:\msys64 C:\trash-msys64
19+
if %errorlevel% neq 0 exit /b 3
20+
rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
21+
if %errorlevel% neq 0 exit /b 3
22+
rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
23+
if %errorlevel% neq 0 exit /b 3
24+
rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
25+
if %errorlevel% neq 0 exit /b 3
26+
rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
27+
if %errorlevel% neq 0 exit /b 3
28+
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
29+
if %errorlevel% neq 0 exit /b 3
30+
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
31+
if %errorlevel% neq 0 exit /b 3
32+
)
2533

2634
cd /D %APPVEYOR_BUILD_FOLDER%
2735
if %errorlevel% neq 0 exit /b 3
@@ -51,9 +59,6 @@ if %errorlevel% neq 0 exit /b 3
5159
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
5260
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
5361

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-
5762
set CFLAGS=/W1 /WX
5863

5964
cmd /c configure.bat ^
@@ -64,7 +69,7 @@ cmd /c configure.bat ^
6469
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
6570
--with-php-build=%DEPS_DIR% ^
6671
%ADD_CONF% ^
67-
--with-test-ini-ext-exclude=%EXT_EXCLUDE_FROM_TEST%
72+
--disable-test-ini
6873
if %errorlevel% neq 0 exit /b 3
6974

7075
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 --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

0 commit comments

Comments
 (0)