Skip to content

Commit b6496ed

Browse files
minor symfony#41328 Improve .travis.yml (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- Improve .travis.yml | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Follow up of symfony#41293 - For the highest branch (6.0 right now), when deps=high, the version before it is checked out (5.4) and tested with the locally patched components (6.0) - For `*.4` branches, aka when the current branch version has not the same major version number as the next one, in addition to testing with the next major as deps (6.0 deps on patched-5.4), we also checkout the previous major and test it with the locally patched components (aka patched-5.4 deps on 4.4). Commits ------- 2620da2 Improve .travis.yml
2 parents e955a1e + 2620da2 commit b6496ed

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

.travis.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ before_install:
5050
set -e
5151
stty cols 120
5252
cp .github/composer-config.json "$(composer config home)/config.json"
53+
git config --global user.email ""
54+
git config --global user.name "Symfony"
5355
export PHPUNIT=$(readlink -f ./phpunit)
5456
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
5557
export COMPOSER_UP='composer update --no-progress --ansi'
5658
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
57-
export SYMFONY_DEPRECATIONS_HELPER=max[indirect]=170
5859
export SYMFONY_FEATURE_BRANCH=$(curl -s https://flex.symfony.com/versions.json | jq -r '."dev-name"')
60+
export SYMFONY_VERSIONS=$(git ls-remote -q --heads | cut -f2 | grep -o '/[1-9][0-9]*\.[0-9].*' | sort -V)
5961
6062
nanoseconds () {
6163
local cmd="date"
@@ -180,11 +182,6 @@ install:
180182
181183
- |
182184
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
183-
git config --global user.email ""
184-
git config --global user.name "Symfony"
185-
186-
SYMFONY_VERSIONS=$(git ls-remote -q --heads);
187-
188185
if [[ ! $deps ]]; then
189186
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
190187
else
@@ -201,18 +198,18 @@ install:
201198
fi
202199
203200
- |
204-
# For the feature-branch, when deps=high, the version before it is checked out and tested with the locally patched components
205-
if [[ $deps = high && $TRAVIS_BRANCH = $SYMFONY_FEATURE_BRANCH ]]; then
201+
# For the highest branch, when deps=high, the version before it is checked out and tested with the locally patched components
202+
if [[ $deps = high && $SYMFONY_VERSION = $(echo "$SYMFONY_VERSIONS" | tail -n 1 | sed s/.//) ]]; then
206203
export FLIP='^'
207-
export SYMFONY_VERSION=$(echo "$SYMFONY_VERSIONS" | grep -o '/[1-9]\.[0-9].*' | tail -n 1 | sed s/.//) &&
204+
export SYMFONY_VERSION=$(echo "$SYMFONY_VERSIONS" | grep -FB1 /$SYMFONY_VERSION | head -n 1 | sed s/.//) &&
208205
git fetch --depth=2 origin $SYMFONY_VERSION &&
209206
git checkout -m FETCH_HEAD &&
210207
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
211208
fi
212209
213210
- |
214211
# Skip the phpunit-bridge on bugfix-branches when $deps is empty
215-
if [[ ! $deps && ! $TRAVIS_BRANCH = $SYMFONY_FEATURE_BRANCH ]]; then
212+
if [[ ! $deps && $SYMFONY_VERSION != $SYMFONY_FEATURE_BRANCH ]]; then
216213
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
217214
fi
218215
@@ -227,7 +224,7 @@ install:
227224
228225
- |
229226
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
230-
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(echo "$SYMFONY_VERSIONS" | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
227+
[[ $deps = high && $SYMFONY_VERSION = *.4 ]] && export LEGACY=,legacy
231228
232229
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
233230
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
@@ -264,7 +261,7 @@ install:
264261
(cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json)
265262
COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
266263
267-
if [[ $COMPONENTS && $LEGACY && ! $TRAVIS_BRANCH = $SYMFONY_FEATURE_BRANCH && $TRAVIS_PULL_REQUEST != false && $(echo "$SYMFONY_VERSIONS" | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1) = $SYMFONY_FEATURE_BRANCH ]]; then
264+
if [[ $COMPONENTS && $SYMFONY_VERSION = *.4 && $TRAVIS_PULL_REQUEST != false ]]; then
268265
export FLIP='^'
269266
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
270267
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"

0 commit comments

Comments
 (0)