WordPress.org

Make WordPress Core

Changeset 51604


Ignore:
Timestamp:
08/11/2021 03:42:06 PM (4 months ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Simplify the PHPUnit test workflow.

This removes the previously duplicated set of test runs specifically for PHP 8.1 in favor of combining if conditions for individual test runs with the continue-on-error option.

Follow-up to [51588].

Props desrosj, swissspidy, jrf.
Fixes #53891.

File:
1 edited

Legend:

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

    r51588 r51604  
    3636jobs:
    3737  # Runs the PHPUnit tests for WordPress.
     38  #
     39  # Note: Steps running tests for PHP 8.1 jobs are allowed to "continue-on-error".
     40  # This prevents workflow runs from being marked as "failed" when only PHP 8.1 fails.
    3841  #
    3942  # Performs the following steps:
     
    189192
    190193      - name: Run slow PHPUnit tests
    191         if: ${{ matrix.php != '8.1' && matrix.split_slow }}
     194        if: ${{ matrix.split_slow }}
    192195        run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    193196
     
    201204
    202205      - name: Run PHPUnit tests
    203         if: ${{ matrix.php >= '7.0' && matrix.php != '8.1' }}
     206        if: ${{ matrix.php >= '7.0' }}
     207        continue-on-error: ${{ matrix.php == '8.1' }}
    204208        run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    205209
    206210      - name: Run AJAX tests
    207         if: ${{ matrix.php != '8.1' && ! matrix.split_slow }}
     211        if: ${{ ! matrix.split_slow }}
     212        continue-on-error: ${{ matrix.php == '8.1' }}
    208213        run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    209214
    210215      - name: Run ms-files tests as a multisite install
    211         if: ${{ matrix.php != '8.1' && matrix.multisite && ! matrix.split_slow }}
     216        if: ${{ matrix.multisite && ! matrix.split_slow }}
     217        continue-on-error: ${{ matrix.php == '8.1' }}
    212218        run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    213219
    214220      - name: Run external HTTP tests
    215         if: ${{ matrix.php != '8.1' && ! matrix.multisite && ! matrix.split_slow }}
     221        if: ${{ ! matrix.multisite && ! matrix.split_slow }}
     222        continue-on-error: ${{ matrix.php == '8.1' }}
    216223        run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
    217224
    218225      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    219226      - name: Run (xDebug) tests
    220         if: ${{ matrix.php != '8.1' && ! matrix.split_slow }}
     227        if: ${{ ! matrix.split_slow }}
     228        continue-on-error: ${{ matrix.php == '8.1' }}
    221229        run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__
    222 
    223       #### Duplicate set of test runs specifically for PHP 8.1 while WP is not yet compatible. ####
    224       # Splitting off the test runs for PHP 8.1 allows us to apply "continue-on-error" to the job steps,
    225       # which will prevent the builds from showing as "failed" when they only fail on PHP 8.1.
    226       # This block should be removed once all PHP 8.1 test failures have been fixed.
    227       # When the block is removed, the conditions in the block above should also be adjusted back
    228       # to their original values.
    229       - name: Run slow PHPUnit tests
    230         if: ${{ matrix.php == '8.1' && matrix.split_slow }}
    231         continue-on-error: true
    232         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    233 
    234       - name: Run PHPUnit tests
    235         if: ${{ matrix.php == '8.1' }}
    236         continue-on-error: true
    237         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
    238 
    239       - name: Run AJAX tests
    240         if: ${{ matrix.php == '8.1' && ! matrix.split_slow }}
    241         continue-on-error: true
    242         run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    243 
    244       - name: Run ms-files tests as a multisite install
    245         if: ${{ matrix.php == '8.1' && matrix.multisite && ! matrix.split_slow }}
    246         continue-on-error: true
    247         run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    248 
    249       - name: Run external HTTP tests
    250         if: ${{ matrix.php == '8.1' && ! matrix.multisite && ! matrix.split_slow }}
    251         continue-on-error: true
    252         run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
    253 
    254       # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    255       - name: Run (xDebug) tests
    256         if: ${{ matrix.php == '8.1' && ! matrix.split_slow }}
    257         continue-on-error: true
    258         run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__
    259       #### End of duplicate set of test runs. ####
    260230
    261231      - name: Ensure version-controlled files are not modified or deleted
Note: See TracChangeset for help on using the changeset viewer.