CI/CD Pipeline
CI/CD Pipeline
The wordpress repository utilizes GitHub Actions to automate code validation, testing, and deployment. These workflows ensure that every contribution maintains high quality and that stable versions are automatically deployed to the appropriate environments.
Overview of Workflows
The following workflows are currently active in the repository:
| Workflow Name | Trigger | Purpose |
| :--- | :--- | :--- |
| PHP Lint & Style | Pull Requests, Push | Validates PHP syntax and ensures compliance with WordPress Coding Standards (WPCS). |
| Automated Testing | Pull Requests | Runs PHPUnit and integration tests to ensure core functionality remains intact. |
| Deployment | Push to main | Automates the deployment of the codebase to the production environment. |
Continuous Integration (CI)
Our CI pipeline automatically triggers on any Pull Request or push to the main and develop branches. It focuses on ensuring code health before merging.
Code Quality Checks
The pipeline uses PHPCS (PHP CodeSniffer) to verify that all code adheres to the official WordPress Coding Standards.
Usage: To run these checks locally before pushing, use:
composer run lint
Automated Testing
The testing suite runs in a containerized environment (MySQL and WordPress) to validate plugin and theme logic.
- Input: Source code and test files.
- Output: Test execution report and coverage metrics.
Continuous Deployment (CD)
The deployment workflow automates the process of pushing changes to your hosting provider. By default, this is configured to trigger only when code is merged into the main branch.
Required Repository Secrets
To enable deployment, the following GitHub Secrets must be configured in your repository settings (Settings > Secrets and variables > Actions):
| Secret Name | Description | Example/Format |
| :--- | :--- | :--- |
| FTP_SERVER | The host address of your web server. | ftp.yourdomain.com |
| FTP_USERNAME | The username for the deployment account. | deploy_user |
| FTP_PASSWORD | The password/token for the deployment account. | ******** |
| SSH_PRIVATE_KEY | (Optional) Required if using SSH/RSYNC for deployment. | -----BEGIN RSA PRIVATE KEY----- |
Deployment Process
- Build Stage: Compiles assets (JS/CSS) and installs production dependencies via Composer.
- Upload Stage: Transfers the filtered file set (excluding development tools like
.gitandnode_modules) to the server via SFTP/SSH.
# Example trigger configuration in .github/workflows/deploy.yml
on:
push:
branches:
- main
Internal Utilities
The repository includes several internal helper scripts located in .github/scripts/. While these are primarily used by the CI system to manage database migrations and environment setup, users can reference them for understanding the automated setup process.
setup-wp.sh: Internal script used to initialize the WordPress environment for headless testing.deploy-filter.txt: Defines which files are excluded from the final production build.