Wordpress/.travis.yml

154 lines
5.5 KiB
YAML

language: php
services:
- docker
- mysql
addons:
apt:
packages:
- docker-ce
cache:
apt: true
directories:
- $HOME/.npm
- vendor
- $HOME/.composer/cache
env:
global:
- LOCAL_DIR: build
matrix:
include:
- env: WP_TRAVISCI=test:e2e
name: E2E Tests
- env: WP_TRAVISCI=travis:phpcs
name: PHP Linting
- env: WP_TRAVISCI=travis:js
name: JS Tests
- env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.3"
- env: LOCAL_PHP=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.3 with Memcached"
- env: LOCAL_PHP=7.2-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.2"
- env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.1"
- env: LOCAL_PHP=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.0"
- env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 5.6"
- env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 7.4"
- env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
name: "PHPUnit Tests: PHP 8.0"
allow_failures:
- env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
- env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
fast_finish: true
before_install:
- |
if [[ "$WP_TRAVISCI" == "test:php" ]]; then
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_develop_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere/password/" wp-tests-config.php
sed -i "s/localhost/mysql/" wp-tests-config.php
echo "define( 'FS_METHOD', 'direct' );" >> 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
- |
sudo rm /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
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:
composer config --list --global
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
- |
# Install PHPUnit for the tests that don't run in Docker.
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
echo "Using PHPUnit 7.x"
travis_retry composer global require "phpunit/phpunit:^7"
fi
- |
# We only need to run composer install on the PHP coding standards job.
if [[ "$WP_TRAVISCI" == "travis:phpcs" ]]; then
composer --version
travis_retry composer install
fi
- npm --version
- node --version
- nvm install 10.13.0
- npm install
- npm prune
- |
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
npm run env:start
npm run build
docker-compose -f tools/local-env/docker-compose.yml run --rm mysql mysql --version
docker-compose -f tools/local-env/docker-compose.yml run --rm php php --version
docker-compose -f tools/local-env/docker-compose.yml run --rm php php -m
docker-compose -f tools/local-env/docker-compose.yml -f tools/local-env/docker-compose.scripts.yml run --rm phpunit phpunit --version
fi
- |
if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
docker run --name memcached --net local-env_wpdevnet -d memcached
fi
- |
if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
npm run env:install
fi
- npm --version
- node --version
- curl --version
- git --version
- svn --version
- locale -a
script:
- |
if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
npm run test:e2e
elif [[ "$WP_TRAVISCI" == "test:php" ]]; then
npm run test:php -- -- -- --verbose -c phpunit.xml.dist &&
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group ajax &&
npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml &&
npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group external-http &&
npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group restapi-jsclient
else
npm run grunt $WP_TRAVISCI
fi
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