From d7fbb0a4a4cdbc4d7303e7a5486c1e2e7c01ddba Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 21 Sep 2019 09:26:15 +0200 Subject: [PATCH 1/2] [travis] honor .gitattributes when building local packages --- .github/build-packages.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/build-packages.php b/.github/build-packages.php index 5e9bcc1415..1f59c35276 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -17,6 +17,7 @@ $mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($di $packages = array(); $flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; +$preferredInstall = json_decode(file_get_contents(__DIR__.'/composer-config.json'), true)['config']['preferred-install']; foreach ($dirs as $k => $dir) { if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) { @@ -42,7 +43,12 @@ foreach ($dirs as $k => $dir) { $json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1); file_put_contents($dir.'/composer.json', $json); } - passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *"); + + if (isset($preferredInstall[$package->name]) && 'source' === $preferredInstall[$package->name]) { + passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *"); + } else { + passthru("cd $dir && git init && git add . && git commit -m - && git archive -o package.tar HEAD && rm .git/ -Rf"); + } if (!isset($package->extra->{'branch-alias'}->{'dev-master'})) { echo "Missing \"dev-master\" branch-alias in composer.json extra.\n"; From 68f6aef81e3d42f1413beaaf8a132be9fb7f3e70 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 21 Sep 2019 09:43:36 +0200 Subject: [PATCH 2/2] [travis] fix testing flipped versions --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b970267d1f..21beb54869 100644 --- a/.travis.yml +++ b/.travis.yml @@ -272,15 +272,16 @@ install: if [[ $COMPONENTS && $LEGACY && $TRAVIS_PULL_REQUEST != false ]]; then export FLIP='🙃' - COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | sort) SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}') + echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m" export SYMFONY_REQUIRE=">=$SYMFONY_VERSION" export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev - echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m" git fetch --depth=2 origin $SYMFONY_VERSION git checkout -m FETCH_HEAD + COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort) (cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb) - echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1 + [[ ! $COMPONENTS ]] || tfold 'phpunit install' SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 ./phpunit install + [[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1 fi [[ ! $X ]] || (exit 1)