feat: reusable ci.yml — estate CI standard (Phase 0, step 1) #19

Merged
peptiderepo merged 11 commits from claude/reusable-ci-20260616 into main 2026-06-16 12:12:07 +00:00
peptiderepo commented 2026-06-16 11:31:13 +00:00 (Migrated from github.com)

What changed

Adds .github/workflows/ci.yml as a reusable workflow_call entrypoint that every estate repo will adopt as a thin caller (Phase 0, step 1 of ADR 2026-06-16-standardized-cicd-and-testing.md).

No repo adoption in this PR — that is the rollout step.

Inputs

Input Default Description
php_versions ["8.1","8.2","8.3"] JSON PHP version matrix
tests stubs PHPUnit env: stubs / wp-framework / brain-monkey / none
enforce_300 true Fail if any tracked .php >300 lines
line_limit_paths includes Paths the 300-line rule applies to
has_js false Run JS lint
phpcs_autofix true phpcbf auto-commit on PRs

Jobs (fixed names — deploy gates on these)

lint-php / phpcs / file-size / phpunit / lint-js

Key design decisions

phpcbf auto-commit (prautoblogger gold standard): on pull_request events, phpcbf runs first and commits auto-fixable violations back to the branch via GITHUB_TOKEN. GITHUB_TOKEN commits do not trigger a new CI run. Strict PHPCS then fails only on non-auto-fixable violations. On push events the commit step is skipped.

wp-framework PHPUnit path handles all three known WP CI gotchas:

  1. Install svn (ubuntu-latest no longer ships it)
  2. skip-db-create=true (6th arg) — MySQL service pre-creates wp_tests; re-creating fails
  3. WP_CORE_DIR trailing slash — bootstrap concatenates verbatim into ABSPATH

Also included

  • .github/workflows/ci-self-test.yml: thin caller with tests: none so the reusable workflow runs on this PR
  • README.md: adoption snippet + full input reference
  • CHANGELOG.md: v1.6.0 entry

Risk flags

Low: pure YAML addition; no existing workflow modified.

Test plan

  • YAML validated: python3 -m yamllint (relaxed config, no structural errors)
  • Self-test caller exercises lint-php, phpcs, file-size (disabled), phpunit (skipped), lint-js (skipped)
  • Full integration test at pilot adoption (next step)
## What changed Adds `.github/workflows/ci.yml` as a reusable `workflow_call` entrypoint that every estate repo will adopt as a thin caller (Phase 0, step 1 of ADR `2026-06-16-standardized-cicd-and-testing.md`). **No repo adoption in this PR** — that is the rollout step. ## Inputs | Input | Default | Description | |-------|---------|-------------| | `php_versions` | `["8.1","8.2","8.3"]` | JSON PHP version matrix | | `tests` | `stubs` | PHPUnit env: `stubs` / `wp-framework` / `brain-monkey` / `none` | | `enforce_300` | `true` | Fail if any tracked .php >300 lines | | `line_limit_paths` | `includes` | Paths the 300-line rule applies to | | `has_js` | `false` | Run JS lint | | `phpcs_autofix` | `true` | phpcbf auto-commit on PRs | ## Jobs (fixed names — deploy gates on these) `lint-php` / `phpcs` / `file-size` / `phpunit` / `lint-js` ## Key design decisions **phpcbf auto-commit** (prautoblogger gold standard): on `pull_request` events, phpcbf runs first and commits auto-fixable violations back to the branch via `GITHUB_TOKEN`. GITHUB_TOKEN commits do not trigger a new CI run. Strict PHPCS then fails only on non-auto-fixable violations. On `push` events the commit step is skipped. **wp-framework PHPUnit path** handles all three known WP CI gotchas: 1. Install `svn` (ubuntu-latest no longer ships it) 2. `skip-db-create=true` (6th arg) — MySQL service pre-creates `wp_tests`; re-creating fails 3. `WP_CORE_DIR` trailing slash — bootstrap concatenates verbatim into ABSPATH ## Also included - `.github/workflows/ci-self-test.yml`: thin caller with `tests: none` so the reusable workflow runs on this PR - `README.md`: adoption snippet + full input reference - `CHANGELOG.md`: v1.6.0 entry ## Risk flags Low: pure YAML addition; no existing workflow modified. ## Test plan - YAML validated: `python3 -m yamllint` (relaxed config, no structural errors) - Self-test caller exercises lint-php, phpcs, file-size (disabled), phpunit (skipped), lint-js (skipped) - Full integration test at pilot adoption (next step)
Sign in to join this conversation.