CI/CD Pipelines
Overview
The wordpress repository utilizes GitHub Actions to automate code quality checks, security auditing, and deployment readiness. These pipelines ensure that every contribution adheres to the WordPress Coding Standards (WPCS) and maintains the integrity of the MVP architecture.
Automated Workflows
The CI/CD suite is triggered automatically under the following conditions:
- Pull Requests: Runs all linting and testing suites against the target branch.
- Pushes to
main: Executes the full build pipeline and prepares assets for staging/production. - Manual Trigger: Workflows can be initiated manually via the GitHub Actions "Run workflow" interface for specific branches.
1. PHP Code Quality & Linting
This workflow ensures that all PHP code follows the official WordPress Coding Standards to maintain consistency and prevent common syntax errors.
- Tools Used:
PHPCS(PHP CodeSniffer) with theWordPress-Coding-Standardsruleset. - Action: Runs on every push and pull request.
- Usage: If a linting error is detected, the workflow will fail, and the specific violations will be annotated directly in the PR's "Files changed" tab.
2. Static Analysis
To catch potential bugs before they reach runtime, we perform static analysis on the codebase.
- Tools Used:
PHPStan/Psalm. - Focus: Type checking, deprecated function usage, and logic inconsistencies.
- Configuration: Custom levels are defined in
phpstan.neon.dist(or equivalent) to balance strictness with development speed.
3. Automated Testing
This pipeline initializes a temporary WordPress environment (including a MySQL database) to run unit and integration tests.
- Tools Used:
PHPUnit,WP_Mock. - Input/Output:
- Input: Test suites located in the
/testsdirectory. - Output: JUnit-style test reports and code coverage percentages.
- Input: Test suites located in the
- Requirement: Ensure your functions are testable by following dependency injection patterns where possible.
4. Build and Asset Compilation
For contributions involving front-end components (themes or plugins), the build pipeline handles asset optimization.
# Example of the internal build command triggered by the pipeline
npm install
npm run build
- Optimizations: Minification of CSS/JS, image optimization, and generating dependency maps.
Configuration & Setup
To utilize the pipelines effectively in your fork or local environment, ensure the following configurations are addressed:
Required GitHub Secrets
If you are deploying or using external integrations, the following secrets must be configured in your repository settings under Settings > Secrets and variables > Actions:
| Secret Name | Description | Required For |
| :--- | :--- | :--- |
| STAGING_SERVER_SSH | SSH credentials for the staging environment. | Deployment |
| DB_PASSWORD_TEST | Password for the temporary test database. | PHPUnit Tests |
| SLACK_WEBHOOK | (Optional) Webhook for build status notifications. | Notifications |
Local Validation
Before pushing your code, it is recommended to run the checks locally to minimize CI failures:
# Run PHPCS locally
./vendor/bin/phpcs --standard=WordPress .
# Run PHPUnit tests
./vendor/bin/phpunit
Internal Workflow Components
While most workflows are automated, the following internal components assist the CI process:
setup-wp-env: An internal utility script used by GitHub Actions to scaffold the WordPress database and core files required for testing.cache-dependencies: A step that cachesnode_modulesandvendordirectories to reduce workflow execution time.