wordpress/.travis.yml
Jonathan Desrosiers 775bc55989 Build/Test Tools: Explicitly specify a version number in the .nvmrc file for the 5.1 branch.
This restores the ability to run NodeJS related tasks when using `nvm install` or `nvm use`.

The alias `lts/*` currently resolves to NodeJS 12.x (and will continue to change as newer versions are released). The 10.x version of NodeJS is the highest version supported in the 5.1 branch.

This also removes the explicit version when running `nvm install` during automated testing. The command will now fall back to the version in the `.nvmrc` file.

See #51603.

git-svn-id: https://develop.svn.wordpress.org/branches/5.1@49278 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-22 16:16:07 +00:00

128 lines
4.1 KiB
YAML

sudo: false
dist: trusty
language: php
cache:
apt: true
directories:
- $HOME/.npm
- vendor
- $HOME/.composer/cache
env:
global:
- WP_TRAVISCI=travis:phpunit
matrix:
include:
- php: 7.2
env: WP_TRAVISCI=travis:format
- php: 7.1
env: WP_TRAVISCI=travis:js
- php: 7.3
- php: 7.0
env: WP_TEST_REPORTER=true
- php: 5.6
env: WP_TRAVIS_OBJECT_CACHE=true
services: memcached
- php: 5.2
dist: precise
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
travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
fi
- |
if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
cp tests/phpunit/includes/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:
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
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.3|7.2|7.1)
echo "Using PHPUnit 7.x"
travis_retry composer global require "phpunit/phpunit:^7"
;;
7.0)
echo "Using PHPUnit 6.x"
travis_retry composer global require "phpunit/phpunit:^6"
;;
5.6|5.5|5.4|5.3)
echo "Using PHPUnit 4.x"
travis_retry composer global require "phpunit/phpunit:^4"
;;
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
- |
# We only need to run composer install on the code formatting job.
if [[ "$WP_TRAVISCI" == "travis:format" ]]; then
composer --version
travis_retry composer install
fi
- npm --version
- node --version
- nvm install
- npm install -g grunt-cli
- npm install
- npm prune
- mysql --version
- phpenv versions
- php --version
- php -m
- npm --version
- node --version
- |
# Display PHPUnit information (for PHP tests only).
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
which phpunit
phpunit --version
fi
- curl --version
- grunt --version
- git --version
- svn --version
- locale -a
script: grunt $WP_TRAVISCI
after_script:
- |
if [[ "$WP_TEST_REPORTER" == "true" ]]; then
git clone https://github.com/WordPress/phpunit-test-runner.git test-runner
export WPT_PREPARE_DIR=$(pwd)
export WPT_TEST_DIR=$(pwd)
php test-runner/report.php
fi
notifications:
slack:
rooms:
secure: PO3x/bhYXNFqAMtzDzpOAnHcg2KzG2gGbBDft1HlqN4O8hRJqrRs7hqsEe9wKZUs6qf9Jv0ZleJ5AmcSd0DbDAFsfqeWtnWpsj8NqOIWgLX0C2idvfNRzCX1mUd6E1hlAjjTGnKn4MV3m1dRurwcDqacSBVtbXKQ+yPSgM3eXYkDz8EFbTsMcda8pFskcXr98E7/YomU0QtgOcjXndxGZ53zUQ1rfaDwUJzGY3bn5nLoweVZsSIeEFSiNcip7Kt22zVlU0SAb6QlBf3F0h9IWoRD59BQ7pkl53FWzpXoHzUYOFmn0jB5y1vHMlHvTDVEmDuumpCEqnxVvLh33AwGtqYRWH36PEfTn/u1YTFr7FS7KbwrKw9Nn+jUZe3KFrVzgQNUt0El33mO0FbSoNEWJhxRarp0D1z3/HVsbon3Fwzt/3jBHGf9nI+tHH4u7KQ70+M7pzBsV7F7Lc60YnuKrcy/hkwObGB0Za9tMHPUw3c7b4ep6nSa4ts9S++IijLWDaNAq7K/j7fAfI1JrkPIw4T6PcGpNAADkmlCrvToKE4axExaJke/lkUb+3Pwdj0h7ePzPSrHT8aASlKFM1PuI1KRMn/J4wRLtGeLlfYXvVlaQYmJobJtYgoiNWJWMIybLGVBSVPohdGO3qIJbl8WNPN1cW2ZZTcEBprLe8y7MSo=
on_start: never
on_failure: always
on_success: change
on_pull_requests: false