Skip to content

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

InputTypeDefaultDescription
php-versionsstring'["8.3", "8.4"]'JSON array of PHP versions for the matrix
has-phpstanbooleantrueRun PHPStan (vendor/bin/phpstan analyse)
has-cs-fixerbooleantrueRun PHP CS Fixer (vendor/bin/php-cs-fixer fix --dry-run --diff)
has-rectorbooleanfalseRun Rector (vendor/bin/rector process --dry-run)
php-extensionsstring'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:

  1. Checkout the code.
  2. Setup PHP with the matrix version and configured extensions.
  3. Install Composer dependencies (composer install --no-interaction --prefer-dist).
  4. PHP CS Fixervendor/bin/php-cs-fixer fix --dry-run --diff (if has-cs-fixer).
  5. PHPStanvendor/bin/phpstan analyse (if has-phpstan).
  6. Rectorvendor/bin/rector process --dry-run (if has-rector).

Differences from Plugin CI

AspectPlugin CITheme CI
UI build (TypeScript/Vite)Yes (optional)No
Unit testsYes (optional)No
GitHub App authYes (optional)No
Lint commandsVia 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: inherit

With Rector enabled

yaml
jobs:
  ci:
    uses: middag-io/.github-private/.github/workflows/wp-theme-ci.yml@workflows-v1
    with:
      has-rector: true
    secrets: inherit

MIDDAG Tecnologia