From f885b9b4655b13bdbfdcc1f489cc917a3972da77 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 3 Mar 2015 11:27:01 +0100 Subject: [PATCH] Test with local components instead of waiting for the subtree-splitter when possible --- .gitignore | 2 ++ .travis.sh | 25 +++++++++++++++++++++++++ .travis.yml | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .travis.sh diff --git a/.gitignore b/.gitignore index fc673fa663..418cb5f976 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ phpunit.xml composer.lock composer.phar autoload.php +package*.tar +packages.json /vendor/ diff --git a/.travis.sh b/.travis.sh new file mode 100644 index 0000000000..9eeecbeeb8 --- /dev/null +++ b/.travis.sh @@ -0,0 +1,25 @@ +branch=$1 +if [ -z "$branch" ]; then + echo 'Usage: branch dir1 dir2 ... dirN' + exit 1 +fi +shift +components=$* +if [ -z "$components" ]; then + echo 'Usage: branch dir1 dir2 ... dirN' + exit 1 +fi +echo '{"packages": {' > packages.json +components=$( + for c in $components; do + sed -i ':a;N;$!ba;s#^{\n\(\s*\)\("name"\)#{\n\1"repositories": \[{ "type": "composer", "url": "file://'$(pwd)'/" }\],\n\1\2#' $c/composer.json + n=$(php -r '$n=json_decode(file_get_contents("'$c'/composer.json"));echo $n->name;') + echo '"'$n'": {"'$branch'.x-dev": ' >> packages.json + cat $c/composer.json >> packages.json + echo '"version": "'$branch.x-dev'",\n "dist": {"type": "tar", "url": "file://'$(pwd)/$c'/package'$branch'.tar"}\n}},' >> packages.json + echo $c + done; +) +sed -i ':a;N;$!ba;s/\n}\n"/,\n "/g' packages.json +sed -i ':a;N;$!ba;s/}},$/\n}}\n}}/' packages.json +echo "$components" | parallel --gnu "cd {}; tar -cf package$branch.tar --exclude='package*.tar' *" diff --git a/.travis.yml b/.travis.yml index 6c70c3c307..06fc091ab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,9 +40,10 @@ before_install: install: - if [ "$deps" = "no" ]; then composer --prefer-source install; fi; + - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + - if [ "$deps" != "no" ]; then sh .travis.sh $TRAVIS_BRANCH $components; fi; script: - - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') - 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 -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi; - if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data,legacy || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;