Skip to content

Commit 8df5834

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51604 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f7a7025 commit 8df5834

File tree

1 file changed

+14
-44
lines changed

1 file changed

+14
-44
lines changed

.github/workflows/phpunit-tests.yml

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ env:
3636
jobs:
3737
# Runs the PHPUnit tests for WordPress.
3838
#
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.
41+
#
3942
# Performs the following steps:
4043
# - Set environment variables.
4144
# - Sets up the environment variables needed for testing with memcached (if desired).
@@ -188,7 +191,7 @@ jobs:
188191
run: npm run env:install
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

194197
- name: Run PHPUnit tests for single site excluding slow tests
@@ -200,63 +203,30 @@ jobs:
200203
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
201204

202205
- name: Run PHPUnit tests
203-
if: ${{ matrix.php >= '7.0' && matrix.php != '8.1' }}
204-
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
205-
206-
- name: Run AJAX tests
207-
if: ${{ matrix.php != '8.1' && ! matrix.split_slow }}
208-
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
209-
210-
- name: Run ms-files tests as a multisite install
211-
if: ${{ matrix.php != '8.1' && matrix.multisite && ! matrix.split_slow }}
212-
run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
213-
214-
- name: Run external HTTP tests
215-
if: ${{ matrix.php != '8.1' && ! matrix.multisite && ! matrix.split_slow }}
216-
run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
217-
218-
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
219-
- name: Run (xDebug) tests
220-
if: ${{ matrix.php != '8.1' && ! matrix.split_slow }}
221-
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
206+
if: ${{ matrix.php >= '7.0' }}
207+
continue-on-error: ${{ matrix.php == '8.1' }}
237208
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
238209

239210
- name: Run AJAX tests
240-
if: ${{ matrix.php == '8.1' && ! matrix.split_slow }}
241-
continue-on-error: true
211+
if: ${{ ! matrix.split_slow }}
212+
continue-on-error: ${{ matrix.php == '8.1' }}
242213
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
243214

244215
- 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
216+
if: ${{ matrix.multisite && ! matrix.split_slow }}
217+
continue-on-error: ${{ matrix.php == '8.1' }}
247218
run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
248219

249220
- name: Run external HTTP tests
250-
if: ${{ matrix.php == '8.1' && ! matrix.multisite && ! matrix.split_slow }}
251-
continue-on-error: true
221+
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
222+
continue-on-error: ${{ matrix.php == '8.1' }}
252223
run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http
253224

254225
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
255226
- name: Run (xDebug) tests
256-
if: ${{ matrix.php == '8.1' && ! matrix.split_slow }}
257-
continue-on-error: true
227+
if: ${{ ! matrix.split_slow }}
228+
continue-on-error: ${{ matrix.php == '8.1' }}
258229
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
262232
run: git diff --exit-code

0 commit comments

Comments
 (0)