Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.
This introduces the `LOCAL_PHPUNIT` environment variable, which allows the desired version of PHPUnit to be specified when running the PHP tests within the local Docker environment. Because support for newer versions of PHPUnit is not backported, some versions of PHP need the ability to run multiple versions of PHPUnit for different branches. This adds the flexibility needed to use the Docker environment within those older branches to run the PHP tests. Props johnbillion, SergeyBiryukov. Merges [49362] to the 5.5 branch. See #50042. git-svn-id: https://develop.svn.wordpress.org/branches/5.5@49363 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6828266965
commit
61b04b99e1
28
.env
28
.env
@ -3,6 +3,10 @@
|
||||
#
|
||||
# All of these options can be overridden by setting them as environment variables before starting
|
||||
# the environment. You will need to restart your environment when changing any of these.
|
||||
#
|
||||
# Below, the following substitutions can be made:
|
||||
# - '{version}': any major.minor PHP version from 5.2 onwards.
|
||||
# - '{phpunit_version}': any major PHPUnit version starting with 4.
|
||||
##
|
||||
|
||||
# The site will be available at http://localhost:LOCAL_PORT
|
||||
@ -11,10 +15,30 @@ LOCAL_PORT=8889
|
||||
# Where to run WordPress from. Valid options are 'src' and 'build'.
|
||||
LOCAL_DIR=src
|
||||
|
||||
# The PHP version to use. Valid options are 'latest', and '{version}-fpm', where '{version}' is any
|
||||
# x.y PHP version from 5.2 onwards.
|
||||
# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
|
||||
LOCAL_PHP=latest
|
||||
|
||||
##
|
||||
# The PHPUnit version to use when running tests.
|
||||
#
|
||||
# Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
|
||||
# version to run tests.
|
||||
#
|
||||
# Valid versions are:
|
||||
# - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
|
||||
# - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
|
||||
# - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
|
||||
# is only available for PHP versions 5.6 and higher.
|
||||
#
|
||||
# For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
|
||||
#
|
||||
# For full documentation on PHPUnit compatibility and WordPress versions, see
|
||||
# https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
|
||||
#
|
||||
# This defaults to the value assigned to the value of LOCAL_PHP.
|
||||
##
|
||||
LOCAL_PHPUNIT=${LOCAL_PHP}
|
||||
|
||||
# Whether or not to enable XDebug.
|
||||
LOCAL_PHP_XDEBUG=false
|
||||
|
||||
|
20
.travis.yml
20
.travis.yml
@ -29,7 +29,7 @@ env:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- env: WP_TRAVISCI=test:e2e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
|
||||
- env: WP_TRAVISCI=test:e2e LOCAL_PHPUNIT=latest PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
|
||||
name: E2E Tests
|
||||
- env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
|
||||
name: PHP Linting
|
||||
@ -37,24 +37,24 @@ jobs:
|
||||
name: "PHP Compatibility Check"
|
||||
- env: WP_TRAVISCI=travis:js WP_INSTALL=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
|
||||
name: JS Tests
|
||||
- env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
|
||||
- env: LOCAL_PHP=7.4-fpm LOCAL_PHPUNIT=7.4-fpm WP_TRAVISCI=test:php
|
||||
name: "PHPUnit Tests: PHP 7.4"
|
||||
- env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
|
||||
- env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=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
|
||||
- env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=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
|
||||
- env: LOCAL_PHP=7.2-fpm LOCAL_PHPUNIT=7.2-fpm WP_TRAVISCI=test:php
|
||||
name: "PHPUnit Tests: PHP 7.2"
|
||||
- env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
|
||||
- env: LOCAL_PHP=7.1-fpm LOCAL_PHPUNIT=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
|
||||
- env: LOCAL_PHP=7.0-fpm LOCAL_PHPUNIT=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
|
||||
- env: LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=5.6-fpm WP_TRAVISCI=test:php
|
||||
name: "PHPUnit Tests: PHP 5.6"
|
||||
- env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
|
||||
- env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
|
||||
name: "PHPUnit Tests: PHP 8.0"
|
||||
allow_failures:
|
||||
- env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
|
||||
- env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
|
||||
fast_finish: true
|
||||
|
||||
before_install:
|
||||
|
@ -96,7 +96,7 @@ services:
|
||||
# The PHPUnit container.
|
||||
##
|
||||
phpunit:
|
||||
image: wordpressdevelop/phpunit:${LOCAL_PHP-latest}
|
||||
image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-latest}
|
||||
|
||||
networks:
|
||||
- wpdevnet
|
||||
|
52
package-lock.json
generated
52
package-lock.json
generated
@ -8722,9 +8722,9 @@
|
||||
}
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.1.0.tgz",
|
||||
"integrity": "sha512-GUE3gqcDCaMltj2++g6bRQ5rBJWtkWTmqmD0fo1RnnMuUqHNCt2oTPeDnS9n6fKYvlhn7AeBkb38lymBtWBQdA==",
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
|
||||
"dev": true
|
||||
},
|
||||
"dotenv-expand": {
|
||||
@ -13264,12 +13264,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
@ -20161,12 +20161,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"extract-zip": {
|
||||
@ -20182,9 +20182,9 @@
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
|
||||
"integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
@ -24183,6 +24183,12 @@
|
||||
"tar-stream": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"base64-js": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
|
||||
"dev": true
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
|
||||
@ -24195,13 +24201,13 @@
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
|
||||
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz",
|
||||
"integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.0.2",
|
||||
"ieee754": "^1.1.4"
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
@ -24216,12 +24222,12 @@
|
||||
}
|
||||
},
|
||||
"tar-stream": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz",
|
||||
"integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==",
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz",
|
||||
"integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bl": "^4.0.1",
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
"fs-constants": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"check-node-version": "4.0.1",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"cssnano": "4.1.10",
|
||||
"dotenv": "8.1.0",
|
||||
"dotenv": "8.2.0",
|
||||
"dotenv-expand": "5.1.0",
|
||||
"grunt": "~1.1.0",
|
||||
"grunt-banner": "^0.6.0",
|
||||
|
@ -1,6 +1,8 @@
|
||||
const dotenv = require( 'dotenv' );
|
||||
const dotenvExpand = require( 'dotenv-expand' );
|
||||
const { execSync } = require( 'child_process' );
|
||||
dotenv.config();
|
||||
|
||||
dotenvExpand( dotenv.config() );
|
||||
|
||||
// Execute any docker-compose command passed to this script.
|
||||
execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
|
||||
|
@ -1,9 +1,10 @@
|
||||
const dotenv = require( 'dotenv' );
|
||||
const dotenvExpand = require( 'dotenv-expand' );
|
||||
const wait_on = require( 'wait-on' );
|
||||
const { execSync } = require( 'child_process' );
|
||||
const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
|
||||
|
||||
dotenv.config();
|
||||
dotenvExpand( dotenv.config() );
|
||||
|
||||
// Create wp-config.php.
|
||||
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );
|
||||
|
@ -1,7 +1,8 @@
|
||||
const dotenv = require( 'dotenv' );
|
||||
const dotenvExpand = require( 'dotenv-expand' );
|
||||
const { execSync } = require( 'child_process' );
|
||||
|
||||
dotenv.config();
|
||||
dotenvExpand( dotenv.config() );
|
||||
|
||||
// Start the local-env containers.
|
||||
execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
|
||||
|
Loading…
Reference in New Issue
Block a user