Skip to content

Commit 49c9870

Browse files
committed
Migrate Windows CI to Github Actions
1 parent 19b3957 commit 49c9870

File tree

12 files changed

+273
-218
lines changed

12 files changed

+273
-218
lines changed

.appveyor.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ version: "{branch}.build.{build}"
22

33
image: Visual Studio 2019
44

5-
branches:
6-
except:
7-
- PHP-5.6
8-
- PHP-7.0
9-
10-
clone_depth: 64
5+
clone_depth: 1
116

127
skip_commits:
138
files:
@@ -35,12 +30,8 @@ environment:
3530
#PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=Password12!"
3631
#build permutations
3732
matrix:
38-
- THREAD_SAFE: 0
39-
OPCACHE: 0
40-
PARALLEL: -j2
33+
- THREAD_SAFE: ""
4134
- THREAD_SAFE: 1
42-
OPCACHE: 1
43-
PARALLEL: -j2
4435
INTRINSICS: AVX
4536

4637
services:
@@ -51,10 +42,10 @@ services:
5142

5243
platform:
5344
- x64
54-
# - x86
45+
#- x86
5546

5647
build_script:
57-
- appveyor\build.bat
48+
- .github\scripts\windows\build.bat
5849

5950
test_script:
60-
- appveyor\test.bat
51+
- .github\scripts\windows\test.bat

appveyor/build.bat renamed to .github/scripts/windows/build.bat

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
@echo off
1+
@echo on
2+
3+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
4+
echo for CI only
5+
exit /b 3
6+
)
27

38
set SDK_REMOTE=https://github.com/php/php-sdk-binary-tools.git
49
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
@@ -20,25 +25,18 @@ if not exist "%SDK_RUNNER%" (
2025

2126
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
2227
echo Cloning remote SDK repository
23-
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
28+
git clone -q --branch %SDK_BRANCH% %SDK_REMOTE% --depth 1 "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
2429
)
2530

2631
for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
2732
echo Got SDK version %GOT_SDK_VER%
2833
if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
2934
echo Switching to the configured SDK version %SDK_BRANCH:~8%
3035
echo Fetching remote SDK repository
31-
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
36+
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin
3237
echo Checkout SDK repository branch
33-
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
34-
)
35-
36-
if not exist "%SDK_RUNNER%" (
37-
echo "%SDK_RUNNER%" doesn't exist
38-
exit /b 3
38+
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
3939
)
4040

41-
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\build_task.bat
41+
cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
4242
if %errorlevel% neq 0 exit /b 3
43-
44-
exit /b 0
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
@echo on
2+
3+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
4+
echo for CI only
5+
exit /b 3
6+
)
7+
8+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" equ "True" (
9+
rem rmdir takes several minutes for large directories, rename instead
10+
if /i "%APPVEYOR%" equ "True" (
11+
rmdir /s /q C:\cygwin >NUL 2>NUL
12+
if %errorlevel% neq 0 exit /b 3
13+
rmdir /s /q C:\cygwin64 >NUL 2>NUL
14+
if %errorlevel% neq 0 exit /b 3
15+
rmdir /s /q C:\mingw >NUL 2>NUL
16+
if %errorlevel% neq 0 exit /b 3
17+
rmdir /s /q C:\mingw-w64 >NUL 2>NUL
18+
if %errorlevel% neq 0 exit /b 3
19+
rmdir /s /q C:\msys64 >NUL 2>NUL
20+
if %errorlevel% neq 0 exit /b 3
21+
) else (
22+
rename C:\cygwin C:\trash-cygwin
23+
if %errorlevel% neq 0 exit /b 3
24+
rename C:\cygwin64 C:\trash-cygwin64
25+
if %errorlevel% neq 0 exit /b 3
26+
rename C:\mingw C:\trash-mingw
27+
if %errorlevel% neq 0 exit /b 3
28+
rename C:\mingw-w64 C:\trash-mingw-w64
29+
if %errorlevel% neq 0 exit /b 3
30+
rename C:\msys64 C:\trash-msys64
31+
if %errorlevel% neq 0 exit /b 3
32+
)
33+
rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
34+
if %errorlevel% neq 0 exit /b 3
35+
rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
36+
if %errorlevel% neq 0 exit /b 3
37+
rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
38+
if %errorlevel% neq 0 exit /b 3
39+
rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
40+
if %errorlevel% neq 0 exit /b 3
41+
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
42+
if %errorlevel% neq 0 exit /b 3
43+
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
44+
if %errorlevel% neq 0 exit /b 3
45+
)
46+
47+
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
48+
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
49+
) else (
50+
set BRANCH=master
51+
)
52+
set STABILITY=staging
53+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
54+
rem SDK is cached, deps info is cached as well
55+
echo Updating dependencies in %DEPS_DIR%
56+
cmd /c phpsdk_deps --update --no-backup --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR% --crt %PHP_BUILD_CRT%
57+
if %errorlevel% neq 0 exit /b 3
58+
59+
rem Something went wrong, most likely when concurrent builds were to fetch deps
60+
rem updates. It might be, that some locking mechanism is needed.
61+
if not exist "%DEPS_DIR%" (
62+
cmd /c phpsdk_deps --update --force --no-backup --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
63+
)
64+
if %errorlevel% neq 0 exit /b 3
65+
66+
cmd /c buildconf.bat --force
67+
if %errorlevel% neq 0 exit /b 3
68+
69+
if "%THREAD_SAFE%" equ "" set ADD_CONF=%ADD_CONF% --disable-zts
70+
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
71+
72+
if "%PLATFORM%" == "x86" (
73+
set CFLAGS=/W1
74+
) else (
75+
set CFLAGS=/W1 /WX
76+
)
77+
78+
cmd /c configure.bat ^
79+
--enable-snapshot-build ^
80+
--disable-debug-pack ^
81+
--enable-com-dotnet=shared ^
82+
--without-analyzer ^
83+
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
84+
--with-php-build=%DEPS_DIR% ^
85+
%ADD_CONF% ^
86+
--disable-test-ini
87+
if %errorlevel% neq 0 exit /b 3
88+
89+
nmake /NOLOGO /S
90+
if %errorlevel% neq 0 exit /b 3

.github/scripts/windows/test.bat

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo on
2+
3+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
4+
echo for CI only
5+
exit /b 3
6+
)
7+
8+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
9+
10+
cmd /c %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\.github\scripts\windows\test_task.bat
11+
if %errorlevel% neq 0 exit /b 3

.github/scripts/windows/test_task.bat

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
@echo on
2+
3+
if /i "%APPVEYOR%%GITHUB_ACTIONS%" neq "True" (
4+
echo for CI only
5+
exit /b 3
6+
)
7+
8+
set NO_INTERACTION=1
9+
set REPORT_EXIT_STATUS=1
10+
set SKIP_IO_CAPTURE_TESTS=1
11+
12+
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
13+
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
14+
set STABILITY=stable
15+
) else (
16+
set BRANCH=master
17+
set STABILITY=staging
18+
)
19+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
20+
if not exist "%DEPS_DIR%" (
21+
echo "%DEPS_DIR%" doesn't exist
22+
exit /b 3
23+
)
24+
25+
if /i "%APPVEYOR%" equ "True" (
26+
rem setup MySQL related exts
27+
set MYSQL_PWD=Password12!
28+
set MYSQL_TEST_PASSWD=%MYSQL_PWD%
29+
set MYSQL_TEST_USER=root
30+
set MYSQL_TEST_HOST=127.0.0.1
31+
set MYSQL_TEST_PORT=3306
32+
set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
33+
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
34+
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
35+
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
36+
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST%;port=%PDO_MYSQL_TEST_PORT%;dbname=test
37+
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
38+
if %errorlevel% neq 0 exit /b 3
39+
40+
rem setup PostgreSQL related exts
41+
set PGUSER=postgres
42+
set PGPASSWORD=Password12!
43+
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
44+
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> ext\pgsql\tests\config.inc
45+
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
46+
"C:\Program Files\PostgreSQL\10\bin\createdb.exe" test
47+
if %errorlevel% neq 0 exit /b 3
48+
49+
rem setup ODBC related exts
50+
set ODBC_TEST_USER=sa
51+
set ODBC_TEST_PASS=Password12!
52+
set ODBC_TEST_DSN=Driver={ODBC Driver 13 for SQL Server};Server=^(local^)\SQL2017;Database=master;uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
53+
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
54+
)
55+
56+
rem prepare for ext/openssl
57+
rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
58+
rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
59+
if "%PLATFORM%" == "x86" (
60+
set OPENSSLDIR="C:\Program Files (x86)\Common Files\SSL"
61+
) else (
62+
set OPENSSLDIR="C:\Program Files\Common Files\SSL"
63+
)
64+
if /i "%GITHUB_ACTIONS%" equ "True" (
65+
rmdir /s /q %OPENSSLDIR% >NUL 2>NUL
66+
)
67+
mkdir %OPENSSLDIR%
68+
if %errorlevel% neq 0 exit /b 3
69+
copy %DEPS_DIR%\template\ssl\openssl.cnf %OPENSSLDIR%
70+
if %errorlevel% neq 0 exit /b 3
71+
rem set OPENSSL_CONF=%OPENSSLDIR%\openssl.cnf
72+
set OPENSSL_CONF=
73+
rem set SSLEAY_CONF=
74+
75+
rem prepare for enchant
76+
mkdir C:\usr\local\lib\enchant-2
77+
if %errorlevel% neq 0 exit /b 3
78+
copy %DEPS_DIR%\bin\libenchant2_hunspell.dll C:\usr\local\lib\enchant-2
79+
if %errorlevel% neq 0 exit /b 3
80+
reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
81+
if %errorlevel% neq 0 exit /b 3
82+
set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
83+
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
84+
echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
85+
mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
86+
)
87+
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
88+
echo Fetching enchant dicts
89+
pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
90+
del /q *
91+
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
92+
unzip dict.zip
93+
del /q dict.zip
94+
popd
95+
)
96+
mkdir %LOCALAPPDATA%\enchant\hunspell
97+
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %LOCALAPPDATA%\enchant\hunspell
98+
99+
set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
100+
if "%THREAD_SAFE%" neq "" 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%" neq "" 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+
set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe
111+
112+
mkdir c:\tests_tmp
113+
114+
set TEST_PHP_JUNIT=c:\junit.out.xml
115+
116+
nmake test TESTS=" -q -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP --color --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp -j2"
117+
if %errorlevel% neq 0 exit /b %errorlevel%
118+
119+
set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M
120+
nmake test TESTS="%OPCACHE_OPTS% -q -g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP --color --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp -j2"
121+
if %errorlevel% neq 0 exit /b %errorlevel%

.github/workflows/push.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,36 @@ 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+
- x64: true
95+
zts: true
96+
- x64: false
97+
zts: false
98+
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
99+
runs-on: windows-2019
100+
env:
101+
APPVEYOR_BUILD_FOLDER: "${{ github.workspace }}"
102+
APPVEYOR_REPO_BRANCH: "${{ github.ref_name }}"
103+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
104+
PHP_BUILD_OBJ_DIR: c:\obj
105+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
106+
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
107+
PHP_BUILD_CRT: vs16
108+
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
109+
THREAD_SAFE: "${{ matrix.zts && '1' || '' }}"
110+
INTRINSICS: "${{ matrix.zts && 'AVX' || '' }}"
111+
steps:
112+
- name: git checkout 1/2
113+
run: git config --global core.autocrlf false && git config --global core.eol lf
114+
- name: git checkout 2/2
115+
uses: actions/checkout@v2
116+
- name: Build
117+
run: .github/scripts/windows/build.bat
118+
- name: Test
119+
run: .github/scripts/windows/test.bat

0 commit comments

Comments
 (0)