Make WordPress Core

Changeset 50444


Ignore:
Timestamp:
02/26/2021 03:07:03 PM (4 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/phpunit-tests.yml

    r50442 r50444  
    2525  PHPUNIT_SCRIPT: php
    2626  LOCAL_PHP_MEMCACHED: ${{ false }}
     27  SLOW_TESTS: 'external-http,media,restapi'
    2728
    2829jobs:
     
    6768  # - todo: Configure Slack notifications for failing tests.
    6869  test-php:
    69     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     70    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    7071    runs-on: ${{ matrix.os }}
    7172    strategy:
     
    7576        os: [ ubuntu-latest ]
    7677        memcached: [ false ]
     78        split_slow: [ false ]
    7779        multisite: [ false, true ]
    7880        include:
     81          # Additional "slow" jobs for PHP 5.6.
     82          - php: '5.6.20'
     83            os: ubuntu-latest
     84            memcached: false
     85            multisite: false
     86            split_slow: true
     87          - php: '5.6.20'
     88            os: ubuntu-latest
     89            memcached: false
     90            multisite: true
     91            split_slow: true
    7992          # Include jobs for PHP 7.4 with memcached.
    8093          - php: '7.4'
     
    190203        run: npm run env:install
    191204
     205      - name: Run slow PHPUnit tests
     206        if: ${{ matrix.split_slow }}
     207        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
     208
     209      - name: Run PHPUnit tests for single site excluding slow tests
     210        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
     211        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
     212
     213      - name: Run PHPUnit tests for Multisite excluding slow tests
     214        if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
     215        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
     216
    192217      - name: Run PHPUnit tests
     218        if: ${{ matrix.php >= '7.0' }}
    193219        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    194220
    195221      - name: Run AJAX tests
     222        if: ${{ ! matrix.split_slow }}
    196223        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    197224
    198225      - name: Run ms-files tests as a multisite install
    199         if: ${{ matrix.multisite }}
     226        if: ${{ matrix.multisite && ! matrix.split_slow }}
    200227        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    201228
    202229      - name: Run external HTTP tests
    203         if: ${{ ! matrix.multisite }}
     230        if: ${{ ! matrix.multisite && ! matrix.split_slow }}
    204231        run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
    205232
    206233      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    207234      - name: Run (xDebug) tests
     235        if: ${{ ! matrix.split_slow }}
    208236        run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
    209237
Note: See TracChangeset for help on using the changeset viewer.