Skip to content

Commit 89340f9

Browse files
committed
Add specific configurations for html5lib tests.
1 parent fe3bc4a commit 89340f9

File tree

2 files changed

+67
-6
lines changed

2 files changed

+67
-6
lines changed

.github/workflows/phpunit-tests.yml

+39-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
#
3737
test-with-mysql:
3838
name: PHP ${{ matrix.php }}
39-
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@trunk
39+
uses: costdev/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@add-html5lib-tests-to-phpunit-workflows
4040
permissions:
4141
contents: read
4242
secrets: inherit
@@ -51,6 +51,7 @@ jobs:
5151
tests-domain: [ 'example.org' ]
5252
multisite: [ false, true ]
5353
memcached: [ false ]
54+
html5lib-tests: [ false ]
5455

5556
include:
5657
# Include jobs for PHP 7.4 with memcached.
@@ -92,13 +93,50 @@ jobs:
9293
multisite: false
9394
memcached: false
9495
report: true
96+
# Include html5lib tests.
97+
- os: ubuntu-latest
98+
php: '7.2'
99+
db-version: '5.7'
100+
multisite: false
101+
html5lib-tests: true
102+
- os: ubuntu-latest
103+
php: '7.3'
104+
db-version: '5.7'
105+
multisite: false
106+
html5lib-tests: true
107+
- os: ubuntu-latest
108+
php: '7.4'
109+
db-version: '5.7'
110+
multisite: false
111+
html5lib-tests: true
112+
- os: ubuntu-latest
113+
php: '8.0'
114+
db-version: '5.7'
115+
multisite: false
116+
html5lib-tests: true
117+
- os: ubuntu-latest
118+
php: '8.1'
119+
db-version: '5.7'
120+
multisite: false
121+
html5lib-tests: true
122+
- os: ubuntu-latest
123+
php: '8.2'
124+
db-version: '5.7'
125+
multisite: false
126+
html5lib-tests: true
127+
- os: ubuntu-latest
128+
php: '8.3'
129+
db-version: '5.7'
130+
multisite: false
131+
html5lib-tests: true
95132
with:
96133
os: ${{ matrix.os }}
97134
php: ${{ matrix.php }}
98135
db-type: ${{ matrix.db-type }}
99136
db-version: ${{ matrix.db-version }}
100137
multisite: ${{ matrix.multisite }}
101138
memcached: ${{ matrix.memcached }}
139+
html5lib-tests: ${{ matrix.html5lib-tests }}
102140
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
103141
tests-domain: ${{ matrix.tests-domain }}
104142
report: ${{ matrix.report || false }}

.github/workflows/reusable-phpunit-tests.yml

+28-5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ on:
3535
required: false
3636
type: 'boolean'
3737
default: false
38+
html5lib-tests:
39+
description: 'Whether to run the html5lib tests'
40+
required: false
41+
type: 'boolean'
42+
default: false
3843
phpunit-config:
3944
description: 'The PHPUnit configuration file to use'
4045
required: false
@@ -80,7 +85,7 @@ jobs:
8085
# - Checks out the WordPress Test reporter repository.
8186
# - Submit the test results to the WordPress.org host test results.
8287
phpunit-tests:
83-
name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
88+
name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.html5lib-tests && ' (html5lib tests only)' || '' }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
8489
runs-on: ${{ inputs.os }}
8590
timeout-minutes: 20
8691

@@ -156,19 +161,37 @@ jobs:
156161
run: npm run env:install
157162

158163
- name: Run PHPUnit tests
164+
if: ${{ ! inputs.html5lib-tests }}
159165
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
160166

161167
- name: Run AJAX tests
168+
if: ${{ ! inputs.html5lib-tests }}
162169
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
163170

164171
- name: Run ms-files tests as a multisite install
165-
if: ${{ inputs.multisite }}
172+
if: ${{ inputs.multisite && ! inputs.html5lib-tests }}
166173
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files
167174

168175
- name: Run external HTTP tests
169-
if: ${{ ! inputs.multisite }}
176+
if: ${{ ! inputs.multisite && ! inputs.html5lib-tests }}
170177
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http
171178

179+
- name: Check if the HTML API was modified
180+
id: check-for-html-api-changes
181+
if: ${{ inputs.html5lib-tests }}
182+
uses: tj-actions/changed-files@v44
183+
with:
184+
files: |
185+
src/wp-includes/html-api/**.php
186+
tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php
187+
tests/phpunit/data/html5lib-tests/**.dat
188+
.github/workflows/phpunit-tests.yml
189+
.github/workflows/reusable-phpunit-tests.yml
190+
191+
- name: Run html5lib tests
192+
if: ${{ inputs.html5lib-tests && steps.check-for-html-api-changes.outputs.any_changed == 'true' }}
193+
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group html-api-html5lib-tests
194+
172195
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
173196
- name: Run (Xdebug) tests
174197
if: ${{ inputs.php != '8.3' }}
@@ -178,15 +201,15 @@ jobs:
178201
run: git diff --exit-code
179202

180203
- name: Checkout the WordPress Test Reporter
181-
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report }}
204+
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report && ! inputs.html5lib-tests }}
182205
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
183206
with:
184207
repository: 'WordPress/phpunit-test-runner'
185208
path: 'test-runner'
186209
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
187210

188211
- name: Submit test results to the WordPress.org host test results
189-
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report }}
212+
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report && ! inputs.html5lib-tests }}
190213
env:
191214
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
192215
run: docker compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php

0 commit comments

Comments
 (0)