Make WordPress Core

Changeset 49529 for branches/5.0


Ignore:
Timestamp:
11/06/2020 05:29:16 PM (4 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport the local Docker environment to the 5.0 branch.

This commit introduces the Docker-based local WordPress development environment to the 5.0 branch and converts the Travis test jobs to utilize this environment for easier and more consistent testing.

Until existing blockers with the PHP 5.2 Docker container can be solved, the PHP 5.2 test job will remain using the Travis precise image.

Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 5.0 branch.
See #48301, #47767.

Location:
branches/5.0
Files:
11 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/.travis.yml

    r49277 r49529  
    1 sudo: false
    2 dist: trusty
    31language: php
     2
     3services:
     4  - docker
     5
    46cache:
    57  apt: true
     
    79    - $HOME/.npm
    810    - vendor
    9     - $HOME/.composer/cache
     11
    1012env:
    1113  global:
    12     - WP_TRAVISCI=travis:phpunit
     14    - LOCAL_DIR: build
     15    - NPM_INSTALL: true
     16    - WP_INSTALL: true
     17    - PHP_FPM_UID: "`id -u`"
     18    - PHP_FPM_GID: "`id -g`"
     19
    1320matrix:
    1421  include:
    15   - php: 7.1
    16     env: WP_TRAVISCI=travis:js
    17   - php: 7.3
    18   - php: 5.6
    19     env: WP_TRAVIS_OBJECT_CACHE=true
    20     services: memcached
    21   - php: 5.2
    22     dist: precise
     22    - env: WP_TRAVISCI=travis:js LOCAL_PHP=7.1-fpm WP_INSTALL=false
     23      name: "JS Tests"
     24    - env: LOCAL_PHPUNIT=6-php-7.3-fpm WP_TRAVISCI=test:php
     25      name: "PHPUnit Tests: PHP 7.3"
     26    - env: LOCAL_PHP_MEMCACHED=true LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=4-php-5.6-fpm WP_TRAVISCI=test:php
     27      name: "PHPUnit Tests: PHP 5.6 with Memcached"
     28    - env: WP_TRAVISCI=travis:phpunit WP_INSTALL=false
     29      php: 5.2
     30      dist: precise
     31  fast_finish: true
     32
    2333before_install:
    24 - |
    25   if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
     34  - |
     35    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
     36      travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
     37    fi
     38  - |
     39    if [[ "$WP_TRAVISCI" != "travis:phpunit" ]]; then
     40      curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
     41      sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
     42      sudo apt-get update
     43      sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
     44    fi
     45  - |
     46    sudo rm /usr/local/bin/docker-compose
     47    curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
     48    chmod +x docker-compose
     49    sudo mv docker-compose /usr/local/bin
     50  - |
     51    if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
    2652      mysql -u root -e "CREATE DATABASE wordpress_tests;"
    2753      cp wp-tests-config-sample.php wp-tests-config.php
     
    3056      sed -i "s/yourpasswordhere//" wp-tests-config.php
    3157      travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
    32   fi
    33 - |
    34   if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
    35     cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    36     echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
    37   fi
     58    fi
     59
    3860before_script:
    39 - |
    40   # Remove Xdebug for a huge performance increase:
    41   if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
    42     phpenv config-rm xdebug.ini
    43   else
    44     echo "xdebug.ini does not exist"
    45   fi
    46 - |
    47   # Export Composer's global bin dir to PATH, but not on PHP 5.2:
    48   if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
    49     composer config --list --global
    50     export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
    51   fi
    52 - |
    53   # Install the specified version of PHPUnit depending on the PHP version:
    54   if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
    55     case "$TRAVIS_PHP_VERSION" in
    56       7.3|7.2|7.1|7.0|nightly)
    57         echo "Using PHPUnit 6.x"
    58         travis_retry composer global require "phpunit/phpunit:^6"
    59         ;;
    60       5.6|5.5|5.4|5.3)
    61         echo "Using PHPUnit 4.x"
    62         travis_retry composer global require "phpunit/phpunit:^4"
    63         ;;
    64       5.2)
    65         # Do nothing, use default PHPUnit 3.6.x
    66         echo "Using default PHPUnit, hopefully 3.6"
    67         ;;
    68       *)
    69         echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
    70         exit 1
    71         ;;
    72     esac
    73   fi
    74 - npm --version
    75 - node --version
    76 - nvm install
    77 - npm install -g grunt-cli
    78 - npm install
    79 - npm prune
    80 - mysql --version
    81 - phpenv versions
    82 - php --version
    83 - php -m
    84 - npm --version
    85 - node --version
    86 - which phpunit
    87 - phpunit --version
    88 - curl --version
    89 - grunt --version
    90 - git --version
    91 - svn --version
    92 - locale -a
    93 script: grunt $WP_TRAVISCI
     61  - npm --version
     62  - node --version
     63  - nvm install
     64  - |
     65    if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
     66      phpenv config-rm xdebug.ini
     67      npm install -g grunt-cli
     68      mysql --version
     69      phpenv versions
     70      php --version
     71      php -m
     72    fi
     73  - |
     74    if [[ "$NPM_INSTALL" == "true" ]]; then
     75      npm install
     76    fi
     77  - |
     78    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
     79      npm run env:start
     80      npm run build
     81      docker-compose run --rm mysql mysql --version
     82      docker-compose run --rm php php --version
     83      docker-compose run --rm php php -m
     84      docker-compose run --rm phpunit phpunit --version
     85    fi
     86  - |
     87    if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
     88      cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
     89      # The memcached server needs to start after `npm run env:start`, which sets up the Docker network.
     90      docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
     91    fi
     92  - |
     93    if [[ "$WP_INSTALL" == "true" ]]; then
     94      # Run the install process after memcached has started.
     95      npm run env:install
     96    fi
     97  - npm --version
     98  - node --version
     99  - curl --version
     100  - git --version
     101  - svn --version
     102  - php --version
     103  - php -i
     104  - locale -a
     105
     106script:
     107  - |
     108    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
     109      npm run test:php -- --verbose -c phpunit.xml.dist &&
     110      npm run test:php -- --verbose -c phpunit.xml.dist --group ajax &&
     111      npm run test:php -- --verbose -c tests/phpunit/multisite.xml &&
     112      npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
     113      npm run test:php -- --verbose -c phpunit.xml.dist --group external-http &&
     114      npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient &&
     115      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
     116      LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
     117    else
     118      npm run grunt $WP_TRAVISCI
     119    fi
     120
     121after_script:
     122  - |
     123    if [[ "$WP_TEST_REPORTER" == "true" ]]; then
     124      git clone https://github.com/WordPress/phpunit-test-runner.git test-runner
     125      docker-compose run --rm -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
     126    fi
     127
    94128notifications:
    95129  slack:
  • branches/5.0/package-lock.json

    r49414 r49529  
    2727                    "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg=="
    2828                }
     29            }
     30        },
     31        "@hapi/address": {
     32            "version": "2.1.4",
     33            "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
     34            "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==",
     35            "dev": true
     36        },
     37        "@hapi/bourne": {
     38            "version": "1.3.2",
     39            "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
     40            "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
     41            "dev": true
     42        },
     43        "@hapi/hoek": {
     44            "version": "8.5.1",
     45            "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
     46            "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==",
     47            "dev": true
     48        },
     49        "@hapi/joi": {
     50            "version": "15.1.1",
     51            "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
     52            "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
     53            "dev": true,
     54            "requires": {
     55                "@hapi/address": "2.x.x",
     56                "@hapi/bourne": "1.x.x",
     57                "@hapi/hoek": "8.x.x",
     58                "@hapi/topo": "3.x.x"
     59            }
     60        },
     61        "@hapi/topo": {
     62            "version": "3.1.6",
     63            "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
     64            "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
     65            "dev": true,
     66            "requires": {
     67                "@hapi/hoek": "^8.3.0"
    2968            }
    3069        },
     
    43134352            }
    43144353        },
     4354        "dotenv": {
     4355            "version": "8.2.0",
     4356            "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
     4357            "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
     4358            "dev": true
     4359        },
     4360        "dotenv-expand": {
     4361            "version": "5.1.0",
     4362            "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz",
     4363            "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==",
     4364            "dev": true
     4365        },
    43154366        "download": {
    43164367            "version": "4.4.3",
     
    1243512486            "integrity": "sha1-QAwJ6+kU57F+C27zJjQA/Cq8fLM="
    1243612487        },
     12488        "rx": {
     12489            "version": "4.1.0",
     12490            "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
     12491            "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=",
     12492            "dev": true
     12493        },
    1243712494        "rxjs": {
    1243812495            "version": "5.5.12",
     
    1454814605            "requires": {
    1454914606                "indexof": "0.0.1"
     14607            }
     14608        },
     14609        "wait-on": {
     14610            "version": "3.3.0",
     14611            "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-3.3.0.tgz",
     14612            "integrity": "sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ==",
     14613            "dev": true,
     14614            "requires": {
     14615                "@hapi/joi": "^15.0.3",
     14616                "core-js": "^2.6.5",
     14617                "minimist": "^1.2.0",
     14618                "request": "^2.88.0",
     14619                "rx": "^4.1.0"
     14620            },
     14621            "dependencies": {
     14622                "core-js": {
     14623                    "version": "2.6.11",
     14624                    "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
     14625                    "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
     14626                    "dev": true
     14627                },
     14628                "minimist": {
     14629                    "version": "1.2.5",
     14630                    "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
     14631                    "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
     14632                    "dev": true
     14633                }
    1455014634            }
    1455114635        },
  • branches/5.0/package.json

    r49414 r49529  
    1919        "copy-webpack-plugin": "^4.6.0",
    2020        "cssnano": "^4.1.4",
     21        "dotenv": "^8.2.0",
     22        "dotenv-expand": "^5.1.0",
    2123        "grunt": "~1.0.3",
    2224        "grunt-banner": "^0.6.0",
     
    4547        "source-map-loader": "^0.2.4",
    4648        "uglify-js": "^3.4.9",
     49        "wait-on": "^3.3.0",
    4750        "webpack": "^4.24.0",
    4851        "webpack-dev-server": "^3.1.9",
     
    98101    },
    99102    "scripts": {
    100         "grunt": "grunt"
     103        "build": "grunt build",
     104        "build:dev": "grunt build --dev",
     105        "dev": "grunt watch --dev",
     106        "test": "grunt test",
     107        "watch": "grunt watch",
     108        "grunt": "grunt",
     109        "env:start": "node ./tools/local-env/scripts/start.js",
     110        "env:stop": "node ./tools/local-env/scripts/docker.js down",
     111        "env:restart": "npm run env:stop && npm run env:start",
     112        "env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",
     113        "env:reset": "node ./tools/local-env/scripts/docker.js down --rmi all -v --remove-orphans",
     114        "env:install": "node ./tools/local-env/scripts/install.js",
     115        "env:cli": "node ./tools/local-env/scripts/docker.js run cli",
     116        "env:logs": "node ./tools/local-env/scripts/docker.js logs",
     117        "env:pull": "node ./tools/local-env/scripts/docker.js pull",
     118        "test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit"
    101119    }
    102120}
  • branches/5.0/tests/phpunit/tests/ajax/CustomizeMenus.php

    r41887 r49529  
    5555        if ( 'administrator' != $role ) {
    5656            // If we're not an admin, we should get a wp_die(-1).
    57             $this->setExpectedException( 'WPAjaxDieStopException' );
     57            $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    5858        }
    5959
     
    430430        if ( 'administrator' != $role ) {
    431431            // If we're not an admin, we should get a wp_die(-1).
    432             $this->setExpectedException( 'WPAjaxDieStopException' );
     432            $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    433433        }
    434434
Note: See TracChangeset for help on using the changeset viewer.