Add appveyor.yml for C.I. on Windows
This commit is contained in:
parent
cca29d849a
commit
8bbd8d90fe
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ phpunit.xml
|
|||||||
composer.phar
|
composer.phar
|
||||||
package.tar
|
package.tar
|
||||||
/packages.json
|
/packages.json
|
||||||
|
/.phpunit
|
||||||
|
30
.travis.yml
30
.travis.yml
@ -31,24 +31,22 @@ env:
|
|||||||
before_install:
|
before_install:
|
||||||
- composer self-update
|
- composer self-update
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi;
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
|
||||||
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
|
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
|
||||||
# Build a standalone phpunit without symfony/yaml and that works around https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223
|
- ./phpunit install
|
||||||
- (mkdir phpunit && cd phpunit && wget https://github.com/sebastianbergmann/phpunit/archive/4.7.zip && unzip 4.7.zip && cd phpunit-4.7 && composer remove --no-update symfony/yaml && composer require --prefer-source phpunit/phpunit-mock-objects '2.3.0')
|
- export PHPUNIT="$(readlink -f ./phpunit)"
|
||||||
- export PHPUNIT="$(readlink -f ./phpunit/phpunit-4.7/phpunit) --colors=always"
|
|
||||||
# Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built
|
|
||||||
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
|
||||||
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
|
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
|
||||||
- components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
- COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
||||||
- if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi;
|
- if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; $PHPUNIT --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; $PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
|
||||||
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
|
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
|
||||||
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
|
||||||
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
|
- if [ "$deps" = "low" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
|
||||||
|
53
appveyor.yml
Normal file
53
appveyor.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
build: false
|
||||||
|
shallow_clone: true
|
||||||
|
platform: x86
|
||||||
|
clone_folder: c:\projects\symfony
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- PHP_EXT: 1
|
||||||
|
- PHP_EXT: 0
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- c:\php -> appveyor.yml
|
||||||
|
- .phpunit -> phpunit
|
||||||
|
- vendor -> composer.json
|
||||||
|
|
||||||
|
init:
|
||||||
|
- SET PATH=c:\php;%PATH%
|
||||||
|
- SET COMPOSER_NO_INTERACTION=1
|
||||||
|
- SET SYMFONY_DEPRECATIONS_HELPER=weak
|
||||||
|
- SET PHP=1
|
||||||
|
|
||||||
|
install:
|
||||||
|
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
|
||||||
|
- cd c:\php
|
||||||
|
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.4.43-nts-Win32-VC9-x86.zip
|
||||||
|
- IF %PHP%==1 7z x php-5.4.43-nts-Win32-VC9-x86.zip -y > 7z.log
|
||||||
|
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/ICU-51.2-dlls.zip
|
||||||
|
- IF %PHP%==1 7z x ICU-51.2-dlls.zip -y > 7z.log
|
||||||
|
- IF %PHP%==1 cd ext
|
||||||
|
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/php_intl-3.0.0-5.4-nts-vc9-x86.zip
|
||||||
|
- IF %PHP%==1 7z x php_intl-3.0.0-5.4-nts-vc9-x86.zip -y > 7z.log
|
||||||
|
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apc/3.1.13/php_apc-3.1.13-5.4-nts-vc9-x86.zip
|
||||||
|
- IF %PHP%==1 7z x php_apc-3.1.13-5.4-nts-vc9-x86.zip -y > 7z.log
|
||||||
|
- IF %PHP%==1 cd ..
|
||||||
|
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
||||||
|
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
||||||
|
- copy php.ini-production php.ini /Y
|
||||||
|
- echo date.timezone="UTC" >> php.ini
|
||||||
|
- echo extension_dir=ext >> php.ini
|
||||||
|
- echo extension=php_openssl.dll >> php.ini
|
||||||
|
- IF %PHP_EXT%==1 echo extension=php_apc.dll >> php.ini
|
||||||
|
- IF %PHP_EXT%==1 echo extension=php_intl.dll >> php.ini
|
||||||
|
- IF %PHP_EXT%==1 echo extension=php_mbstring.dll >> php.ini
|
||||||
|
- IF %PHP_EXT%==1 echo extension=php_fileinfo.dll >> php.ini
|
||||||
|
- IF %PHP_EXT%==1 echo extension=php_pdo_sqlite.dll >> php.ini
|
||||||
|
- cd c:\projects\symfony
|
||||||
|
- php phpunit install
|
||||||
|
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
|
||||||
|
- composer update --prefer-dist --no-progress --ansi
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- cd c:\projects\symfony
|
||||||
|
- php phpunit symfony --exclude-group benchmark,intl-data
|
116
phpunit
Executable file
116
phpunit
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
error_reporting(-1);
|
||||||
|
|
||||||
|
$PHPUNIT_VERSION = 4.8;
|
||||||
|
$PHPUNIT_DIR = __DIR__.'/.phpunit';
|
||||||
|
|
||||||
|
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
|
||||||
|
# Build a standalone phpunit without symfony/yaml
|
||||||
|
|
||||||
|
$oldPwd = getcwd();
|
||||||
|
mkdir($PHPUNIT_DIR);
|
||||||
|
chdir($PHPUNIT_DIR);
|
||||||
|
if (extension_loaded('openssl') && ini_get('allow_url_fopen')) {
|
||||||
|
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
|
||||||
|
} else {
|
||||||
|
passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");
|
||||||
|
}
|
||||||
|
$zip = new ZipArchive();
|
||||||
|
$zip->open("$PHPUNIT_VERSION.zip");
|
||||||
|
$zip->extractTo(getcwd());
|
||||||
|
$zip->close();
|
||||||
|
chdir("phpunit-$PHPUNIT_VERSION");
|
||||||
|
passthru("composer remove --no-update symfony/yaml");
|
||||||
|
passthru("composer install --prefer-source --no-progress --ansi");
|
||||||
|
chdir($oldPwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd = array_map('escapeshellarg', $argv);
|
||||||
|
$exit = 0;
|
||||||
|
|
||||||
|
if (isset($argv[1]) && 'symfony' === $argv[1]) {
|
||||||
|
# Find Symfony components in plain php for Windows portability
|
||||||
|
|
||||||
|
$finder = new RecursiveDirectoryIterator('src/Symfony', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
|
||||||
|
$finder = new RecursiveIteratorIterator($finder);
|
||||||
|
$finder->setMaxDepth(3);
|
||||||
|
|
||||||
|
array_shift($cmd);
|
||||||
|
$cmd[0] = "php $PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit --colors=always";
|
||||||
|
$procs = array();
|
||||||
|
|
||||||
|
foreach ($finder as $file => $fileInfo) {
|
||||||
|
if ('phpunit.xml.dist' === $file) {
|
||||||
|
$component = dirname($fileInfo->getPathname());
|
||||||
|
|
||||||
|
# Run phpunit tests in parallel
|
||||||
|
|
||||||
|
$c = escapeshellarg($component);
|
||||||
|
|
||||||
|
if ($proc = proc_open(implode(' ', $cmd)." $c > $c/phpunit.stdout 2> $c/phpunit.stderr", array(), $pipes)) {
|
||||||
|
$procs[$component] = $proc;
|
||||||
|
} else {
|
||||||
|
$exit = 1;
|
||||||
|
echo "\033[41mKO\033[0m $component\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($procs as $component => $proc) {
|
||||||
|
$procStatus = proc_close($proc);
|
||||||
|
|
||||||
|
foreach (array('out', 'err') as $file) {
|
||||||
|
$file = "$component/phpunit.std$file";
|
||||||
|
$h = fopen($file, 'rb');
|
||||||
|
while (false !== $line = fgets($h)) {
|
||||||
|
echo preg_replace_callback(
|
||||||
|
'/\033\[[0-9]++(?:;[0-9]++)++m/',
|
||||||
|
function ($m) {return str_replace(';', "m\033[", $m[0]);},
|
||||||
|
$line
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fclose($h);
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($procStatus) {
|
||||||
|
$exit = 1;
|
||||||
|
echo "\033[41mKO\033[0m $component\n\n";
|
||||||
|
} else {
|
||||||
|
echo "\033[32mOK\033[0m $component\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif (!isset($argv[1]) || 'install' !== $argv[1]) {
|
||||||
|
# Run regular phpunit in a subprocess
|
||||||
|
|
||||||
|
$cmd[0] = "php $PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit --colors=always";
|
||||||
|
|
||||||
|
$errFile = tempnam(sys_get_temp_dir(), 'phpunit.stderr.');
|
||||||
|
if ($proc = proc_open(implode(' ', $cmd).' 2> '.escapeshellarg($errFile), array(1 => array('pipe', 'w')), $pipes)) {
|
||||||
|
while (false !== $line = fgets($pipes[1])) {
|
||||||
|
echo $line;
|
||||||
|
}
|
||||||
|
fclose($pipes[1]);
|
||||||
|
$exit = proc_close($proc);
|
||||||
|
|
||||||
|
$h = fopen($errFile, 'rb');
|
||||||
|
while (false !== $line = fgets($h)) {
|
||||||
|
echo $line;
|
||||||
|
}
|
||||||
|
fclose($h);
|
||||||
|
unlink($errFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($component = array_pop($argv))) {
|
||||||
|
if ($exit) {
|
||||||
|
echo "\033[41mKO\033[0m $component\n\n";
|
||||||
|
} else {
|
||||||
|
echo "\033[32mOK\033[0m $component\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit($exit);
|
Reference in New Issue
Block a user