2020-06-01 18:37:03 +02:00
|
|
|
os: linux
|
|
|
|
dist: xenial
|
|
|
|
|
2019-08-12 10:28:33 +02:00
|
|
|
language: generic
|
|
|
|
|
2019-08-05 09:09:14 +02:00
|
|
|
services:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
addons:
|
|
|
|
apt:
|
|
|
|
packages:
|
|
|
|
- docker-ce
|
|
|
|
|
2016-03-22 22:49:36 +01:00
|
|
|
cache:
|
2016-05-25 08:11:20 +02:00
|
|
|
apt: true
|
2016-03-22 22:49:36 +01:00
|
|
|
directories:
|
2019-03-25 01:51:12 +01:00
|
|
|
- $HOME/.npm
|
2017-04-23 13:39:43 +02:00
|
|
|
- vendor
|
2019-08-05 09:09:14 +02:00
|
|
|
|
2016-05-25 08:11:20 +02:00
|
|
|
env:
|
|
|
|
global:
|
2019-08-07 13:54:22 +02:00
|
|
|
- LOCAL_DIR: build
|
2019-08-15 01:11:39 +02:00
|
|
|
- COMPOSER_INSTALL: false
|
|
|
|
- NPM_INSTALL: true
|
|
|
|
- WP_INSTALL: true
|
2019-09-26 06:57:38 +02:00
|
|
|
- PHP_FPM_UID: "`id -u`"
|
|
|
|
- PHP_FPM_GID: "`id -g`"
|
2020-07-13 17:18:49 +02:00
|
|
|
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
|
2019-08-05 09:09:14 +02:00
|
|
|
|
2020-06-01 18:37:03 +02:00
|
|
|
jobs:
|
2014-06-21 22:05:19 +02:00
|
|
|
include:
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: WP_TRAVISCI=test:e2e LOCAL_PHPUNIT=latest PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
|
2019-08-07 13:54:22 +02:00
|
|
|
name: E2E Tests
|
2019-08-15 01:11:39 +02:00
|
|
|
- env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
|
2019-08-07 13:54:22 +02:00
|
|
|
name: PHP Linting
|
2019-09-25 15:46:55 +02:00
|
|
|
- env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
|
|
|
|
name: "PHP Compatibility Check"
|
2020-07-13 17:18:49 +02:00
|
|
|
- env: WP_TRAVISCI=travis:js WP_INSTALL=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
|
2020-06-15 17:02:32 +02:00
|
|
|
name: JS Tests
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm COMPOSER_INSTALL=true WP_TRAVISCI=test:php
|
2019-08-07 13:54:22 +02:00
|
|
|
name: "PHPUnit Tests: PHP 8.0"
|
2020-09-07 21:21:26 +02:00
|
|
|
script:
|
|
|
|
# The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated,
|
|
|
|
# as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead.
|
2020-10-07 15:19:33 +02:00
|
|
|
- npm run test:php-composer -- --verbose -c phpunit.xml.dist
|
|
|
|
- npm run test:php-composer -- --verbose -c phpunit.xml.dist --group ajax
|
|
|
|
- npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml
|
|
|
|
- npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
|
|
|
|
- npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
|
|
|
|
- npm run test:php-composer -- --verbose -c phpunit.xml.dist --group restapi-jsclient
|
2020-09-07 21:21:26 +02:00
|
|
|
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
|
2020-09-30 15:12:03 +02:00
|
|
|
# Xdebug supports PHP 8 only from version 3.0, which is not released yet.
|
|
|
|
# Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again.
|
|
|
|
# - LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__
|
2020-09-07 21:21:26 +02:00
|
|
|
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.4-fpm LOCAL_PHPUNIT=7.4-fpm WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.4"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.3"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.3 with Memcached"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.2-fpm LOCAL_PHPUNIT=7.2-fpm WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.2"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.1-fpm LOCAL_PHPUNIT=7.1-fpm WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.1"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=7.0-fpm LOCAL_PHPUNIT=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 7.0"
|
2020-10-29 00:15:07 +01:00
|
|
|
- env: LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=5.6-fpm WP_TRAVISCI=test:php
|
2020-09-30 18:03:03 +02:00
|
|
|
name: "PHPUnit Tests: PHP 5.6"
|
2014-06-21 22:05:19 +02:00
|
|
|
allow_failures:
|
2019-03-25 17:07:01 +01:00
|
|
|
fast_finish: true
|
2019-08-05 09:09:14 +02:00
|
|
|
|
2014-06-21 22:05:19 +02:00
|
|
|
before_install:
|
2019-08-05 09:09:14 +02:00
|
|
|
- |
|
|
|
|
if [[ "$WP_TRAVISCI" == "test:php" ]]; then
|
2020-09-23 20:37:09 +02:00
|
|
|
travis_retry svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer
|
2019-08-05 09:09:14 +02:00
|
|
|
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
|
|
|
|
|
2013-12-02 20:41:26 +01:00
|
|
|
before_script:
|
2017-03-09 22:47:20 +01:00
|
|
|
- |
|
2020-09-07 21:21:26 +02:00
|
|
|
if [[ "$COMPOSER_INSTALL" == "true" && ${LOCAL_PHP:0:3} != "8.0" ]]; then
|
2019-08-15 01:11:39 +02:00
|
|
|
docker-compose run --rm php composer --version
|
|
|
|
docker-compose run --rm php composer install
|
2020-09-07 21:21:26 +02:00
|
|
|
elif [[ "$COMPOSER_INSTALL" == "true" && ${LOCAL_PHP:0:3} == "8.0" ]]; then
|
|
|
|
docker-compose run --rm php composer --version
|
|
|
|
docker-compose run --rm php composer install --ignore-platform-reqs
|
2018-08-17 03:50:26 +02:00
|
|
|
fi
|
2017-03-09 22:08:09 +01:00
|
|
|
- npm --version
|
|
|
|
- node --version
|
2020-06-26 15:31:11 +02:00
|
|
|
- nvm install --latest-npm
|
2019-08-15 01:11:39 +02:00
|
|
|
- |
|
|
|
|
if [[ "$NPM_INSTALL" == "true" ]]; then
|
|
|
|
npm ci
|
|
|
|
fi
|
2019-08-05 09:09:14 +02:00
|
|
|
- |
|
|
|
|
if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
|
|
|
|
npm run env:start
|
|
|
|
npm run build
|
2019-08-12 10:28:33 +02:00
|
|
|
docker-compose run --rm mysql mysql --version
|
|
|
|
docker-compose run --rm php php --version
|
|
|
|
docker-compose run --rm php php -m
|
2020-09-07 21:21:26 +02:00
|
|
|
fi
|
|
|
|
- |
|
|
|
|
if [[ ${LOCAL_PHP:0:3} == "8.0" ]]; then
|
|
|
|
docker-compose run --rm phpunit php ./vendor/bin/phpunit --version
|
|
|
|
elif [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
|
2019-08-12 10:28:33 +02:00
|
|
|
docker-compose run --rm phpunit phpunit --version
|
2019-08-07 13:54:22 +02:00
|
|
|
fi
|
|
|
|
- |
|
|
|
|
if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
|
|
|
|
cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
|
2019-08-12 10:28:33 +02:00
|
|
|
# The memcached server needs to start after `npm run env:start`, which sets up the Docker network.
|
2019-10-28 05:15:37 +01:00
|
|
|
docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
|
2019-08-05 09:09:14 +02:00
|
|
|
fi
|
|
|
|
- |
|
2019-08-15 01:11:39 +02:00
|
|
|
if [[ "$WP_INSTALL" == "true" ]]; then
|
2019-08-12 10:28:33 +02:00
|
|
|
# Run the install process after memcached has started.
|
2019-08-05 09:09:14 +02:00
|
|
|
npm run env:install
|
|
|
|
fi
|
2016-06-16 19:27:22 +02:00
|
|
|
- npm --version
|
|
|
|
- node --version
|
2017-03-09 22:47:20 +01:00
|
|
|
- curl --version
|
|
|
|
- git --version
|
|
|
|
- svn --version
|
2019-09-14 21:27:46 +02:00
|
|
|
- php --version
|
|
|
|
- php -i
|
2017-04-22 23:00:07 +02:00
|
|
|
- locale -a
|
2019-08-05 09:09:14 +02:00
|
|
|
|
2019-06-27 13:26:58 +02:00
|
|
|
script:
|
2019-08-05 09:09:14 +02:00
|
|
|
- |
|
|
|
|
if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
|
|
|
|
npm run test:e2e
|
|
|
|
elif [[ "$WP_TRAVISCI" == "test:php" ]]; then
|
2019-08-12 10:28:33 +02:00
|
|
|
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 &&
|
2019-08-19 04:17:50 +02:00
|
|
|
npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient &&
|
|
|
|
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
|
|
|
|
LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
|
2019-08-15 01:11:39 +02:00
|
|
|
elif [[ "$WP_TRAVISCI" == "lint:php" ]]; then
|
|
|
|
docker-compose run --rm php composer lint:errors &&
|
|
|
|
docker-compose run --rm php composer lint tests
|
2019-09-25 15:46:55 +02:00
|
|
|
elif [[ "$WP_TRAVISCI" == "test:compat" ]]; then
|
|
|
|
docker-compose run --rm php composer compat
|
2019-08-05 09:09:14 +02:00
|
|
|
else
|
|
|
|
npm run grunt $WP_TRAVISCI
|
|
|
|
fi
|
|
|
|
|
2018-01-16 21:28:42 +01:00
|
|
|
after_script:
|
|
|
|
- |
|
|
|
|
if [[ "$WP_TEST_REPORTER" == "true" ]]; then
|
|
|
|
git clone https://github.com/WordPress/phpunit-test-runner.git test-runner
|
2020-04-09 08:06:02 +02:00
|
|
|
docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
|
2018-01-16 21:28:42 +01:00
|
|
|
fi
|
2019-08-05 09:09:14 +02:00
|
|
|
|
2014-12-18 00:50:37 +01:00
|
|
|
notifications:
|
|
|
|
slack:
|
2015-09-26 02:03:24 +02:00
|
|
|
rooms:
|
2017-05-10 12:28:19 +02:00
|
|
|
secure: PO3x/bhYXNFqAMtzDzpOAnHcg2KzG2gGbBDft1HlqN4O8hRJqrRs7hqsEe9wKZUs6qf9Jv0ZleJ5AmcSd0DbDAFsfqeWtnWpsj8NqOIWgLX0C2idvfNRzCX1mUd6E1hlAjjTGnKn4MV3m1dRurwcDqacSBVtbXKQ+yPSgM3eXYkDz8EFbTsMcda8pFskcXr98E7/YomU0QtgOcjXndxGZ53zUQ1rfaDwUJzGY3bn5nLoweVZsSIeEFSiNcip7Kt22zVlU0SAb6QlBf3F0h9IWoRD59BQ7pkl53FWzpXoHzUYOFmn0jB5y1vHMlHvTDVEmDuumpCEqnxVvLh33AwGtqYRWH36PEfTn/u1YTFr7FS7KbwrKw9Nn+jUZe3KFrVzgQNUt0El33mO0FbSoNEWJhxRarp0D1z3/HVsbon3Fwzt/3jBHGf9nI+tHH4u7KQ70+M7pzBsV7F7Lc60YnuKrcy/hkwObGB0Za9tMHPUw3c7b4ep6nSa4ts9S++IijLWDaNAq7K/j7fAfI1JrkPIw4T6PcGpNAADkmlCrvToKE4axExaJke/lkUb+3Pwdj0h7ePzPSrHT8aASlKFM1PuI1KRMn/J4wRLtGeLlfYXvVlaQYmJobJtYgoiNWJWMIybLGVBSVPohdGO3qIJbl8WNPN1cW2ZZTcEBprLe8y7MSo=
|
2015-09-25 22:12:09 +02:00
|
|
|
on_failure: always
|
|
|
|
on_success: change
|
2016-04-20 19:08:13 +02:00
|
|
|
on_pull_requests: false
|