|
| 1 | +dist: trusty |
| 2 | + |
| 3 | +language: php |
| 4 | + |
| 5 | +## Cache composer and apt downloads. |
| 6 | +cache: |
| 7 | + apt: true |
| 8 | + directories: |
| 9 | + # Cache directory for older Composer versions. |
| 10 | + - $HOME/.composer/cache/files |
| 11 | + # Cache directory for more recent Composer versions. |
| 12 | + - $HOME/.cache/composer/files |
| 13 | + |
| 14 | +php: |
| 15 | + - 5.4 |
| 16 | + - 7.4 |
| 17 | + - "nightly" |
| 18 | + |
| 19 | +# Define the stages used. |
| 20 | +stages: |
| 21 | + - name: sniff |
| 22 | + - name: test |
| 23 | + |
| 24 | +jobs: |
| 25 | + fast_finish: true |
| 26 | + |
| 27 | + include: |
| 28 | + #### SNIFF STAGE #### |
| 29 | + - stage: sniff |
| 30 | + php: 7.4 |
| 31 | + addons: |
| 32 | + apt: |
| 33 | + packages: |
| 34 | + - libxml2-utils |
| 35 | + script: |
| 36 | + # Validate the composer.json file. |
| 37 | + # @link https://getcomposer.org/doc/03-cli.md#validate |
| 38 | + - composer validate --no-check-all --strict |
| 39 | + |
| 40 | + # Validate the xml files. |
| 41 | + # @link http://xmlsoft.org/xmllint.html |
| 42 | + - xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./Security/ruleset.xml |
| 43 | + - xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./example_base_ruleset.xml |
| 44 | + - xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./example_drupal7_ruleset.xml |
| 45 | + |
| 46 | + # Check the code-style consistency of the xml files. |
| 47 | + - diff -B ./Security/ruleset.xml <(xmllint --format "./Security/ruleset.xml") |
| 48 | + - diff -B ./example_base_ruleset.xml <(xmllint --format "./example_base_ruleset.xml") |
| 49 | + - diff -B ./example_drupal7_ruleset.xml <(xmllint --format "./example_drupal7_ruleset.xml") |
| 50 | + |
| 51 | + allow_failures: |
| 52 | + # Allow failures for unstable builds. |
| 53 | + - php: "nightly" |
| 54 | + |
| 55 | +before_install: |
| 56 | + # Speed up build time by disabling Xdebug when its not needed. |
| 57 | + - phpenv config-rm xdebug.ini || echo 'No xdebug config.' |
| 58 | + |
| 59 | + - export XMLLINT_INDENT=" " |
| 60 | + |
| 61 | + # --prefer-dist will allow for optimal use of the travis caching ability. |
| 62 | + - composer install --prefer-dist --no-suggest |
| 63 | + |
| 64 | +script: |
| 65 | + # Lint PHP files against parse errors. |
| 66 | + - composer lint |
0 commit comments