Skip to content

Commit 232c30f

Browse files
Build/Test Tools: Enable running the tests on PHP 8.1.
PHP 8.1 is expected to be released at the end of November 2021. Enabling the tests to run in CI on PHP 8.1 allows us to get WordPress ready in time. As an interim measure, while working through the PHP 8.1 issues, separate conditional steps are added to run the tests on PHP 8.1 with the `continue-on-error` option. That allows the test builds to show as "successful" if all non-PHP 8.1 test runs pass. Follow-up to [51517], [51543], [51545], [51574], [51582], [51586]. Props jrf. Fixes #53891. See #53635. git-svn-id: https://develop.svn.wordpress.org/trunk@51588 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b935146 commit 232c30f

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

.github/workflows/phpunit-tests.yml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
fail-fast: false
6565
matrix:
66-
php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
66+
php: [ '5.6.20', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
6767
os: [ ubuntu-latest ]
6868
memcached: [ false ]
6969
split_slow: [ false ]
@@ -95,6 +95,7 @@ jobs:
9595
memcached: false
9696
multisite: false
9797
report: true
98+
9899
env:
99100
LOCAL_PHP: ${{ matrix.php }}-fpm
100101
LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
@@ -142,7 +143,7 @@ jobs:
142143
docker-compose run --rm php composer --version
143144
144145
# Install using `composer update` as there is no `composer.lock` file.
145-
if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then
146+
if [ ${{ env.LOCAL_PHP }} == '8.1-fpm' ]; then
146147
docker-compose run --rm php composer update --ignore-platform-reqs
147148
else
148149
docker-compose run --rm php composer update
@@ -187,7 +188,7 @@ jobs:
187188
run: npm run env:install
188189

189190
- name: Run slow PHPUnit tests
190-
if: ${{ matrix.split_slow }}
191+
if: ${{ matrix.php != '8.1' && matrix.split_slow }}
191192
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
192193

193194
- name: Run PHPUnit tests for single site excluding slow tests
@@ -199,25 +200,63 @@ jobs:
199200
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
200201

201202
- name: Run PHPUnit tests
202-
if: ${{ matrix.php >= '7.0' }}
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
203237
run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
204238

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

209244
- name: Run ms-files tests as a multisite install
210-
if: ${{ matrix.multisite && ! matrix.split_slow }}
245+
if: ${{ matrix.php == '8.1' && matrix.multisite && ! matrix.split_slow }}
246+
continue-on-error: true
211247
run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files
212248

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

217254
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
218255
- name: Run (xDebug) tests
219-
if: ${{ ! matrix.split_slow }}
256+
if: ${{ matrix.php == '8.1' && ! matrix.split_slow }}
257+
continue-on-error: true
220258
run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__
259+
#### End of duplicate set of test runs. ####
221260

222261
- name: Ensure version-controlled files are not modified or deleted
223262
run: git diff --exit-code

tools/local-env/php-config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
display_errors = On
2+
error_reporting = -1
13
upload_max_filesize = 1G
24
post_max_size = 1G

tools/local-env/phpunit-config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
display_errors = On
2+
error_reporting = -1
13
upload_max_filesize = 1G
24
post_max_size = 1G
35

0 commit comments

Comments
 (0)