# Travis CI (MIT License) configuration file for WP Updates Notifier Plugin # @link https://travis-ci.org/ # Xenial image has PHP versions 5.6,7.1,7.2 pre-installed dist: xenial # Xenial does not start mysql or memcached by default services: - mysql - memcached # Declare project language. # @link http://about.travis-ci.org/docs/user/languages/php/ language: php # Specify when Travis should build. branches: only: - master cache: directories: - $HOME/.composer/cache matrix: fast_finish: true include: - php: 7.3 env: WP_VERSION=latest PHP_LINT=1 WP_PHPCS=1 - php: 7.2 env: WP_VERSION=latest PHP_LINT=1 - php: 7.1 env: WP_VERSION=latest PHP_LINT=1 - php: 7.0 env: WP_VERSION=latest PHP_LINT=1 - php: 5.6 env: WP_VERSION=latest PHP_LINT=1 - php: 7.3 env: WP_VERSION=nightly # Use this to prepare your build for testing. # e.g. copy database configurations, environment variables, etc. # Failures in this section will result in build status 'errored'. before_script: # Turn off Xdebug. See https://core.trac.wordpress.org/changeset/40138. - phpenv config-rm xdebug.ini || echo "Xdebug not available" # This path addition is needed for phpcs. - export PATH="$HOME/.composer/vendor/bin:$PATH" # Couple the PHPUnit version to the PHP version. - | case "$TRAVIS_PHP_VERSION" in 7.*) echo "Using PHPUnit 6.1" composer global require "phpunit/phpunit=6.1.*" ;; *) echo "Using PHPUnit 4.8" composer global require "phpunit/phpunit=4.8.*" ;; esac # # Set up WordPress installation. - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION # Set up phpcs. - | if [[ "$WP_PHPCS" == "1" ]] ; then composer global require automattic/vipwpcs phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs phpcs --config-show fi # Run test script commands. # Default is specific to project language. # All commands must exit with code 0 on success. Anything else is considered failure. script: # Search for PHP syntax errors. # # Only need to run this once per PHP version. - | if [[ "$PHP_LINT" == "1" ]] ; then find . -type "f" -iname "*.php" -not -path "./vendor/*" | xargs -L "1" php -l fi # # WordPress Coding Standards. # # These are the same across PHP and WordPress, so we need to run them only once. # # @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards # @link http://pear.php.net/package/PHP_CodeSniffer/ - | if [[ "$WP_PHPCS" == "1" ]] ; then phpcs fi # Run phpunit and phpunit multi-site. - | if [[ ! -z "$WP_VERSION" ]] ; then phpunit WP_MULTISITE=1 phpunit fi # Receive notifications for build results. # @link http://docs.travis-ci.com/user/notifications/#Email-notifications notifications: email: false