|
1 |
| -cache: |
2 |
| - apt: true |
| 1 | +# Run in Container-based environment - see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments |
| 2 | +dist: trusty |
| 3 | +sudo: false |
3 | 4 |
|
4 | 5 | language: php
|
5 | 6 |
|
|
13 | 14 | - 7.2
|
14 | 15 | - nightly
|
15 | 16 |
|
16 |
| -matrix: |
17 |
| - fast_finish: true |
| 17 | +before_install: |
| 18 | + # Turn off Xdebug |
| 19 | + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" |
| 20 | + |
| 21 | +install: composer install --no-interaction |
| 22 | + |
| 23 | +stages: |
| 24 | + - lint and code standards |
| 25 | + - test |
| 26 | + |
| 27 | +jobs: |
18 | 28 | include:
|
19 |
| - # Run PHP CodeSniffer and XMLLint against just PHP 7.1 job, even |
20 |
| - # though the PHPCompatibility config checks against 7.0. |
21 |
| - - php: 7.1 |
22 |
| - env: SNIFF=1 LINT=1 |
| 29 | + - stage: lint and code standards |
| 30 | + # Run PHP CodeSniffer and XMLLint against just PHP 7.1 job, even |
| 31 | + # though the PHPCompatibility config checks against 7.0. |
| 32 | + php: 7.1 |
23 | 33 | addons:
|
24 | 34 | apt:
|
25 | 35 | packages:
|
26 |
| - - libxml2-utils |
27 |
| - |
28 |
| - allow_failures: |
29 |
| - # Allow failures for unstable builds |
30 |
| - - php: nightly |
31 |
| - |
32 |
| -before_install: |
33 |
| - - export XMLLINT_INDENT=" " |
34 |
| - |
35 |
| -install: |
36 |
| - - composer install |
| 36 | + - libxml2-utils # Needed for XML linting. |
| 37 | + before_script: |
| 38 | + - export XMLLINT_INDENT=" " |
| 39 | + script: |
| 40 | + # Validate the XML files. |
| 41 | + # @link http://xmlsoft.org/xmllint.html |
| 42 | + - xmllint --noout ./.phpcs.xml.dist |
| 43 | + - xmllint --noout --schema ./vendor/phpunit/phpunit/phpunit.xsd ./phpunit.xml.dist |
37 | 44 |
|
38 |
| -script: |
39 |
| - # Lint the PHP files against parse errors. |
40 |
| - - if [[ "$LINT" == "1" ]]; then if find . -name "*.php" -maxdepth 1 -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi |
41 |
| - - if [[ "$LINT" == "1" ]]; then if find config src tests views -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi |
| 45 | + # Lint the PHP files against parse errors. |
| 46 | + - if find . -path ./vendor -prune -o -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi |
42 | 47 |
|
43 |
| - # Validate the xml file. |
44 |
| - # @link http://xmlsoft.org/xmllint.html |
45 |
| - - if [[ "$LINT" == "1" ]]; then xmllint --noout ./.phpcs.xml.dist; fi |
| 48 | + # Check code standards |
| 49 | + - composer phpcs |
46 | 50 |
|
47 |
| - # Check coding standards. Run through composer script, to allow |
48 |
| - # PHP 5.2 compatibility check of main plugin file. |
49 |
| - - if [[ "$SNIFF" == "1" ]]; then composer phpcs; fi |
| 51 | + - stage: test |
| 52 | +# env: WP_VERSION=latest WP_MULTISITE=1 |
| 53 | +# install: |
| 54 | +# - composer install --no-interaction |
| 55 | +# - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION |
| 56 | + before_script: |
| 57 | + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} |
| 58 | + - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi |
| 59 | + script: |
| 60 | + - vendor/bin/phpunit --testsuite unit |
| 61 | + - vendor/bin/infection |
| 62 | +# - vendor/bin/phpunit --testsuite integration |
50 | 63 |
|
51 |
| - # Run tests. |
52 |
| - - ./vendor/bin/phpunit --testsuite unit |
| 64 | + fast_finish: true |
| 65 | + allow_failures: |
| 66 | + # Allow failures for unstable builds. |
| 67 | + - php: nightly |
53 | 68 |
|
54 |
| - # Run mutation tests. |
55 |
| - - ./vendor/bin/infection |
| 69 | +cache: |
| 70 | + apt: true |
| 71 | + directories: |
| 72 | + - $HOME/.composer/cache |
0 commit comments