Skip to content

Commit e5e678a

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

File tree

13 files changed

+279
-253
lines changed

13 files changed

+279
-253
lines changed

.appveyor.yml

Lines changed: 5 additions & 17 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:
@@ -16,9 +11,6 @@ skip_commits:
1611
- UPGRADING
1712
- UPGRADING.INTERNALS
1813

19-
cache:
20-
- c:\build-cache
21-
2214
environment:
2315
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
2416
PHP_BUILD_OBJ_DIR: c:\obj
@@ -35,12 +27,8 @@ environment:
3527
#PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=Password12!"
3628
#build permutations
3729
matrix:
38-
- THREAD_SAFE: 0
39-
OPCACHE: 0
40-
PARALLEL: -j2
30+
- THREAD_SAFE: ""
4131
- THREAD_SAFE: 1
42-
OPCACHE: 1
43-
PARALLEL: -j2
4432
INTRINSICS: AVX
4533

4634
services:
@@ -51,10 +39,10 @@ services:
5139

5240
platform:
5341
- x64
54-
# - x86
42+
#- x86
5543

5644
build_script:
57-
- appveyor\build.bat
45+
- .github\scripts\windows\build.bat
5846

5947
test_script:
60-
- appveyor\test.bat
48+
- .github\scripts\windows\test.bat

.github/scripts/windows/build.bat

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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_REMOTE=https://github.com/php/php-sdk-binary-tools.git
9+
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
10+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
11+
12+
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
13+
mkdir "%PHP_BUILD_OBJ_DIR%"
14+
15+
echo Cloning remote SDK repository
16+
git clone -q --branch %SDK_BRANCH% %SDK_REMOTE% --depth 1 "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
17+
18+
for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
19+
echo Got SDK version %GOT_SDK_VER%
20+
if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
21+
echo Switching to the configured SDK version %SDK_BRANCH:~8%
22+
echo Fetching remote SDK repository
23+
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin
24+
echo Checkout SDK repository branch
25+
git -q --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
26+
)
27+
28+
cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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%" equ "True" (
9+
rmdir /s /q C:\cygwin >NUL 2>NUL
10+
if %errorlevel% neq 0 exit /b 3
11+
rmdir /s /q C:\cygwin64 >NUL 2>NUL
12+
if %errorlevel% neq 0 exit /b 3
13+
rmdir /s /q C:\mingw >NUL 2>NUL
14+
if %errorlevel% neq 0 exit /b 3
15+
rmdir /s /q C:\mingw-w64 >NUL 2>NUL
16+
if %errorlevel% neq 0 exit /b 3
17+
rmdir /s /q C:\msys64 >NUL 2>NUL
18+
if %errorlevel% neq 0 exit /b 3
19+
rmdir /s /q c:\OpenSSL-Win32 >NUL 2>NUL
20+
if %errorlevel% neq 0 exit /b 3
21+
rmdir /s /q c:\OpenSSL-Win64 >NUL 2>NUL
22+
if %errorlevel% neq 0 exit /b 3
23+
rmdir /s /q c:\OpenSSL-v11-Win32 >NUL 2>NUL
24+
if %errorlevel% neq 0 exit /b 3
25+
rmdir /s /q c:\OpenSSL-v11-Win64 >NUL 2>NUL
26+
if %errorlevel% neq 0 exit /b 3
27+
)
28+
if /i "%GITHUB_ACTIONS%" equ "True" (
29+
rem rmdir takes several minutes rename instead only
30+
ren "C:\msys64" "C:\trash-msys64"
31+
if %errorlevel% neq 0 exit /b 3
32+
)
33+
del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
34+
if %errorlevel% neq 0 exit /b 3
35+
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
36+
if %errorlevel% neq 0 exit /b 3
37+
38+
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
39+
set BRANCH=%APPVEYOR_REPO_BRANCH:~4,3%
40+
) else (
41+
set BRANCH=master
42+
)
43+
set STABILITY=staging
44+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
45+
rem SDK is cached, deps info is cached as well
46+
echo Updating dependencies in %DEPS_DIR%
47+
cmd /c phpsdk_deps --update --no-backup --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR% --crt %PHP_BUILD_CRT%
48+
if %errorlevel% neq 0 exit /b 3
49+
50+
rem Something went wrong, most likely when concurrent builds were to fetch deps
51+
rem updates. It might be, that some locking mechanism is needed.
52+
if not exist "%DEPS_DIR%" (
53+
cmd /c phpsdk_deps --update --force --no-backup --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
54+
)
55+
if %errorlevel% neq 0 exit /b 3
56+
57+
cmd /c buildconf.bat --force
58+
if %errorlevel% neq 0 exit /b 3
59+
60+
if "%THREAD_SAFE%" equ "" set ADD_CONF=%ADD_CONF% --disable-zts
61+
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
62+
63+
if "%PLATFORM%" == "x86" (
64+
set CFLAGS=/W1
65+
) else (
66+
set CFLAGS=/W1 /WX
67+
)
68+
69+
cmd /c configure.bat ^
70+
--enable-snapshot-build ^
71+
--disable-debug-pack ^
72+
--enable-com-dotnet=shared ^
73+
--without-analyzer ^
74+
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
75+
--with-php-build=%DEPS_DIR% ^
76+
%ADD_CONF% ^
77+
--disable-test-ini
78+
if %errorlevel% neq 0 exit /b 3
79+
80+
nmake /NOLOGO /S

.github/scripts/windows/test.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 .github\scripts\windows\test_task.bat

.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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,35 @@ 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_REPO_BRANCH: "${{ github.ref_name }}"
102+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
103+
PHP_BUILD_OBJ_DIR: c:\obj
104+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
105+
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
106+
PHP_BUILD_CRT: vs16
107+
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
108+
THREAD_SAFE: "${{ matrix.zts && '1' || '' }}"
109+
INTRINSICS: "${{ matrix.zts && 'AVX' || '' }}"
110+
steps:
111+
- name: git checkout 1/2
112+
run: git config --global core.autocrlf false && git config --global core.eol lf
113+
- name: git checkout 2/2
114+
uses: actions/checkout@v2
115+
- name: Build
116+
run: .github/scripts/windows/build.bat
117+
- name: Test
118+
run: .github/scripts/windows/test.bat

appveyor/build.bat

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)