Continuous Integration/Continuous Deployment (CI/CD)
Vanguard uses a robust CI/CD pipeline to ensure code quality. This section covers our CI/CD practices and how to interact with them.
CI/CD Pipeline Overview
Our CI/CD pipeline is designed to automatically test, build, and deploy Vanguard with each push to the main branch or pull request. Here's an overview of the process:
- Code Push: Developer pushes code to GitHub.
- Code Quality Checks: Static analysis and style checks are performed.
- Automated Tests: GitHub Actions runs our test suite.
GitHub Actions
We use GitHub Actions for our CI/CD processes. The configuration can be found in .github/workflows/
in the repository.
Main Workflow
Our main workflow (main.yml
) includes the following jobs:
- Pest Tests: Runs our Pest test suite.
- Dusk Test: Runs our Dusk test suite.
- Duster: Checks code style using PHP_CodeSniffer.
- Static Analysis: Runs PHPStan for static code analysis.
- Rector: Automates PHP code upgrades and refactoring tasks.
Interacting with CI/CD
As a developer, you'll primarily interact with the CI/CD system when you push code or create pull requests. Here are some key points to remember:
Viewing Build Status: You can see the status of your builds directly on GitHub in the "Actions" tab.
Handling Failures: If a build fails, click on the failed job in GitHub Actions to see detailed logs and error messages.
Running Actions Locally: You can use act to run GitHub Actions locally for testing:
bashact -j test
Troubleshooting Common CI/CD Issues
Flaky Tests: If you encounter intermittently failing tests, try to reproduce locally and fix the root cause rather than simply re-running the pipeline.
Environment Variables: Ensure all necessary environment variables are correctly set in GitHub Secrets.