Make WordPress Core

Changeset 49363


Ignore:
Timestamp:
10/28/2020 11:32:16 PM (5 years ago)
Author:
desrosj
Message:

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.

Location:
branches/5.5
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/.env

    r49339 r49363  
    44# All of these options can be overridden by setting them as environment variables before starting
    55# the environment. You will need to restart your environment when changing any of these.
     6#
     7# Below, the following substitutions can be made:
     8# - '{version}': any major.minor PHP version from 5.2 onwards.
     9# - '{phpunit_version}': any major PHPUnit version starting with 4.
    610##
    711
     
    1216LOCAL_DIR=src
    1317
    14 # The PHP version to use. Valid options are 'latest', and '{version}-fpm', where '{version}' is any
    15 # x.y PHP version from 5.2 onwards.
     18# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
    1619LOCAL_PHP=latest
     20
     21##
     22# The PHPUnit version to use when running tests.
     23#
     24# Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
     25# version to run tests.
     26#
     27# Valid versions are:
     28# - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
     29# - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
     30# - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
     31# is only available for PHP versions 5.6 and higher.
     32#
     33# For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
     34#
     35# For full documentation on PHPUnit compatibility and WordPress versions, see
     36# https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
     37#
     38# This defaults to the value assigned to the value of LOCAL_PHP.
     39##
     40LOCAL_PHPUNIT=${LOCAL_PHP}
    1741
    1842# Whether or not to enable XDebug.
  • branches/5.5/.travis.yml

    r48458 r49363  
    3030jobs:
    3131  include:
    32   - env: WP_TRAVISCI=test:e2e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
     32  - env: WP_TRAVISCI=test:e2e LOCAL_PHPUNIT=latest PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
    3333    name: E2E Tests
    3434  - env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
     
    3838  - env: WP_TRAVISCI=travis:js WP_INSTALL=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
    3939    name: JS Tests
    40   - env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
     40  - env: LOCAL_PHP=7.4-fpm LOCAL_PHPUNIT=7.4-fpm WP_TRAVISCI=test:php
    4141    name: "PHPUnit Tests: PHP 7.4"
    42   - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
     42  - env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm WP_TRAVISCI=test:php
    4343    name: "PHPUnit Tests: PHP 7.3"
    44   - env: LOCAL_PHP=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
     44  - env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
    4545    name: "PHPUnit Tests: PHP 7.3 with Memcached"
    46   - env: LOCAL_PHP=7.2-fpm WP_TRAVISCI=test:php
     46  - env: LOCAL_PHP=7.2-fpm LOCAL_PHPUNIT=7.2-fpm WP_TRAVISCI=test:php
    4747    name: "PHPUnit Tests: PHP 7.2"
    48   - env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
     48  - env: LOCAL_PHP=7.1-fpm LOCAL_PHPUNIT=7.1-fpm WP_TRAVISCI=test:php
    4949    name: "PHPUnit Tests: PHP 7.1"
    50   - env: LOCAL_PHP=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
     50  - env: LOCAL_PHP=7.0-fpm LOCAL_PHPUNIT=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
    5151    name: "PHPUnit Tests: PHP 7.0"
    52   - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
     52  - env: LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=5.6-fpm WP_TRAVISCI=test:php
    5353    name: "PHPUnit Tests: PHP 5.6"
    54   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     54  - env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
    5555    name: "PHPUnit Tests: PHP 8.0"
    5656  allow_failures:
    57   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     57  - env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
    5858  fast_finish: true
    5959
  • branches/5.5/docker-compose.yml

    r47912 r49363  
    9797  ##
    9898  phpunit:
    99     image: wordpressdevelop/phpunit:${LOCAL_PHP-latest}
     99    image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-latest}
    100100
    101101    networks:
  • branches/5.5/package-lock.json

    r48936 r49363  
    87238723        },
    87248724        "dotenv": {
    8725             "version": "8.1.0",
    8726             "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.1.0.tgz",
    8727             "integrity": "sha512-GUE3gqcDCaMltj2++g6bRQ5rBJWtkWTmqmD0fo1RnnMuUqHNCt2oTPeDnS9n6fKYvlhn7AeBkb38lymBtWBQdA==",
     8725            "version": "8.2.0",
     8726            "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
     8727            "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
    87288728            "dev": true
    87298729        },
     
    1326513265            "dependencies": {
    1326613266                "debug": {
    13267                     "version": "4.1.1",
    13268                     "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
    13269                     "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
    13270                     "dev": true,
    13271                     "requires": {
    13272                         "ms": "^2.1.1"
     13267                    "version": "4.2.0",
     13268                    "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
     13269                    "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
     13270                    "dev": true,
     13271                    "requires": {
     13272                        "ms": "2.1.2"
    1327313273                    }
    1327413274                },
     
    2016220162            "dependencies": {
    2016320163                "debug": {
    20164                     "version": "4.1.1",
    20165                     "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
    20166                     "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
    20167                     "dev": true,
    20168                     "requires": {
    20169                         "ms": "^2.1.1"
     20164                    "version": "4.2.0",
     20165                    "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
     20166                    "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
     20167                    "dev": true,
     20168                    "requires": {
     20169                        "ms": "2.1.2"
    2017020170                    }
    2017120171                },
     
    2018320183                },
    2018420184                "get-stream": {
    20185                     "version": "5.1.0",
    20186                     "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
    20187                     "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
     20185                    "version": "5.2.0",
     20186                    "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
     20187                    "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
    2018820188                    "dev": true,
    2018920189                    "requires": {
     
    2418424184            },
    2418524185            "dependencies": {
     24186                "base64-js": {
     24187                    "version": "1.3.1",
     24188                    "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
     24189                    "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
     24190                    "dev": true
     24191                },
    2418624192                "bl": {
    2418724193                    "version": "4.0.3",
     
    2419624202                },
    2419724203                "buffer": {
    24198                     "version": "5.6.0",
    24199                     "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
    24200                     "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
    24201                     "dev": true,
    24202                     "requires": {
    24203                         "base64-js": "^1.0.2",
    24204                         "ieee754": "^1.1.4"
     24204                    "version": "5.7.0",
     24205                    "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz",
     24206                    "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==",
     24207                    "dev": true,
     24208                    "requires": {
     24209                        "base64-js": "^1.3.1",
     24210                        "ieee754": "^1.1.13"
    2420524211                    }
    2420624212                },
     
    2421724223                },
    2421824224                "tar-stream": {
    24219                     "version": "2.1.3",
    24220                     "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz",
    24221                     "integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==",
    24222                     "dev": true,
    24223                     "requires": {
    24224                         "bl": "^4.0.1",
     24225                    "version": "2.1.4",
     24226                    "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz",
     24227                    "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==",
     24228                    "dev": true,
     24229                    "requires": {
     24230                        "bl": "^4.0.3",
    2422524231                        "end-of-stream": "^1.4.1",
    2422624232                        "fs-constants": "^1.0.0",
  • branches/5.5/package.json

    r48936 r49363  
    3636        "copy-webpack-plugin": "^5.1.1",
    3737        "cssnano": "4.1.10",
    38         "dotenv": "8.1.0",
     38        "dotenv": "8.2.0",
    3939        "dotenv-expand": "5.1.0",
    4040        "grunt": "~1.1.0",
  • branches/5.5/tools/local-env/scripts/docker.js

    r46586 r49363  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const { execSync } = require( 'child_process' );
    3 dotenv.config();
     4
     5dotenvExpand( dotenv.config() );
    46
    57// Execute any docker-compose command passed to this script.
  • branches/5.5/tools/local-env/scripts/install.js

    r49340 r49363  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const wait_on = require( 'wait-on' );
    34const { execSync } = require( 'child_process' );
    45const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
    56
    6 dotenv.config();
     7dotenvExpand( dotenv.config() );
    78
    89// Create wp-config.php.
  • branches/5.5/tools/local-env/scripts/start.js

    r46586 r49363  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const { execSync } = require( 'child_process' );
    34
    4 dotenv.config();
     5dotenvExpand( dotenv.config() );
    56
    67// Start the local-env containers.
Note: See TracChangeset for help on using the changeset viewer.