Make WordPress Core

Changeset 50296 for branches/5.6


Ignore:
Timestamp:
02/12/2021 02:53:59 PM (4 years ago)
Author:
desrosj
Message:

Build/Test Tools: Merge several automated testing improvements to the 5.6 branch.

This merges several refinements to GitHub Action workflow files to the 5.6 branch.

It also includes [49836], which added the ability to replace mysql with mariadb when using the local Docker environment to ensure consistency of the tools across branches.

Props johnbillion.
Merges [49781-49784,49786,49836,49938,50268,50285] to the 5.6 branch.
See #50401.

Location:
branches/5.6
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/5.6

  • branches/5.6/.env

    r49362 r50296  
    4646LOCAL_PHP_MEMCACHED=false
    4747
    48 # The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
    49 LOCAL_MYSQL=5.7
     48##
     49# The database software to use.
     50#
     51# Supported values are `mysql` and `mariadb`.
     52##
     53LOCAL_DB_TYPE=mysql
     54
     55##
     56# The database version to use.
     57#
     58# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
     59#
     60# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions.
     61# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
     62##
     63LOCAL_DB_VERSION=5.7
    5064
    5165# The debug settings to add to `wp-config.php`.
     
    5872# The URL to use when running e2e tests.
    5973WP_BASE_URL=http://localhost:${LOCAL_PORT}
     74
     75##
     76# The revision number of the WordPress Importer plugin to use when running unit tests.
     77#
     78# This should be an SVN revision number from the official plugin repository on wordpress.org.
     79##
     80WP_IMPORTER_REVISION=2387243
  • branches/5.6/.github/workflows/coding-standards.yml

    r49369 r50296  
    1717  # Performs the following steps:
    1818  # - Checks out the repository.
    19   # - Configures caching for Composer.
    2019  # - Sets up PHP.
    2120  # - Logs debug information.
    22   # - Installs Composer dependencies (from cache if possible).
     21  # - Installs Composer dependencies (use cache if possible).
     22  # - Make Composer packages available globally.
    2323  # - Logs PHP_CodeSniffer debug information.
    2424  # - Runs PHPCS on the full codebase with warnings suppressed.
     
    2828    name: PHP coding standards
    2929    runs-on: ubuntu-latest
     30    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     31
    3032    steps:
    3133      - name: Checkout repository
    3234        uses: actions/checkout@v2
    33 
    34       - name: Get Composer cache directory
    35         id: composer-cache
    36         run: echo "::set-output name=dir::$(composer config cache-files-dir)"
    37 
    38       - name: Set up Composer caching
    39         uses: actions/cache@v2
    40         env:
    41           cache-name: cache-composer-dependencies
    42         with:
    43           path: ${{ steps.composer-cache.outputs.dir }}
    44           key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
    45           restore-keys: |
    46             ${{ runner.os }}-composer-
    4735
    4836      - name: Set up PHP
     
    5947
    6048      - name: Install Composer dependencies
    61         run: |
    62           composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
    63           echo "${PWD}/vendor/bin" >> $GITHUB_PATH
     49        uses: ramsey/composer-install@v1
     50        with:
     51          composer-options: "--no-progress --no-ansi --no-interaction"
     52
     53      - name: Make Composer packages available globally
     54        run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    6455
    6556      - name: Log PHPCS debug information
     
    7465  # Runs the JavaScript coding standards checks.
    7566  #
     67  # JSHint violations are not currently reported inline with annotations.
     68  #
    7669  # Performs the following steps:
    7770  # - Checks out the repository.
    7871  # - Logs debug information about the runner container.
    79   # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
     72  # - Installs NodeJS 14.
    8073  # - Sets up caching for NPM.
    8174  # - Logs updated debug information.
     
    8679    name: JavaScript coding standards
    8780    runs-on: ubuntu-latest
     81    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    8882    env:
    8983      PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
     84
    9085    steps:
    9186      - name: Checkout repository
     
    10297        uses: actions/setup-node@v1
    10398        with:
    104           node-version: 12
     99          node-version: 14
    105100
    106101      - name: Cache NodeJS modules
  • branches/5.6/.github/workflows/javascript-tests.yml

    r49371 r50296  
    1515  # - Checks out the repository.
    1616  # - Logs debug information about the runner container.
    17   # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
     17  # - Installs NodeJS 14.
    1818  # - Sets up caching for NPM.
    1919  # - Logs updated debug information.
     
    2424    name: QUnit Tests
    2525    runs-on: ubuntu-latest
     26    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     27
    2628    steps:
    2729      - name: Cancel previous runs of this workflow (pull requests only)
     
    4446        uses: actions/setup-node@v1
    4547        with:
    46           node-version: 12
     48          node-version: 14
    4749
    4850      - name: Cache NodeJS modules
  • branches/5.6/.github/workflows/php-compatibility.yml

    r49175 r50296  
    1818  # Performs the following steps:
    1919  # - Checks out the repository.
    20   # - Configures caching for Composer.
    2120  # - Sets up PHP.
    2221  # - Logs debug information about the runner container.
    23   # - Installs Composer dependencies (from cache if possible).
     22  # - Installs Composer dependencies (use cache if possible).
     23  # - Make Composer packages available globally.
    2424  # - Logs PHP_CodeSniffer debug information.
    2525  # - Runs the PHP compatibility tests.
     
    2828    name: Check PHP compatibility
    2929    runs-on: ubuntu-latest
     30    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    3031
    3132    steps:
    3233      - name: Checkout repository
    3334        uses: actions/checkout@v2
    34 
    35       - name: Get Composer cache directory
    36         id: composer-cache
    37         run: echo "::set-output name=dir::$(composer config cache-files-dir)"
    38 
    39       - name: Set up Composer caching
    40         uses: actions/cache@v2
    41         env:
    42           cache-name: cache-composer-dependencies
    43         with:
    44           path: ${{ steps.composer-cache.outputs.dir }}
    45           key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
    46           restore-keys: |
    47             ${{ runner.os }}-composer-
    4835
    4936      - name: Set up PHP
     
    6047
    6148      - name: Install Composer dependencies
    62         run: |
    63           composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
    64           echo "${PWD}/vendor/bin" >> $GITHUB_PATH
     49        uses: ramsey/composer-install@v1
     50        with:
     51          composer-options: "--no-progress --no-ansi --no-interaction"
     52
     53      - name: Make Composer packages available globally
     54        run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
    6555
    6656      - name: Log PHPCS debug information
  • branches/5.6/.github/workflows/phpunit-tests.yml

    r49371 r50296  
    2525  # - Cancels all previous workflow runs for pull requests that have not completed.
    2626  # - Checks out the repository.
    27   # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
    2827  # - Logs debug information about the runner container.
    29   # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
     28  # - Installs NodeJS 14.
    3029  # - Sets up caching for NPM.
    3130  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     
    3635    name: Setup WordPress
    3736    runs-on: ubuntu-latest
     37    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    3838
    3939    steps:
     
    4646      - name: Checkout repository
    4747        uses: actions/checkout@v2
    48 
    49       - name: Checkout the WordPress Importer plugin
    50         run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer
    5148
    5249      - name: Log debug information
     
    6663        uses: actions/setup-node@v1
    6764        with:
    68           node-version: 12
     65          node-version: 14
    6966
    7067      - name: Cache NodeJS modules
     
    105102  # - Downloads the built WordPress artifact from the previous job.
    106103  # - Unzips the artifact.
    107   # - Installs NodeJS 12 (todo: install the version of NPM specified in the `nvmrc` file to support older branches)
     104  # - Installs NodeJS 14.
    108105  # - Sets up caching for NPM.
    109106  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     
    119116  # - Install WordPress within the Docker container.
    120117  # - Run the PHPUnit tests.
    121   # - Reports test results to the Distributed Hosting Tests.
     118  # - Checks out the WordPress Test reporter repository.
     119  # - Reconnect the directory to the Git repository.
     120  # - Submit the test results to the WordPress.org host test results.
    122121  # - todo: Configure Slack notifications for failing tests.
    123122  test-php:
     
    161160        uses: actions/setup-node@v1
    162161        with:
    163           node-version: 12
     162          node-version: 14
    164163
    165164      - name: Use cached Node modules
     
    189188        with:
    190189          path: ${{ steps.composer-cache.outputs.dir }}
    191           key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
     190          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
    192191          restore-keys: |
    193             ${{ runner.os }}-composer-
     192            ${{ runner.os }}-php-${{ matrix.php }}-composer-
    194193
    195194      - name: Install Composer dependencies
     
    271270        run: LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
    272271
    273       - name: WordPress Test Reporter
    274         if: ${{ matrix.report }}
     272      - name: Checkout the WordPress Test Reporter
     273        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
    275274        uses: actions/checkout@v2
    276275        with:
    277276          repository: 'WordPress/phpunit-test-runner'
    278277          path: 'test-runner'
    279         # TODO: Configure hidden keys to successfully report test results.
    280         # run: 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
     278
     279      - name: Set up the Git repository
     280        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
     281        run: |
     282          git init
     283          git remote add origin https://github.com/WordPress/wordpress-develop.git
     284          git fetch
     285          git reset origin/master
     286
     287      - name: Submit test results to the WordPress.org host test results
     288        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
     289        env:
     290          WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
     291        run: 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
  • branches/5.6/.github/workflows/verify-npm-on-windows.yml

    r50198 r50296  
    1818  # - Checks out the repository.
    1919  # - Logs debug information about the runner container.
    20   # - Installs NodeJS 14 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches).
     20  # - Installs NodeJS 14.
    2121  # - Sets up caching for NPM.
    2222  # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     
    2525    name: Tests NPM on Windows
    2626    runs-on: windows-latest
     27    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     28
    2729    steps:
    2830      - name: Cancel previous runs of this workflow (pull requests only)
  • branches/5.6/.github/workflows/welcome-new-contributors.yml

    r49548 r50296  
    99  post-welcome-message:
    1010    runs-on: ubuntu-latest
     11    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    1112
    1213    steps:
  • branches/5.6/docker-compose.yml

    r49362 r50296  
    5454  ##
    5555  mysql:
    56     image: mysql:${LOCAL_MYSQL-latest}
     56    image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
    5757
    5858    networks:
  • branches/5.6/tools/local-env/scripts/install.js

    r49362 r50296  
    2020// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
    2121renameSync( 'src/wp-config.php', 'wp-config.php' );
     22
     23install_wp_importer();
    2224
    2325// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
     
    4648    execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
    4749}
     50
     51/**
     52 * Downloads the WordPress Importer plugin for use in tests.
     53 */
     54function install_wp_importer() {
     55    const test_plugin_directory = 'tests/phpunit/data/plugins/wordpress-importer';
     56
     57    execSync( `docker-compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
     58}
Note: See TracChangeset for help on using the changeset viewer.