Wordpress/.travis.yml
John Blackbourn 06391f0872 Build/Test Tools: Add Composer files to the cache on Travis.
The Travis cache is specific to the branch and language version (PHP version), so this should speed up each subsequent build once the cache is primed.

Props netweb

Fixes #40539


git-svn-id: https://develop.svn.wordpress.org/trunk@40538 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 11:39:43 +00:00

126 lines
3.5 KiB
YAML

sudo: false
language: php
cache:
apt: true
directories:
- node_modules
- vendor
- $HOME/.composer/cache
env:
global:
- WP_TRAVISCI=travis:phpunit
matrix:
include:
- php: 7.1
env: WP_TRAVISCI=travis:js
- php: 7.1
- php: 7.0
- php: 5.6
- php: 5.6
env: WP_TRAVIS_OBJECT_CACHE=true
services: memcached
- php: 5.5
- php: 5.4
- php: 5.3
- php: 5.2
- php: hhvm
sudo: required
dist: trusty
group: edge
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- php: nightly
allow_failures:
- php: hhvm
- php: nightly
before_install:
- |
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
mysql -u root -e "CREATE DATABASE wordpress_tests;"
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere//" wp-tests-config.php
svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
fi
- |
if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
curl https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/584392b56dc4adbe52bd2c7b86f875e23a3e5f75/object-cache.php > src/wp-content/object-cache.php
echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
fi
before_script:
- |
# Remove Xdebug for a huge performance increase, but not from nightly or hhvm:
stable='^[0-9\.]+$'
if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
phpenv config-rm xdebug.ini
fi
- |
# Export Composer's global bin dir to PATH, but not on PHP 5.2:
if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
composer config --list --global
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
fi
- |
# Install the specified version of PHPUnit depending on the PHP version:
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
case "$TRAVIS_PHP_VERSION" in
7.1|7.0|nightly)
echo "Using PHPUnit 6.1"
composer global require "phpunit/phpunit=6.1.*"
;;
hhvm)
echo "Using PHPUnit 5.7"
composer global require "phpunit/phpunit=5.7.*"
;;
5.6|5.5|5.4|5.3)
echo "Using PHPUnit 4.8"
composer global require "phpunit/phpunit=4.8.*"
;;
5.2)
# Do nothing, use default PHPUnit 3.6.x
echo "Using default PHPUnit, hopefully 3.6"
;;
*)
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
exit 1
;;
esac
fi
- npm --version
- node --version
- nvm install 6.9.1
- npm install -g grunt-cli
- npm install
- npm prune
- mysql --version
- phpenv versions
- php --version
- |
# Debug PHP extensions, but not on HHVM because the command hangs indefinitely:
if [[ "$TRAVIS_PHP_VERSION" != 'hhvm' ]]; then
php -m
fi
- npm --version
- node --version
- which phpunit
- phpunit --version
- curl --version
- grunt --version
- git --version
- svn --version
- locale -a
script: grunt $WP_TRAVISCI
notifications:
slack:
rooms:
secure: WuMCpfgrm0GIdPbYzsGOsakZ5x7QIbEBwD+CPHVXGKbL3ZbqQ+BVcDRnMiwzxjgf1vzg2de0taXCSMGKBxsWce23NZkOnmwPdIB8XOnwDV7T7zylgYD5S7p3gI6gV0l8Y3/gROdXFZap6viC1qRr4E79ow53RKk7E3WyOo7TWqo=
on_start: never
on_failure: always
on_success: change
on_pull_requests: false