Local dev environment, lint tooling, and manual release pipeline#1035
Conversation
- Makefile with install/up/down/destroy/logs/cli/wp/seed/unseed/lint targets. - .wp-env.json spins up a disposable WordPress on http://localhost:8888 with the plugin live-mounted. - tests/dev/seed.php creates 100 randomly named posts and 100 pages tagged with _wpsc_seed meta; tests/dev/unseed.php removes only those. - tests/dev/mu-plugins/wpsc-loopback-fix.php rewrites loopback HTTP requests from http://localhost:8888 to the internal docker service, preserving the Host header so WordPress does not canonical-redirect. Needed so the preloader, WP-Cron and REST self-calls work from inside the containers. - README documents the new workflow.
Add @Package tags, replace fwrite/printf with WP_CLI methods, rename loop variables that overrode WordPress globals, and gate the scripts on WP_CLI instead of ABSPATH so output is properly escaped.
Add tools/ wrapper scripts so PHPCS only inspects changed hunks, expose them via composer scripts and the Makefile, and document the lint workflow in the README.
There was a problem hiding this comment.
Pull request overview
Adds a local development workflow for WP Super Cache using @wordpress/env and make targets, plus helper scripts for seeding content and running PHPCS/PHPCBF against changed PHP files.
Changes:
- Introduces a
Makefileand.wp-env.jsonto spin up a disposable WordPress + plugin mount via Docker/wp-env. - Adds WP-CLI dev scripts to seed/unseed content and a dev mu-plugin to fix loopback HTTP requests inside containers.
- Adds local lint tooling (
composer lint/lint-fix) to run PHPCS/PHPCBF on changed files.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tools/run-phpcs-changed.sh |
Runs PHPCS against staged/unstaged/untracked/branch PHP changes using phpcs-changed. |
tools/run-phpcbf-changed.sh |
Runs PHPCBF on the set of changed PHP files. |
tools/phpcs-wrapper.sh |
Wrapper to run PHPCS with deprecation warnings suppressed. |
tools/phpcbf-wrapper.sh |
Wrapper to run PHPCBF with deprecation warnings suppressed. |
tests/dev/seed.php |
WP-CLI eval-file script to create randomized posts/pages tagged with _wpsc_seed. |
tests/dev/unseed.php |
WP-CLI eval-file script to delete only previously seeded content. |
tests/dev/mu-plugins/wpsc-loopback-fix.php |
mu-plugin to rewrite localhost loopback requests to the internal docker service hostname. |
README.md |
Documents the Makefile-based quick start and updated linting commands. |
Makefile |
Adds wp-env lifecycle targets plus seed/unseed and lint convenience targets. |
composer.json |
Adds composer scripts for phpcs, phpcbf, lint, and lint-fix. |
.wp-env.json |
Configures wp-env mappings/config for mounting the plugin and dev mu-plugins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Replace the jetpack-changelogger release flow with two local scripts: - scripts/pre-build.sh bumps the version in readme.txt and wp-cache.php, generates a PR list for the last six months via `gh pr list`, opens readme.txt and the log in vim for manual changelog editing, then pushes a release/<version> branch and opens a PR. - scripts/build-plugin.sh rsyncs the plugin into build/wp-super-cache/ and zips it using scripts/exclude.lst (shared by rsync and zip). Remove CHANGELOG.md since readme.txt is now the single source of truth. Ignore the build/ directory.
- readme.txt: CHANGELOG.md link replaced with GitHub releases URL. - Makefile: set SHELL := /bin/bash so `read -p` works on Linux hosts where /bin/sh is dash. - scripts/pre-build.sh: use `sed -i ''` directly instead of `-i.bak && rm` so an interrupted run can't leave `.bak` files behind.
Delete the workflows and helper scripts that implemented the old Jetpack-driven release pipeline so they do not fight the new manual `make pre-build` / `make build` / `make publish` flow: - .github/workflows/autotagger.yml (tag pushes from CHANGELOG.md). - .github/workflows/autorelease.yml (GitHub release from a tag push). - .github/workflows/wp-svn-autopublish.yml (WordPress.org SVN publish). - .github/workflows/changelogger.yml (per-PR changelog entry check). - .github/files/autorelease.sh and wp-svn-autopublish.sh helpers. Add `make publish` via scripts/publish.sh: creates a GitHub release from readme.txt + build/wp-super-cache.zip, then optionally publishes to WordPress.org SVN (shallow checkout under build/svn, rsync into trunk, svn cp to tags/<version>).
Remove the composer `extra` keys that drove the deleted release workflows (autorelease, autotagger, wp-svn-autopublish, changelogger link-template, release-branch-prefix) and drop automattic/jetpack- changelogger from require-dev. Keep the changelog/ entries for the next release; they can be removed afterwards. composer.lock is now stale — run `composer update --lock` to refresh.
|
|
|
And: |
And: |
Drop the leading dot to avoid a hidden directory. Update the three places that referenced the old name (.gitattributes export-ignore, scripts/exclude.lst) and have publish.sh rsync the directory into build/svn/assets/ alongside the trunk sync, so banner/icon/blueprint updates go to WordPress.org with the same `make publish` run.
- pre-build.sh: portable in-place sed (BSD/GNU) and sort -V guard so the new version must be greater than the current Stable tag. - build-plugin.sh: enforce trunk / up-to-date / clean working tree, and prompt to confirm pre-build PR has been merged. - publish.sh: assert the Stable tag inside the built zip matches readme.txt, escape dots when matching the changelog section, and refuse to rsync --delete from an empty build dir. - run-phpcs-changed.sh: always run the branch-vs-trunk check so committed hunks are linted even with a dirty working tree. - Makefile: drop the fake Press RETURN gate; build-plugin.sh now owns it.



Summary
This PR originally added a wp-env-based dev environment; it has since grown to also replace the Jetpack-driven release automation with a local manual pipeline and add a phpcs-changed-based lint flow. The pieces are:
Local development
Makefilewraps@wordpress/envso contributors canmake install && make upto get WordPress on http://localhost:8888 with the plugin pre-mounted.make seed/make unseedcreate and safely remove 100 randomly named posts and 100 pages tagged with_wpsc_seedmeta.tests/dev/mu-plugins/wpsc-loopback-fix.phproutes PHP-side loopback requests (preloader, WP-Cron, REST self-calls) to the internal docker hostname while preserving theHost: localhost:8888header.Lint tooling
tools/phpcs-wrapper.sh/tools/phpcbf-wrapper.shandtools/run-phpcs-changed.sh/tools/run-phpcbf-changed.shdrivephpcs-changedso only edited hunks are checked.composer lint/lint-fixandmake lint/make lint-fix.Manual release pipeline (replaces Jetpack automation)
make pre-build VERSION=x.y.z— validates the version, requires trunk to be up to date withorigin/trunk, creates arelease/<version>branch, bumpsStable tag:inreadme.txtandVersion:inwp-cache.php, generates a list of PRs merged in the last six months viagh pr list, opensreadme.txt+ the PR list invimfor manual changelog editing, shows the diff, then pushes the branch and opens a PR.make build— rsyncs the plugin tree intobuild/wp-super-cache/and zips it tobuild/wp-super-cache.zipusingscripts/exclude.lst(shared by rsync and zip).make publish— creates a GitHub release (vX.Y.Z) fromreadme.txt+build/wp-super-cache.zipwith the extracted changelog as release notes, then optionally publishes to WordPress.org SVN via shallow checkout, rsync intotrunk/, and a server-sidesvn cptotags/<version>.autorelease,autotagger,wp-svn-autopublish,changelogger) and their helper scripts.composer.jsonextrakeys and theautomattic/jetpack-changeloggerdev dependency.CHANGELOG.md;readme.txtis now the single source of truth.Housekeeping
build/and the rootpackage-lock.json.Test plan
Reviewer-safe checks only —
make pre-build/make publishare excluded because they cut a real release.make install && make upsucceeds; http://localhost:8888 serves WordPress.make seedcreates 200 items;make unseedremoves only those.make cli,wp eval 'echo wp_remote_retrieve_response_code(wp_remote_get(home_url("/")));'prints200.make lintrunsphpcs-changedcleanly on a PR branch with only lint-clean changes.make buildproducesbuild/wp-super-cache/andbuild/wp-super-cache.zipwith no tests, tools, composer.*, Makefile, or README.md inside the zip.make down/make destroytear the environment down cleanly.make pre-buildandmake publishwill be exercised by the maintainer when the next release is cut.