mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Split the PHPUnit tests for PHP versions below 7.0 in half, allowing them to run in parallel and reduce the overall test run duration on GitHub Actions.
The `external-http`, `media`, and `restapi` groups combined take roughly the same time as all the other tests combined. Splitting the test run in two speeds up the PHP 5.6 test runs which are the slowest by quite a margin. The net reduction in duration is only seen on PHP versions older than 7.0 where the reduction is greater than the time taken for the job to be set up. Props peterwilsoncc, desrosj, johnbillion Special shout out to manzoorwanijk whose article about running steps in parallel started me down this path. Fixes #52645 git-svn-id: https://develop.svn.wordpress.org/trunk@50444 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7fa70bcb02
commit
d59c227764
34
.github/workflows/phpunit-tests.yml
vendored
34
.github/workflows/phpunit-tests.yml
vendored
@ -24,6 +24,7 @@ env:
|
||||
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
|
||||
PHPUNIT_SCRIPT: php
|
||||
LOCAL_PHP_MEMCACHED: ${{ false }}
|
||||
SLOW_TESTS: 'external-http,media,restapi'
|
||||
|
||||
jobs:
|
||||
# Sets up the workflow for testing.
|
||||
@ -66,7 +67,7 @@ jobs:
|
||||
# - Submit the test results to the WordPress.org host test results.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
test-php:
|
||||
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -74,8 +75,20 @@ jobs:
|
||||
php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
|
||||
os: [ ubuntu-latest ]
|
||||
memcached: [ false ]
|
||||
split_slow: [ false ]
|
||||
multisite: [ false, true ]
|
||||
include:
|
||||
# Additional "slow" jobs for PHP 5.6.
|
||||
- php: '5.6.20'
|
||||
os: ubuntu-latest
|
||||
memcached: false
|
||||
multisite: false
|
||||
split_slow: true
|
||||
- php: '5.6.20'
|
||||
os: ubuntu-latest
|
||||
memcached: false
|
||||
multisite: true
|
||||
split_slow: true
|
||||
# Include jobs for PHP 7.4 with memcached.
|
||||
- php: '7.4'
|
||||
os: ubuntu-latest
|
||||
@ -189,22 +202,37 @@ jobs:
|
||||
- name: Install WordPress
|
||||
run: npm run env:install
|
||||
|
||||
- name: Run slow PHPUnit tests
|
||||
if: ${{ matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
|
||||
|
||||
- name: Run PHPUnit tests for single site excluding slow tests
|
||||
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
|
||||
|
||||
- name: Run PHPUnit tests for Multisite excluding slow tests
|
||||
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
if: ${{ matrix.php >= '7.0' }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
|
||||
|
||||
- name: Run AJAX tests
|
||||
if: ${{ ! matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
|
||||
|
||||
- name: Run ms-files tests as a multisite install
|
||||
if: ${{ matrix.multisite }}
|
||||
if: ${{ matrix.multisite && ! matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
|
||||
|
||||
- name: Run external HTTP tests
|
||||
if: ${{ ! matrix.multisite }}
|
||||
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
|
||||
|
||||
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
|
||||
- name: Run (xDebug) tests
|
||||
if: ${{ ! matrix.split_slow }}
|
||||
run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
|
||||
|
||||
- name: Checkout the WordPress Test Reporter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user