WordPress Theme CI
Reusable continuous integration pipeline for WordPress themes. Focuses on static analysis and PHP code formatting — does not include front-end builds or unit tests.
Trigger
yaml
on:
workflow_call:Called via uses: from the theme repository's CI workflow.
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
php-versions | string | '["8.3", "8.4"]' | JSON array of PHP versions for the matrix |
has-phpstan | boolean | true | Run PHPStan (vendor/bin/phpstan analyse) |
has-cs-fixer | boolean | true | Run PHP CS Fixer (vendor/bin/php-cs-fixer fix --dry-run --diff) |
has-rector | boolean | false | Run Rector (vendor/bin/rector process --dry-run) |
php-extensions | string | 'mbstring, xml' | PHP extensions to install |
Secrets
No secrets are required. The workflow uses the default GITHUB_TOKEN.
Job: php — PHP Matrix
Runs on ubuntu-latest for each PHP version in the matrix:
- Checkout the code.
- Setup PHP with the matrix version and configured extensions.
- Install Composer dependencies (
composer install --no-interaction --prefer-dist). - PHP CS Fixer —
vendor/bin/php-cs-fixer fix --dry-run --diff(ifhas-cs-fixer). - PHPStan —
vendor/bin/phpstan analyse(ifhas-phpstan). - Rector —
vendor/bin/rector process --dry-run(ifhas-rector).
Differences from Plugin CI
| Aspect | Plugin CI | Theme CI |
|---|---|---|
| UI build (TypeScript/Vite) | Yes (optional) | No |
| Unit tests | Yes (optional) | No |
| GitHub App auth | Yes (optional) | No |
| Lint commands | Via composer check:* | Via direct binaries (vendor/bin/*) |
Usage example
yaml
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
ci:
uses: middag-io/.github-private/.github/workflows/wp-theme-ci.yml@workflows-v1
with:
has-phpstan: true
has-cs-fixer: true
secrets: inheritWith Rector enabled
yaml
jobs:
ci:
uses: middag-io/.github-private/.github/workflows/wp-theme-ci.yml@workflows-v1
with:
has-rector: true
secrets: inherit