Run lint, PHPUnit, and QUnit in GitHub Actions - #254
Conversation
The only CI config was a .travis.yml that has not run since Travis CI retired the free tier for public repositories, so no pull request reported any status checks and the regression tests added with recent fixes never ran automatically. - Add a GitHub Actions workflow with three jobs: lint (grunt travis:lint), phpunit (MySQL service + bin/install-wp-tests.sh + grunt travis:phpunit), and qunit (grunt qunit inside an unpacked WordPress tree so the test page can load jQuery and Underscore from wp-includes). - Add composer.json with PHPUnit and the Yoast PHPUnit Polyfills, which the WordPress test library now requires. The Grunt phpunit task runs vendor/bin/phpunit. - Add grunt-contrib-qunit and a qunit task for tests/qunit/index.html. Bump the QUnit CDN version on that page from 2.0.1 to 2.26.0, the minimum the headless runner supports. - Point the package.json test script at the real tasks. - Remove .travis.yml and swap the README badge for the Actions one. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
b0a48b1: the first run failed only in the phpunit job because ubuntu-latest no longer ships Subversion, which bin/install-wp-tests.sh uses to fetch the WordPress test library. Added an apt install step for it before the script runs. Lint and QUnit passed on the first run. |
bin/install-wp-tests.sh now takes tests/phpunit/includes from a sparse, blobless clone of the wordpress-develop mirror, so neither CI nor a local machine needs svn installed. Drops the apt step added for it, the redundant mysqli extension line, and the composer.json description. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
bcf16e8: questioned whether Subversion is really needed. It is not. bin/install-wp-tests.sh now takes tests/phpunit/includes from a sparse, blobless clone of the wordpress-develop git mirror (about 3 seconds and 2 MB; the files are byte-identical to the svn checkout). The apt step from b0a48b1 is gone, along with the redundant mysqli extension line in setup-php and the composer.json description. Verified locally: 82 PHPUnit tests pass against the git-fetched library. |
…punit - Grant the workflow token contents: read only. - Stop bin/install-wp-tests.sh downloading db.php from a personal repo's master branch; WordPress has used mysqli natively for years. - Run vendor/bin/phpunit directly in the phpunit job, which no longer needs Node or the puppeteer download that npm ci pulls in. - Exclude vendor and node_modules from the phplint task; with composer installed it was scanning 1027 third-party files alongside o2's 51. - Document the test setup in HACKING.txt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
848a336: changes from a review pass (Codex adversarial, core review, simplifier, supply-chain lenses).
|
Summary
Automattic/o2had no working CI. Its only config was a.travis.ymllast touched in 2020, and Travis stopped running it long ago, so every recent pull request reported zero status checks. The regression tests added with #249, #250, #251, and #252 never ran automatically.This adds a GitHub Actions workflow with three jobs on pull requests and pushes to
master:grunt travis:lint(PHP syntax check + JSHint), unchanged from the Travis wiring.bin/install-wp-tests.sh,grunt travis:phpunit. The WordPress test library now requires the Yoast PHPUnit Polyfills, so acomposer.jsonwith PHPUnit and the polyfills as dev deps is the minimum that lets the existing suite boot. The Grunt task now callsvendor/bin/phpunit.grunt qunittask viagrunt-contrib-qunit, run inside an unpacked WordPress tree so the existingtests/qunit/index.htmlcan keep loading jQuery and Underscore fromwp-includesas it does today. The page's QUnit CDN pin moves from 2.0.1 to 2.26.0, the oldest the headless runner supports; opening the page manually in a browser still works.Also: the
npm testscript points at the real tasks,.travis.ymlis removed, and the README badge points at the Actions workflow.Verification
Locally, on this branch:
grunt travis:lint: 80 files lint free.grunt travis:phpunitagainst MySQL 8 and WordPress 7.1: 82 tests, 143 assertions, OK.grunt qunitinside a WordPress tree: 5 tests, 0 failed.inc/tags.phpchange from Preserve encoded text when linking hashtags #249 makesTagsTest::test_tag_links_keeps_encoded_html_as_textfail. Undoing only thejs/editor/editor.jschange from Keep editor content inside the textarea #252 makes the QUnit editor test fail. Restoring each fix turns the suite green again.Out of scope on purpose: PHP/WordPress version matrix, phpcs, coverage. Single PHP 8.3 job set only.
🤖 Generated with Claude Code