Skip to content

Commit 8e71e5d

Browse files
committed
Travis: add testing against PHPCS 4.x and other tweaks
* Run the sniff build against PHP 7.4. * Add a new build on PHP 7.4 to test against PHPCS 4.x. * Enable running the unit tests on PHP nightly (8.0). * Tweak the installation conditions to allow the builds to run & potentially pass.
1 parent 6f93f11 commit 8e71e5d

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.travis.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cache:
1111
# Cache directory for more recent Composer versions.
1212
- $HOME/.cache/composer/files
1313

14+
# Note: PHP 7.3, 7.4 and nightly are added via "jobs".
1415
php:
1516
- 5.4
1617
- 5.5
@@ -42,7 +43,7 @@ jobs:
4243
include:
4344
#### SNIFF STAGE ####
4445
- stage: sniff
45-
php: 7.3
46+
php: 7.4
4647
env: PHPCS_VERSION="dev-master"
4748
addons:
4849
apt:
@@ -67,7 +68,7 @@ jobs:
6768
# This is a much quicker test which only runs the unit tests and linting against the low/high
6869
# supported PHP/PHPCS combinations.
6970
- stage: quicktest
70-
php: 7.3
71+
php: 7.4
7172
env: PHPCS_VERSION="dev-master" LINT=1
7273
- stage: quicktest
7374
php: 7.2
@@ -93,12 +94,18 @@ jobs:
9394
# PHPCS is only compatible with PHP 7.4 as of version 3.5.0.
9495
- php: 7.4
9596
env: PHPCS_VERSION="3.5.0"
97+
98+
# Builds against unstable versions which are allowed to fail for now.
99+
- stage: test
100+
php: 7.4
101+
env: PHPCS_VERSION="4.0.x-dev"
96102
- php: "nightly"
97-
env: PHPCS_VERSION="n/a" LINT=1
103+
env: PHPCS_VERSION="dev-master" LINT=1
98104

99105
allow_failures:
100106
# Allow failures for unstable builds.
101107
- php: "nightly"
108+
- env: PHPCS_VERSION="4.0.x-dev"
102109

103110

104111
before_install:
@@ -108,7 +115,7 @@ before_install:
108115
# On stable PHPCS versions, allow for PHP deprecation notices.
109116
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
110117
- |
111-
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "n/a" ]]; then
118+
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "4.0.x-dev" ]]; then
112119
echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
113120
fi
114121
@@ -125,7 +132,7 @@ before_install:
125132
composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION}
126133
fi
127134
- |
128-
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" || $PHPCS_VERSION == "n/a" ]]; then
135+
if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" ]]; then
129136
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
130137
composer remove --dev phpunit/phpunit --no-update --no-scripts
131138
elif [[ "$PHPCS_VERSION" < "3.1.0" ]]; then
@@ -138,7 +145,16 @@ before_install:
138145
139146
# --prefer-dist will allow for optimal use of the travis caching ability.
140147
# The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS.
141-
- composer install --prefer-dist --no-suggest
148+
- |
149+
if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
150+
# Not all dependencies allow for installing on nightly yet, so ignore platform requirements.
151+
composer install --prefer-dist --no-suggest --ignore-platform-reqs
152+
elif [[ "$PHPCS_VERSION" == "4.0.x-dev" ]]; then
153+
# PHPCS 4.x does not ship by default with the base test case, so source is needed.
154+
composer install --prefer-source --no-suggest
155+
else
156+
composer install --prefer-dist --no-suggest
157+
fi
142158
143159
144160
script:

0 commit comments

Comments
 (0)