Skip to content

Commit 2b87363

Browse files
committed
PHPC-1121: Added Appveyor config
1 parent 30fa13e commit 2b87363

File tree

4 files changed

+212
-0
lines changed

4 files changed

+212
-0
lines changed

.appveyor.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
image: Visual Studio 2015
2+
version: '{branch}.{build}'
3+
4+
cache:
5+
- c:\build-cache -> .appveyor.yml, .appveyor\*.cmd
6+
7+
environment:
8+
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
9+
PHP_BUILD_OBJ_DIR: c:\obj
10+
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
11+
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.1
12+
SDK_REMOTE: https://github.com/OSTC/php-sdk-binary-tools.git
13+
SDK_BRANCH: php-sdk-2.1.1
14+
15+
matrix:
16+
- PHP_REL: 7.2
17+
ARCHITECTURE: x64
18+
ZTS_STATE: enable
19+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
20+
PHP_BUILD_CRT: vc15
21+
- PHP_REL: 7.2
22+
ARCHITECTURE: x64
23+
ZTS_STATE: disable
24+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
25+
PHP_BUILD_CRT: vc15
26+
- PHP_REL: 7.2
27+
ARCHITECTURE: x86
28+
ZTS_STATE: enable
29+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
30+
PHP_BUILD_CRT: vc15
31+
- PHP_REL: 7.2
32+
ARCHITECTURE: x86
33+
ZTS_STATE: disable
34+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
35+
PHP_BUILD_CRT: vc15
36+
- PHP_REL: 7.1
37+
ARCHITECTURE: x64
38+
ZTS_STATE: enable
39+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
40+
PHP_BUILD_CRT: vc14
41+
- PHP_REL: 7.1
42+
ARCHITECTURE: x86
43+
ZTS_STATE: disable
44+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
45+
PHP_BUILD_CRT: vc14
46+
- PHP_REL: 7.0
47+
ARCHITECTURE: x64
48+
ZTS_STATE: disable
49+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
50+
PHP_BUILD_CRT: vc14
51+
- PHP_REL: 7.0
52+
ARCHITECTURE: x86
53+
ZTS_STATE: enable
54+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
55+
PHP_BUILD_CRT: vc14
56+
57+
install:
58+
- .appveyor\install.cmd
59+
60+
build_script:
61+
- .appveyor\build.cmd

.appveyor/build.cmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo off
2+
3+
setlocal enableextensions enabledelayedexpansion
4+
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%ARCHITECTURE%.bat
5+
if not exist "!SDK_RUNNER!" (
6+
echo "!SDK_RUNNER!" doesn't exist
7+
exit /b 3
8+
)
9+
10+
cmd /c !SDK_RUNNER! -t %APPVEYOR_BUILD_FOLDER%\.appveyor\build_task.cmd
11+
12+
if %errorlevel% neq 0 exit /b 3
13+
endlocal
14+
15+
exit /b 0

.appveyor/build_task.cmd

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
@echo off
2+
setlocal enableextensions enabledelayedexpansion
3+
4+
cd /D %APPVEYOR_BUILD_FOLDER%
5+
if %errorlevel% neq 0 exit /b 3
6+
7+
set STABILITY=staging
8+
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_REL%-%PHP_SDK_VC%-%PHP_SDK_ARCH%
9+
rem SDK is cached, deps info is cached as well
10+
echo Updating dependencies in %DEPS_DIR%
11+
cmd /c phpsdk_deps --update --no-backup --branch %PHP_REL% --stability %STABILITY% --deps %DEPS_DIR%
12+
if %errorlevel% neq 0 exit /b 3
13+
14+
rem Something went wrong, most likely when concurrent builds were to fetch deps
15+
rem updates. It might be, that some locking mechanism is needed.
16+
if not exist "%DEPS_DIR%" (
17+
cmd /c phpsdk_deps --update --force --no-backup --branch %PHP_REL% --stability %STABILITY% --deps %DEPS_DIR%
18+
)
19+
if %errorlevel% neq 0 exit /b 3
20+
21+
if "%ZTS_STATE%"=="enable" set ZTS_SHORT=ts
22+
if "%ZTS_STATE%"=="disable" set ZTS_SHORT=nts
23+
if "%ZTS_STATE%"=="enable" set ZTS_IN_FILENAME=
24+
if "%ZTS_STATE%"=="disable" set ZTS_IN_FILENAME=-nts
25+
if "%PHP_SDK_ARCH%"=="x86" set ARCH_IN_FILENAME=
26+
if "%PHP_SDK_ARCH%"=="x64" set ARCH_IN_FILENAME=-x86_64
27+
28+
cd /d C:\projects\php-src
29+
30+
cmd /c buildconf.bat --force
31+
32+
if %errorlevel% neq 0 exit /b 3
33+
34+
cmd /c configure.bat --disable-all --with-mp=auto --enable-cli --%ZTS_STATE%-zts --enable-json --with-openssl --enable-mongodb=shared --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR%
35+
36+
if %errorlevel% neq 0 exit /b 3
37+
38+
nmake /NOLOGO
39+
if %errorlevel% neq 0 exit /b 3
40+
41+
nmake install
42+
43+
if %errorlevel% neq 0 exit /b 3
44+
45+
mkdir c:\tests_tmp
46+
set TEST_PHP_EXECUTABLE=%APPVEYOR_BUILD_FOLDER%\build\php.exe
47+
set TEST_PHP_JUNIT=c:\tests_tmp\tests-junit.xml
48+
if "%OPCACHE%" equ "1" set TEST_PHP_ARGS=!TEST_PHP_ARGS! -d extension=%APPVEYOR_BUILD_FOLDER%\build\ext\php_opcache.so -d opcache.enable=1 -d opcache.enable_cli=1
49+
set TEST_PHP_ARGS=-n -d -foo=1 -d extension=%APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll -dxdebug.remote_enable=1
50+
set SKIP_SLOW_TESTS=1
51+
set SKIP_DBGP_TESTS=1
52+
set SKIP_IPV6_TESTS=1
53+
set REPORT_EXIT_STATUS=1
54+
echo !TEST_PHP_EXECUTABLE! !TEST_PHP_ARGS! -v
55+
echo !TEST_PHP_EXECUTABLE! -n run-tests.php -q -x --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp %APPVEYOR_BUILD_FOLDER%\tests
56+
!TEST_PHP_EXECUTABLE! !TEST_PHP_ARGS! -v
57+
!TEST_PHP_EXECUTABLE! -n run-tests.php -q -x --show-diff %APPVEYOR_BUILD_FOLDER%\tests
58+
59+
set EXIT_CODE=%errorlevel%
60+
powershell -Command "$wc = New-Object 'System.Net.WebClient'; $wc.UploadFile('https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%', 'c:\tests_tmp\tests-junit.xml')"
61+
62+
rem We have run the tests, but we're *not* making that fail the build — yet
63+
rem if %EXIT_CODE% neq 0 exit /b 3
64+
65+
cd /d %APPVEYOR_BUILD_FOLDER%
66+
67+
if not exist "%APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll" exit /b 3
68+
69+
xcopy %APPVEYOR_BUILD_FOLDER%\LICENSE %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\ /y /f
70+
echo F|xcopy %APPVEYOR_BUILD_FOLDER%\build\ext\php_mongodb.dll %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.dll /y /f
71+
7z a php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip %APPVEYOR_BUILD_FOLDER%\php_mongodb-%PHP_REL%-!ZTS_SHORT!-%PHP_BUILD_CRT%-%PHP_SDK_ARCH%\*
72+
appveyor PushArtifact php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip -FileName php_mongodb-%APPVEYOR_REPO_TAG_NAME%-%PHP_REL%-%PHP_BUILD_CRT%!ZTS_IN_FILENAME!!ARCH_IN_FILENAME!.zip
73+
endlocal

.appveyor/install.cmd

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
@echo off
2+
setlocal enableextensions enabledelayedexpansion
3+
cinst wget
4+
5+
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
6+
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
7+
mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
8+
)
9+
10+
if not exist "%PHP_BUILD_OBJ_DIR%" (
11+
echo Creating %PHP_BUILD_OBJ_DIR%
12+
mkdir "%PHP_BUILD_OBJ_DIR%"
13+
)
14+
15+
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
16+
echo Cloning remote SDK repository
17+
git clone -q --depth=1 --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%"
18+
) else (
19+
echo Fetching remote SDK repository
20+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
21+
echo Checkout SDK repository branch
22+
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
23+
)
24+
25+
if "%PHP_REL%"=="master" (
26+
echo Cloning PHP master repository
27+
git clone -q --depth=1 --branch=%PHP_REL% https://github.com/php/php-src C:\projects\php-src
28+
) else (
29+
echo Cloning PHP %PHP_REL% repository
30+
git clone -q --depth=1 --branch=PHP-%PHP_REL% https://github.com/php/php-src C:\projects\php-src
31+
)
32+
33+
echo "Runnning sub-module fetch"
34+
git submodule update --init --recursive
35+
36+
xcopy %APPVEYOR_BUILD_FOLDER% C:\projects\php-src\ext\mongodb\ /s /e /y /q
37+
38+
xcopy %APPVEYOR_BUILD_FOLDER%\LICENSE %APPVEYOR_BUILD_FOLDER%\artifacts\ /y /f /q
39+
40+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
41+
if %errorlevel% neq 0 exit /b 3
42+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin64 >NUL 2>NUL
43+
if %errorlevel% neq 0 exit /b 3
44+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
45+
if %errorlevel% neq 0 exit /b 3
46+
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
47+
if %errorlevel% neq 0 exit /b 3
48+
49+
if "%APPVEYOR_REPO_TAG_NAME%"=="" (
50+
set APPVEYOR_REPO_TAG_NAME=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
51+
for /f "delims=" %%l in (php_phongo.h) do (
52+
if not "%%l"=="" (
53+
set line=%%l
54+
if "!line:~8,19!"=="PHP_MONGODB_VERSION" (
55+
set APPVEYOR_REPO_TAG_NAME=!line:~29,-1!-%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT:~0,8%
56+
)
57+
)
58+
)
59+
echo Final repo tag name: !APPVEYOR_REPO_TAG_NAME!
60+
61+
appveyor SetVariable -Name APPVEYOR_REPO_TAG_NAME -Value !APPVEYOR_REPO_TAG_NAME!
62+
)
63+
endlocal

0 commit comments

Comments
 (0)