-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Build/Test Tools: Add a workflow for the HTML API's html5lib tests. #6546
Build/Test Tools: Add a workflow for the HTML API's html5lib tests. #6546
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@desrosj Do you have time to take a look at this in case there's anything I missed? |
727acd1
to
746646f
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
746646f
to
5cdf152
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this, I've left some notes but it looks good in general.
* A change to test that the workflow triggers. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flagging this, I expect the plan is to remove this before final commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a couple of candidates to simplify and speed up the job. HTML API is relatively isolated and I'm pretty sure it could run without doing any Node.js or npm installation/setup.
- name: Set up Node.js | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried removing Docker, Node and NPM in 36e9f49, but an error was thrown due to wp-tests-config.php
being missing. The tests are run in Docker via Node. I've reverted the removal, at least for now.
- name: Install npm dependencies | ||
run: npm ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have anything else to add at this point 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started a review, but then started questioning whether a separate workflow is really necessary for this. There were a lot of small details missing here that are in the PHPUnit workflow, and it seems like all of the same conditions and steps are just repeated here.
The PHPUnit workflow already runs specific groups (ajax
, external-http
, xdebug
), has more testing configurations, and is already maintained. Is there a reason I'm missing as to why this needs to be an entirely separate workflow? There's currently only 3 test methods with 504 test assertions for the html-api-html5lib-tests
group. It seems reasonable to include them as an additional step in phpunit-tests-run.yml
.
I also noticed that 86% of the test assertions are currently skipped. Is there any way to improve this? While some tests are better than no tests at all, that's a pretty high percentage of assertions not being performed.
# The html5lib tests were introduced in WordPress 6.6. | ||
- '6.[6-9]' | ||
- '[7-9].[0-9]' | ||
- '[1-9][0-9]+.[0-9]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this range. At our current 3 major versions a year pace, we won't reach 10.0 for 11 more years. 🙈
All other workflows will need to be updated as well, and I think it's preferable to just do them all at once.
- '6.[6-9].[0-9]+' | ||
- '[7-9].[0-9]' | ||
- '[7-9].[0-9].[0-9]+' | ||
- '[1-9][0-9]+.[0-9]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, let's stop with the 7-9
pattern.
- trunk | ||
- '6.[6-9]' | ||
- '[7-9].[0-9]' | ||
- '[1-9][0-9]+.[0-9]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well.
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there reasons not to run against multisite? Or different database types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either would be valuable here since these tests are extremely close to actual unit tests. None of the HTML API code interacts with the database nor does it rely on any code which is different for multisite.
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PHP version is not being applied properly to the test environment. Every job in the workflow is running on the default version of PHP, which is currently 8.2.
LOCAL_PHP
will need to be set to ${{ matrix.php }}
so that the dotenv
package can have the right version to use.
|
||
- name: WordPress Docker container debug information | ||
run: | | ||
docker compose run --rm mysql ${{ env.LOCAL_DB_TYPE }} --version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This environment variable is not set within this workflow. The command (docker compose run --rm mysql --version
) still works and outputs debug info. But there's no database type being configured here.
# Any change to a PHP file in the HTML API should run checks. | ||
- 'src/wp-includes/html-api/**.php' | ||
- 'tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php' | ||
- 'tests/phpunit/data/html5lib-tests/**.dat' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this file should also trigger it.
- 'tests/phpunit/data/html5lib-tests/**.dat' | |
- 'tests/phpunit/data/html5lib-tests/**.dat' | |
# Changes to this file should run the tests to ensure they still run correctly. | |
- '.github/workflows/html5lib-tests.yml' |
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either would be valuable here since these tests are extremely close to actual unit tests. None of the HTML API code interacts with the database nor does it rely on any code which is different for multisite.
There's an alternative approach in #7602 leveraging the reusable phpunit tests. |
Let's close out in favor of #7602. |
This adds a GitHub workflow to run the HTML API's html5lib tests when any changes are made to the HTML API, the html5lib tests, or the html5lib data files. Runs on multiple versions of PHP.
Trac ticket: https://core.trac.wordpress.org/ticket/61209