diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 50e4c940c2169..024b406876e59 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -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 permissions: contents: read secrets: inherit @@ -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 }} @@ -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 permissions: contents: read secrets: inherit diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 5acdbae89c338..95105028829d7 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -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 @@ -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 @@ -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 settings in phpunit.xml.dist. - name: Run (Xdebug) tests if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }}