forked from squizlabs/PHP_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
61 lines (56 loc) · 3.05 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
sudo: false
language: php
dist: trusty
matrix:
fast_finish: true
include:
- php: 5.4
- php: 5.5
- php: 5.5
env: CUSTOM_INI=1 XMLLINT=1
addons:
apt:
packages:
- libxml2-utils
- php: 5.6
- php: 7.0
- php: 7.0
env: CUSTOM_INI=1 PEAR_VALIDATE=1
- php: 7.1
- php: 7.2
- php: 7.3
- php: nightly
env: PHPSTAN=1
allow_failures:
- php: nightly
before_install:
- export XMLLINT_INDENT=" "
# Speed up build time by disabling Xdebug when its not needed.
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
before_script:
- if [[ $CUSTOM_INI == "1" && ${TRAVIS_PHP_VERSION:0:1} == "5" ]]; then phpenv config-add php5-testingConfig.ini; fi
- if [[ $CUSTOM_INI == "1" ]] && [[ ${TRAVIS_PHP_VERSION:0:1} == "7" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpenv config-add php7-testingConfig.ini; fi
script:
- php bin/phpcs --config-set php_path php
- phpunit tests/AllTests.php
- if [[ $CUSTOM_INI != "1" ]]; then php bin/phpcs --no-cache --parallel=1; fi
- if [[ $CUSTOM_INI != "1" && $TRAVIS_PHP_VERSION != "nightly" ]]; then pear package-validate package.xml; fi
- if [[ $PEAR_VALIDATE == "1" ]]; then php scripts/validate-pear-package.php; fi
- if [[ $CUSTOM_INI != "1" ]]; then composer validate --no-check-all --strict; fi
- if [[ $CUSTOM_INI != "1" ]]; then php scripts/build-phar.php; fi
- if [[ $CUSTOM_INI != "1" ]]; then php phpcs.phar; fi
# Validate the xml ruleset files.
# @link http://xmlsoft.org/xmllint.html
- if [[ $XMLLINT == "1" ]]; then xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml; fi
# Check the code-style consistency of the xml files.
- if [[ $XMLLINT == "1" ]]; then diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml"); fi
- if [[ $XMLLINT == "1" ]]; then diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml"); fi
# Run PHPStan
- if [[ $PHPSTAN == "1" ]]; then composer require --dev phpstan/phpstan && php vendor/bin/phpstan analyse src --level=0 --configuration=phpstan.neon --autoload-file=tests/bootstrap.php; fi