Skip to content

Commit cb3024e

Browse files
authored
Merge pull request #47 from PHPCSStandards/feature/update-travis-env_
Travis: various updates
2 parents 8072d01 + 361b04e commit cb3024e

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

.travis.yml

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
dist: trusty
2-
1+
os: linux
32
language: php
43

54
## Cache composer and apt downloads.
@@ -11,10 +10,8 @@ cache:
1110
# Cache directory for more recent Composer versions.
1211
- $HOME/.cache/composer/files
1312

14-
# Note: PHP 7.3, 7.4 and nightly are added via "jobs".
13+
# Note: PHP 5.4, 5.5, 7.3, 7.4 and nightly are added via "jobs".
1514
php:
16-
- 5.4
17-
- 5.5
1815
- 5.6
1916
- 7.0
2017
- 7.1
@@ -44,11 +41,21 @@ jobs:
4441
#### SNIFF STAGE ####
4542
- stage: sniff
4643
php: 7.4
47-
env: PHPCS_VERSION="dev-master"
4844
addons:
4945
apt:
5046
packages:
5147
- libxml2-utils
48+
49+
before_install:
50+
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
51+
- export XMLLINT_INDENT=" "
52+
# Set up CS check.
53+
# - Using PHPCS `master` as an early detection system for bugs upstream.
54+
# - The sniff stage doesn't run the unit tests, so no need for PHPUnit.
55+
- travis_retry composer remove --dev phpunit/phpunit --no-update --no-scripts
56+
- travis_retry composer require --no-update squizlabs/php_codesniffer:"dev-master"
57+
- travis_retry composer install --no-interaction
58+
5259
script:
5360
# Check the code style of the code base.
5461
- composer check-cs
@@ -70,15 +77,14 @@ jobs:
7077
- stage: quicktest
7178
php: 7.4
7279
env: PHPCS_VERSION="dev-master" LINT=1
73-
- stage: quicktest
74-
php: 7.2
80+
- php: 7.2
7581
env: PHPCS_VERSION="3.1.0"
7682

77-
- stage: quicktest
78-
php: 5.4
83+
- php: 5.4
84+
dist: trusty
7985
env: PHPCS_VERSION="dev-master" LINT=1
80-
- stage: quicktest
81-
php: 5.4
86+
- php: 5.4
87+
dist: trusty
8288
env: PHPCS_VERSION="3.1.0"
8389

8490
#### TEST STAGE ####
@@ -95,9 +101,22 @@ jobs:
95101
- php: 7.4
96102
env: PHPCS_VERSION="3.5.0"
97103

104+
# PHP 5.4/5.5 need trusty.
105+
- php: 5.5
106+
dist: trusty
107+
env: PHPCS_VERSION="dev-master" LINT=1
108+
- php: 5.5
109+
dist: trusty
110+
env: PHPCS_VERSION="3.1.0"
111+
- php: 5.4
112+
dist: trusty
113+
env: PHPCS_VERSION="dev-master" LINT=1
114+
- php: 5.4
115+
dist: trusty
116+
env: PHPCS_VERSION="3.1.0"
117+
98118
# Builds against unstable versions which are allowed to fail for now.
99-
- stage: test
100-
php: 7.4
119+
- php: 7.4
101120
env: PHPCS_VERSION="4.0.x-dev"
102121
- php: "nightly"
103122
env: PHPCS_VERSION="dev-master" LINT=1
@@ -115,36 +134,23 @@ before_install:
115134
# On stable PHPCS versions, allow for PHP deprecation notices.
116135
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
117136
- |
118-
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "4.0.x-dev" ]]; then
137+
if [[ "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "4.0.x-dev" ]]; then
119138
echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
120139
fi
121140
122-
- export XMLLINT_INDENT=" "
123-
124141
# Set up test environment using Composer.
125-
- |
126-
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" ]]; then
127-
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
128-
composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-scripts
129-
fi
130-
- |
131-
if [[ $PHPCS_VERSION != "n/a" ]]; then
132-
composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION}
133-
fi
134-
- |
135-
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" ]]; then
136-
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
137-
composer remove --dev phpunit/phpunit --no-update --no-scripts
138-
fi
142+
- travis_retry composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION}
143+
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
144+
- travis_retry composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-scripts
139145

140146
# --prefer-dist will allow for optimal use of the travis caching ability.
141147
# The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS.
142148
- |
143149
if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
144150
# Not all dependencies allow for installing on nightly yet, so ignore platform requirements.
145-
composer install --prefer-dist --no-suggest --ignore-platform-reqs
151+
travis_retry composer install --prefer-dist --no-suggest --ignore-platform-reqs
146152
else
147-
composer install --prefer-dist --no-suggest
153+
travis_retry composer install --prefer-dist --no-suggest
148154
fi
149155
150156
@@ -158,4 +164,4 @@ script:
158164
- if [[ "$LINT" == "1" ]]; then composer check-complete; fi
159165

160166
# Run the unit tests.
161-
- if [[ $PHPCS_VERSION != "n/a" ]]; then composer run-tests; fi
167+
- composer run-tests

0 commit comments

Comments
 (0)