Skip to content

Commit aeebae6

Browse files
committed
add scripts for AppVeyor integration
(cherry picked from commit c737d6f)
1 parent 5004ae2 commit aeebae6

File tree

5 files changed

+202
-0
lines changed

5 files changed

+202
-0
lines changed

.appveyor.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
image: Visual Studio 2015
2+
3+
clone_depth: 64
4+
5+
cache:
6+
- c:\build-cache
7+
- c:\build-cache\sdk -> .appveyor.yml
8+
9+
environment:
10+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
11+
PHP_BUILD_OBJ_DIR: c:\obj
12+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
13+
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.0alpha6
14+
# ext and env setup for tests
15+
#MYSQL_TEST_PASSWD: Password12!
16+
#MYSQL_TEST_USER: root
17+
#PDO_MYSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=root password=Password12!"
18+
#PDO_MYSQL_TEST_USER: root
19+
#PDO_MYSQL_TEST_PASS: Password12!
20+
#PGSQL_TEST_CONNSTR: "host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!"
21+
#PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=Password12!"
22+
#build permutations
23+
matrix:
24+
- THREAD_SAFE: 0
25+
OPCACHE: 0
26+
- THREAD_SAFE: 1
27+
OPCACHE: 1
28+
29+
services:
30+
# the setup scripts have to be touched, once some other db version is used
31+
- mysql
32+
- postgresql95
33+
34+
platform:
35+
- x64
36+
# - x86
37+
38+
build_script:
39+
- appveyor\build.bat
40+
41+
test_script:
42+
- appveyor\test.bat
43+

appveyor/build.bat

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@echo off
2+
3+
set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
4+
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
5+
6+
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
7+
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
8+
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
9+
)
10+
11+
if not exist "%PHP_BUILD_OBJ_DIR%" (
12+
echo Creating %PHP_BUILD_OBJ_DIR%
13+
mkdir "%PHP_BUILD_OBJ_DIR%"
14+
)
15+
16+
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
17+
echo Cloning remote SDK repository
18+
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
19+
) else (
20+
echo Fetching remote SDK repository
21+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
22+
echo Checkout SDK repository branch
23+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
24+
)
25+
26+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
27+
if not exist "%SDK_RUNNER%" (
28+
echo "%SDK_RUNNER%" doesn't exist
29+
exit /b 3
30+
)
31+
32+
call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\build_task.bat
33+

appveyor/build_task.bat

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@echo off
2+
3+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
4+
if errorlevel 1 exit /b 1
5+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
6+
if errorlevel 1 exit /b 1
7+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
8+
if errorlevel 1 exit /b 1
9+
10+
cd /D %APPVEYOR_BUILD_FOLDER%
11+
if errorlevel 1 exit /b 1
12+
13+
if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
14+
set BRANCH=%APPVEYOR_REPO_BRANCH:~4%
15+
set STABILITY=stable
16+
) else (
17+
set BRANCH=master
18+
set STABILITY=staging
19+
)
20+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
21+
rem SDK is cached, deps info is cached as well
22+
echo Updating dependencies
23+
call phpsdk_deps --update --branch %BRANCH% --stability %STABILITY% --deps %DEPS_DIR%
24+
25+
call buildconf.bat --force
26+
if errorlevel 1 exit /b 1
27+
28+
if "%THREAD_SAFE%" equ "0" set ADD_CONF=--disable-zts
29+
30+
set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_odbc,odbc,pdo_firebird,interbase,ldap,imap,dba
31+
if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
32+
33+
call configure.bat ^
34+
--enable-snapshot-build ^
35+
--enable-debug-pack ^
36+
--enable-com-dotnet=shared ^
37+
--without-analyzer ^
38+
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
39+
--with-php-build=%DEPS_DIR% ^
40+
%ADD_CONF% ^
41+
--with-test-ini-ext-exclude=%EXT_EXCLUDE_FROM_TEST%
42+
if errorlevel 1 exit /b 1
43+
44+
nmake /NOLOGO
45+
if errorlevel 1 exit /b 1
46+
47+
exit /b 0
48+

appveyor/test.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
3+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
4+
if not exist "%SDK_RUNNER%" (
5+
echo "%SDK_RUNNER%" doesn't exist
6+
exit /b 3
7+
)
8+
9+
call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\test_task.bat
10+

appveyor/test_task.bat

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@echo off
2+
3+
set NO_INTERACTION=1
4+
set REPORT_EXIT_STATUS=1
5+
set SKIP_IO_CAPTURE_TESTS=1
6+
7+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
8+
9+
rem setup MySQL related exts
10+
set MYSQL_PWD=Password12!
11+
set MYSQL_TEST_PASSWD=%MYSQL_PWD%
12+
set MYSQL_TEST_USER=root
13+
set MYSQL_TEST_HOST=127.0.0.1
14+
set MYSQL_TEST_PORT=3306
15+
set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
16+
set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
17+
set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
18+
set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
19+
set PDO_MYSQL_TEST_DSN=mysql:host=%PDO_MYSQL_TEST_HOST% port=%PDO_MYSQL_TEST_PORT% dbname=test user=%PDO_MYSQL_TEST_USER% password=%MYSQL_PW%
20+
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
21+
22+
rem setup PostgreSQL related exts
23+
set PGUSER=postgres
24+
set PGPASSWORD=Password12!
25+
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
26+
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
27+
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
28+
"C:\Program Files\PostgreSQL\9.5\bin\createdb.exe" test
29+
30+
rem prepare for ext/openssl
31+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
32+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
33+
mkdir c:\usr\local\ssl
34+
copy %DEPS_DIR%\template\ssl\openssl.cnf c:\usr\local\ssl
35+
set OPENSSL_CONF=c:\usr\local\ssl\openssl.cnf
36+
rem set OPENSSL_CONF=
37+
rem set SSLEAY_CONF=
38+
39+
rem prepare for Opcache
40+
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enabled=1 -d opcache.enable_cli=1
41+
42+
rem prepare for enchant
43+
mkdir c:\enchant_plugins
44+
copy %DEPS_DIR%\bin\libenchant_ispell.dll c:\enchant_plugins
45+
copy %DEPS_DIR%\bin\libenchant_myspell.dll c:\enchant_plugins
46+
reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t REG_SZ /d c:\enchant_plugins
47+
set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%\enchant_dict
48+
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
49+
echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
50+
mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
51+
)
52+
if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
53+
echo Fetching enchant dicts
54+
pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
55+
del /q *
56+
powershell -Command wget http://windows.php.net/downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
57+
unzip dict.zip
58+
del /q dict.zip
59+
popd
60+
)
61+
mkdir %USERPROFILE%\enchant\myspell
62+
copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %USERPROFILE%\enchant\myspell
63+
64+
mkdir c:\tests_tmp
65+
66+
cd "%APPVEYOR_BUILD_FOLDER%"
67+
nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp"
68+

0 commit comments

Comments
 (0)