Repository navigation
Conversation
Updates the runner, loads .env, and runs prepare, test, report and cleanup. The report still runs when tests fail, cleanup always runs, and a lock stops overlapping runs from cron. Fixes WordPress#260. Creates the host-tools directory from WordPress#259. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
!!!! |
The examples hardcoded /home/wptestrunner. Use /path/to/phpunit-test-runner instead, and note that the script finds the runner from its own location.
|
Thanks @ramonfincken, fair point. I took |
ekamran
left a comment
There was a problem hiding this comment.
Thanks @iarif4u, this makes the runner much easier to schedule. I re-ran all eight cases from your table with stub steps, and they match. Shellcheck is clean.
Two cases break, details inline: SSH mode, and a second runner checkout on the same host. Both suggestions are tested; with them, only those two cases change and everything else behaves the same. Happy to approve once they are in.
- With WPT_SSH_CONNECT set, run the runner steps with the local php: WPT_PHP_EXECUTABLE is the PHP on the remote test host. - Key the lock on the checkout, so a second checkout on the same host (for example one per PHP version) can run at the same time. - Show a PATH line in the cron example: cron's default PATH misses npm and composer from /usr/local/bin or nvm. - Allow .env lines that use an unset variable.
ekamran
left a comment
There was a problem hiding this comment.
Thanks @iarif4u. I re-checked 28be5d0 as a whole on macOS (bash 3.2) and Linux (bash 5.2, real flock): SSH mode runs the steps with the local php, a second checkout runs while the first is active, the same checkout is refused, a SIGTERM still runs the cleanup, and a .env with an unset variable no longer stops the script.
|
Thanks @ekamran for the approval, and for testing it on both macOS and Linux! |
Fixes #260. Fixes #259 (creates the
host-tools/directory; @aialvi agreed to the handover in #260).Purpose
Hosts say that running the runner is tedious (#257). This adds a ready-made script that runs the full cycle in one step, after the runner is set up.
What
host-tools/testrunner.shdoeshost-tools/, orWPT_RUNNER_DIR..envdoes not exist.flock), so cron runs cannot overlap.git pull --ff-only origin master. If the update fails, it warns and continues. SetWPT_SKIP_UPDATE=1to skip the update..envand runsprepare.php,test.php,report.phpandcleanup.phpwithWPT_PHP_EXECUTABLE, the same PHP that the runner uses.Differences from the example in the issue and the README:
test.phpexits with 1 when any test fails. A plainset -escript would then skip the report, so failures would never be reported.trap).The README "Script en Bash" section now points to this script. The systemd example is not changed.
Testing
I used stub
prepare/test/report/cleanup.phpfiles that exit 0 or 1:.envtest.phpfailsprepare.phpfailscleanup.phpfailsgit pullfailsContributed at WordCamp Contributor Day.