Make WordPress Core

Changeset 46290 for trunk/.travis.yml

09/25/2019 01:46:55 PM (5 years ago)

Build/Test Tools: Introduce automated PHP compatibility checking.

This change introduces a new Composer script, compat that will scan the codebase for (detectable) potential PHP compatibility issues using the PHP_CodeSniffer and a custom ruleset based off of the PHPCompayibilityWP ruleset (phpcompat.xml.dist).

The command will be run as a separate job within each Travis build. While many compatibility issues and false positives have already been corrected in this commit and other Trac tickets, there are still some remaining. For that reason, the job is allowed to fail while the remainder of the potential compatibility issues are investigated and addressed. After those are resolved, the job should be set as required to pass to help prevent new compatibility issues from being introduced.

Props desrosj, jrf, all PHPCompatibilityWP and PHPCompatibility contributors.
Fixes #46152.

1 edited


  • trunk/.travis.yml

    r46114 r46290  
    3030  - env: WP_TRAVISCI=travis:js WP_INSTALL=false
    3131    name: JS Tests
     32  - env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
     33    name: "PHP Compatibility Check"
    3234  - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
    3335    name: "PHPUnit Tests: PHP 7.3"
    4749    name: "PHPUnit Tests: PHP 8.0"
    4850  allow_failures:
     51  - env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
    4952  - env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
    5053  - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
    121124      docker-compose run --rm php composer lint:errors &&
    122125      docker-compose run --rm php composer lint tests
     126    elif [[ "$WP_TRAVISCI" == "test:compat" ]]; then
     127      docker-compose run --rm php composer compat
    123128    else
    124129      npm run grunt $WP_TRAVISCI
Note: See TracChangeset for help on using the changeset viewer.