Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try running html5lib tests efficiently. #6963

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
#
test-with-mysql:
name: PHP ${{ matrix.php }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@try/html5lib-tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated before landing.

permissions:
contents: read
secrets: inherit
Expand Down Expand Up @@ -91,6 +91,15 @@ jobs:
multisite: false
memcached: false
report: true
# Run tests for html-api-html5lib-tests once
- os: ubuntu-latest
php: '8.3'
db-type: 'mysql'
db-version: '8.0'
multisite: false
memcached: false
html-api-tests: true

with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
Expand All @@ -101,13 +110,14 @@ jobs:
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
tests-domain: ${{ matrix.tests-domain }}
report: ${{ matrix.report || false }}
html5lib-tests: ${{ matrix.html-api-tests || false }}

#
# Creates a PHPUnit test job for each PHP/MariaDB combination.
#
test-with-mariadb:
name: PHP ${{ matrix.php }}
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk
uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@try/html5lib-tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated before landing.

permissions:
contents: read
secrets: inherit
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/reusable-phpunit-tests-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ on:
required: false
type: 'string'
default: 'example.org'
html5lib-tests:
description: 'Whether to run the html5lib tests'
required: false
type: 'boolean'
default: false
report:
description: 'Whether to report results to WordPress.org Hosting Tests'
required: false
Expand Down Expand Up @@ -92,7 +97,7 @@ jobs:
# - Checks out the WordPress Test reporter repository.
# - Submit the test results to the WordPress.org host test results.
phpunit-tests:
name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.html5lib-tests && ' with html5lib tests' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }}
runs-on: ${{ inputs.os }}
timeout-minutes: 20

Expand Down Expand Up @@ -186,6 +191,22 @@ jobs:
continue-on-error: ${{ inputs.allow-errors }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http

- name: Check if the HTML API was modified
id: html-api-changes
if: ${{ inputs.html5lib-tests }}
uses: tj-actions/changed-files@cc733854b1f224978ef800d29e4709d5ee2883e4 # v45.5.5
with:
files: |
src/wp-includes/html-api/**.php
tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php
tests/phpunit/data/html5lib-tests/**.dat
.github/workflows/phpunit-tests.yml
.github/workflows/reusable-phpunit-tests-v3.yml

- name: Run html5lib tests
if: ${{ inputs.html5lib-tests && steps.html-api-changes.outputs.any_changed == 'true' }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group html-api-html5lib-tests

# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
- name: Run (Xdebug) tests
if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }}
Expand Down
Loading