Re: com php-src: add scripts for AppVeyor integration: .appveyor.yml appveyor/build.bat appveyor/build_task.bat appveyor/test.bat
appveyor/test_task.bat
| From: | Nikita Popov | Date: | Fri, 16 Dec 2016 20:04:56 +0000 |
| Subject: | Re: com php-src: add scripts for AppVeyor integration: .appveyor.yml appveyor/build.bat appveyor/build_task.bat appveyor/test.bat appveyor/test_task.bat |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-96344@lists.php.net to get a copy of this message | ||
On Fri, Dec 16, 2016 at 11:48 AM, Anatol Belski <ab@php.net> wrote:
> Commit: c737d6fb495ee986f7819472db861aa9e1bf42b1
> Author: Anatol Belski <ab@php.net> Fri, 16 Dec 2016 11:48:08
> +0100
> Parents: 10b037bc33f501a6011259830c58ff0f343e170f
> Branches: master
>
> Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=
> c737d6fb495ee986f7819472db861aa9e1bf42b1
>
> Log:
> add scripts for AppVeyor integration
>
> Changed paths:
> A .appveyor.yml
> A appveyor/build.bat
> A appveyor/build_task.bat
> A appveyor/test.bat
> A appveyor/test_task.bat
>
>
> Diff:
> diff --git a/.appveyor.yml b/.appveyor.yml
> new file mode 100644
> index 0000000..210130e
> --- /dev/null
> +++ b/.appveyor.yml
> @@ -0,0 +1,43 @@
> +image: Visual Studio 2015
> +
> +clone_depth: 64
> +
> +cache:
> + - c:\build-cache
> + - c:\build-cache\sdk -> .appveyor.yml
> +
> +environment:
> + PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
> + PHP_BUILD_OBJ_DIR: c:\obj
> + PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
> + PHP_BUILD_SDK_BRANCH: php-sdk-2.0.0alpha6
> + # ext and env setup for tests
> + #MYSQL_TEST_PASSWD: Password12!
> + #MYSQL_TEST_USER: root
> + #PDO_MYSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test
> user=root password=Password12!"
> + #PDO_MYSQL_TEST_USER: root
> + #PDO_MYSQL_TEST_PASS: Password12!
> + #PGSQL_TEST_CONNSTR: "host=127.0.0.1 dbname=test port=5432
> user=postgres password=Password12!"
> + #PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test
> user=postgres password=Password12!"
> + #build permutations
> + matrix:
> + - THREAD_SAFE: 0
> + OPCACHE: 0
> + - THREAD_SAFE: 1
> + OPCACHE: 1
> +
> +services:
> + # the setup scripts have to be touched, once some other db
> version is used
> + - mysql
> + - postgresql95
> +
> +platform:
> + - x64
> + # - x86
> +
> +build_script:
> + - appveyor\build.bat
> +
> +test_script:
> + - appveyor\test.bat
> +
> diff --git a/appveyor/build.bat b/appveyor/build.bat
> new file mode 100644
> index 0000000..c5ae57a
> --- /dev/null
> +++ b/appveyor/build.bat
> @@ -0,0 +1,33 @@
> +@echo off
> +
> +set
> SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
> +set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
> +
> +if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
> + echo Creating %PHP_BUILD_CACHE_BASE_DIR%
> + mkdir "%PHP_BUILD_CACHE_BASE_DIR%"
> +)
> +
> +if not exist "%PHP_BUILD_OBJ_DIR%" (
> + echo Creating %PHP_BUILD_OBJ_DIR%
> + mkdir "%PHP_BUILD_OBJ_DIR%"
> +)
> +
> +if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
> + echo Cloning remote SDK repository
> + git clone --branch %SDK_BRANCH% %SDK_REMOTE%
> "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
> +) else (
> + echo Fetching remote SDK repository
> + git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git"
> --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
> + echo Checkout SDK repository branch
> + git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git"
> --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
> +)
> +
> +set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
> +if not exist "%SDK_RUNNER%" (
> + echo "%SDK_RUNNER%" doesn't exist
> + exit /b 3
> +)
> +
> +call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\build_task.bat
> +
> diff --git a/appveyor/build_task.bat b/appveyor/build_task.bat
> new file mode 100644
> index 0000000..3ededee
> --- /dev/null
> +++ b/appveyor/build_task.bat
> @@ -0,0 +1,48 @@
> +@echo off
> +
> +if "%APPVEYOR%" equ "True" rmdir /s /q C:\cygwin >NUL 2>NUL
> +if errorlevel 1 exit /b 1
> +if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
> +if errorlevel 1 exit /b 1
> +if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
> +if errorlevel 1 exit /b 1
> +
> +cd /D %APPVEYOR_BUILD_FOLDER%
> +if errorlevel 1 exit /b 1
> +
> +if /i "%APPVEYOR_REPO_BRANCH:~0,4%" equ "php-" (
> + set BRANCH=%APPVEYOR_REPO_BRANCH:~4%
> + set STABILITY=stable
> +) else (
> + set BRANCH=master
> + set STABILITY=staging
> +)
> +set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%
> PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
> +rem SDK is cached, deps info is cached as well
> +echo Updating dependencies
> +call phpsdk_deps --update --branch %BRANCH% --stability %STABILITY%
> --deps %DEPS_DIR%
> +
> +call buildconf.bat --force
> +if errorlevel 1 exit /b 1
> +
> +if "%THREAD_SAFE%" equ "0" set ADD_CONF=--disable-zts
> +
> +set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_odbc,
> odbc,pdo_firebird,interbase,ldap,imap,dba
> +if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_
> EXCLUDE_FROM_TEST%,opcache
> +
> +call configure.bat ^
> + --enable-snapshot-build ^
> + --enable-debug-pack ^
> + --enable-com-dotnet=shared ^
> + --without-analyzer ^
> + --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
> + --with-php-build=%DEPS_DIR% ^
> + %ADD_CONF% ^
> + --with-test-ini-ext-exclude=%EXT_EXCLUDE_FROM_TEST%
> +if errorlevel 1 exit /b 1
> +
> +nmake /NOLOGO
> +if errorlevel 1 exit /b 1
> +
> +exit /b 0
> +
> diff --git a/appveyor/test.bat b/appveyor/test.bat
> new file mode 100644
> index 0000000..fbe24ec
> --- /dev/null
> +++ b/appveyor/test.bat
> @@ -0,0 +1,10 @@
> +@echo off
> +
> +set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-vc14-%PLATFORM%.bat
> +if not exist "%SDK_RUNNER%" (
> + echo "%SDK_RUNNER%" doesn't exist
> + exit /b 3
> +)
> +
> +call %SDK_RUNNER% -t %APPVEYOR_BUILD_FOLDER%\appveyor\test_task.bat
> +
> diff --git a/appveyor/test_task.bat b/appveyor/test_task.bat
> new file mode 100644
> index 0000000..34bc161
> --- /dev/null
> +++ b/appveyor/test_task.bat
> @@ -0,0 +1,68 @@
> +@echo off
> +
> +set NO_INTERACTION=1
> +set REPORT_EXIT_STATUS=1
> +set SKIP_IO_CAPTURE_TESTS=1
> +
> +set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%PHP_SDK_VC%-%
> PHP_SDK_ARCH%-%APPVEYOR_REPO_BRANCH%
> +
> +rem setup MySQL related exts
> +set MYSQL_PWD=Password12!
> +set MYSQL_TEST_PASSWD=%MYSQL_PWD%
> +set MYSQL_TEST_USER=root
> +set MYSQL_TEST_HOST=127.0.0.1
> +set MYSQL_TEST_PORT=3306
> +set PDO_MYSQL_TEST_USER=%MYSQL_TEST_USER%
> +set PDO_MYSQL_TEST_PASS=%MYSQL_PWD%
> +set PDO_MYSQL_TEST_HOST=%MYSQL_TEST_HOST%
> +set PDO_MYSQL_TEST_PORT=%MYSQL_TEST_PORT%
> +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%
> +"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe"
> --user=%MYSQL_TEST_USER% -e "CREATE DATABASE IF NOT EXISTS test"
> +
> +rem setup PostgreSQL related exts
> +set PGUSER=postgres
> +set PGPASSWORD=Password12!
> +rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432
> user=postgres password=Password12!
> +echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432
> user=%PGUSER% password=%PGPASSWORD%"; ?^> >>
> "./ext/pgsql/tests/config.inc"
> +set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test
> user=%PGUSER% password=%PGPASSWORD%
> +"C:\Program Files\PostgreSQL\9.5\bin\createdb.exe" test
> +
> +rem prepare for ext/openssl
> +if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win32 >NUL 2>NUL
> +if "%APPVEYOR%" equ "True" rmdir /s /q C:\OpenSSL-Win64 >NUL 2>NUL
> +mkdir c:\usr\local\ssl
> +copy %DEPS_DIR%\template\ssl\openssl.cnf c:\usr\local\ssl
> +set OPENSSL_CONF=c:\usr\local\ssl\openssl.cnf
> +rem set OPENSSL_CONF=
> +rem set SSLEAY_CONF=
> +
> +rem prepare for Opcache
> +if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enabled=1 -d
> opcache.enable_cli=1
> +
> +rem prepare for enchant
> +mkdir c:\enchant_plugins
> +copy %DEPS_DIR%\bin\libenchant_ispell.dll c:\enchant_plugins
> +copy %DEPS_DIR%\bin\libenchant_myspell.dll c:\enchant_plugins
> +reg add HKEY_CURRENT_USER\SOFTWARE\Enchant\Config /v Module_Dir /t
> REG_SZ /d c:\enchant_plugins
> +set PHP_BUILD_CACHE_ENCHANT_DICT_DIR=%PHP_BUILD_CACHE_BASE_DIR%
> \enchant_dict
> +if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%" (
> + echo Creating %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
> + mkdir "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%"
> +)
> +if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
> + echo Fetching enchant dicts
> + pushd %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%
> + del /q *
> + powershell -Command wget http://windows.php.net/
> downloads/qa/appveyor/ext/enchant/dict.zip -OutFile dict.zip
> + unzip dict.zip
> + del /q dict.zip
> + popd
> +)
> +mkdir %USERPROFILE%\enchant\myspell
> +copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %USERPROFILE%\enchant\myspell
> +
> +mkdir c:\tests_tmp
> +
> +cd "%APPVEYOR_BUILD_FOLDER%"
> +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"
> +
>
It looks like the AppVeyor build is currently always failing for non-master
branches. Is it possible to restrict it to master only (and PRs against
master)?
Nikita