Skip to content

Commit e37326f

Browse files
committed
Travis: further tweaks for cleaner output
This commit does a couple of things: 1. It adds a new build against PHP 7.4 which runs just and only the PEAR package file validation and the XML related checks. That build doesn't need to do a `composer install` and, as it has it's own script, will show just the output of those checks. 2. It adds a separate `script` section to the two builds being run with custom PHP `ini` files (and moves those down in the matrix). The end result of this is: * We can get rid of all the conditions in the `script` section. * Builds will show much cleaner output, so it is easier to find out what went wrong. For the "custom builds", the Travis script now has a separate "name" for these, so they can still be easily identified for what they are, without the environment variables (which is what used to show).
1 parent 48d5bae commit e37326f

File tree

1 file changed

+68
-41
lines changed

1 file changed

+68
-41
lines changed

.travis.yml

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,96 @@ language: php
55
jobs:
66
fast_finish: true
77
include:
8+
#############################################
9+
# Builds using the default test script.
10+
#############################################
811
- php: 5.4
912
dist: trusty
1013
- php: 5.5
1114
dist: trusty
12-
- php: 5.5
13-
dist: trusty
14-
env: CUSTOM_INI=1 XMLLINT=1
15-
addons:
16-
apt:
17-
packages:
18-
- libxml2-utils
1915
- php: 5.6
2016
- php: 7.0
21-
- php: 7.0
22-
env: CUSTOM_INI=1 PEAR_VALIDATE=1
2317
- php: 7.1
2418
- php: 7.2
2519
- php: 7.3
2620
- php: 7.4
27-
- php: 7.4
28-
env: PHPSTAN=1
21+
# Nightly is PHP 8.0 since Feb 2019.
22+
- php: nightly
2923
addons:
3024
apt:
3125
packages:
3226
- libonig-dev
27+
28+
#############################################
29+
# Builds which don't use the default test script.
30+
#############################################
31+
# Builds running the basic tests with different PHP ini settings.
32+
- php: 5.5
33+
name: "PHP: 5.5 | Unit tests with custom PHP ini"
34+
dist: trusty
35+
before_script:
36+
- phpenv config-add php5-testingConfig.ini
3337
script:
34-
- composer require --dev phpstan/phpstan
35-
- php vendor/bin/phpstan analyse --configuration=phpstan.neon
38+
- php bin/phpcs --config-set php_path php
39+
- vendor/bin/phpunit tests/AllTests.php
40+
- php: 7.0
41+
name: "PHP: 7.4 | Unit tests with custom PHP ini"
42+
before_script:
43+
- phpenv config-add php7-testingConfig.ini
44+
script:
45+
- php bin/phpcs --config-set php_path php
46+
- vendor/bin/phpunit tests/AllTests.php
3647

37-
# Nightly is PHP 8.0 since Feb 2019.
38-
- php: nightly
48+
# Build running just the PEAR package file and XML file validation and code style check.
49+
- php: 7.4
50+
name: "PHP: 7.4 | Pear + XML validate"
51+
addons:
52+
apt:
53+
packages:
54+
- libxml2-utils
55+
before_install:
56+
- export XMLLINT_INDENT=" "
57+
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
58+
install:
59+
- curl -O https://www.w3.org/2012/04/XMLSchema.xsd
60+
script:
61+
# Validate the Pear Package file contents.
62+
- php scripts/validate-pear-package.php
63+
# Validate the xml ruleset files.
64+
# @link http://xmlsoft.org/xmllint.html
65+
- xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml
66+
- xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd
67+
# Check the code-style consistency of the xml files.
68+
- diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist")
69+
- diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml")
70+
- diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml")
71+
- diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml")
72+
- diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml")
73+
- diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml")
74+
- diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml")
75+
- diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml")
76+
- diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml")
77+
78+
# Build running just and only PHPStan.
79+
- php: 7.4
80+
name: "PHP: 7.4 | PHPStan"
81+
env: PHPSTAN=1
3982
addons:
4083
apt:
4184
packages:
4285
- libonig-dev
86+
before_install:
87+
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
88+
script:
89+
- composer require --dev phpstan/phpstan
90+
- php vendor/bin/phpstan analyse --configuration=phpstan.neon
4391

4492
allow_failures:
4593
- php: 7.4
4694
env: PHPSTAN=1
4795
- php: nightly
4896

4997
before_install:
50-
- export XMLLINT_INDENT=" "
5198
# Speed up build time by disabling Xdebug when its not needed.
5299
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
53100
# PHPUnit 8.x is not (yet) supported, so prevent issues with Travis images using it.
@@ -59,31 +106,11 @@ before_install:
59106
composer install --ignore-platform-reqs
60107
fi
61108
62-
before_script:
63-
- if [[ $CUSTOM_INI == "1" && ${TRAVIS_PHP_VERSION:0:1} == "5" ]]; then phpenv config-add php5-testingConfig.ini; fi
64-
- if [[ $CUSTOM_INI == "1" ]] && [[ ${TRAVIS_PHP_VERSION:0:1} == "7" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpenv config-add php7-testingConfig.ini; fi
65-
66109
script:
67110
- php bin/phpcs --config-set php_path php
68111
- vendor/bin/phpunit tests/AllTests.php
69-
- if [[ $CUSTOM_INI != "1" ]]; then php bin/phpcs --no-cache --parallel=1; fi
70-
- if [[ $CUSTOM_INI != "1" && $TRAVIS_PHP_VERSION != "nightly" ]]; then pear package-validate package.xml; fi
71-
- if [[ $PEAR_VALIDATE == "1" ]]; then php scripts/validate-pear-package.php; fi
72-
- if [[ $CUSTOM_INI != "1" ]]; then composer validate --no-check-all --strict; fi
73-
- if [[ $CUSTOM_INI != "1" ]]; then php scripts/build-phar.php; fi
74-
- if [[ $CUSTOM_INI != "1" ]]; then php phpcs.phar; fi
75-
# Validate the xml ruleset files.
76-
# @link http://xmlsoft.org/xmllint.html
77-
- if [[ $XMLLINT == "1" ]]; then xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml; fi
78-
- if [[ $XMLLINT == "1" ]]; then curl -O https://www.w3.org/2012/04/XMLSchema.xsd; fi
79-
- if [[ $XMLLINT == "1" ]]; then xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd; fi
80-
# Check the code-style consistency of the xml files.
81-
- if [[ $XMLLINT == "1" ]]; then diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist"); fi
82-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml"); fi
83-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml"); fi
84-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml"); fi
85-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml"); fi
86-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml"); fi
87-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml"); fi
88-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml"); fi
89-
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml"); fi
112+
- php bin/phpcs --no-cache --parallel=1
113+
- pear package-validate package.xml
114+
- composer validate --no-check-all --strict
115+
- php scripts/build-phar.php
116+
- php phpcs.phar

0 commit comments

Comments
 (0)