Continuous integration and delivery are non-negotiable for modern software teams. But building an effective pipeline requires more than just running tests on every commit.
Pipeline Stages That Matter
Every team should have these stages in their pipeline:
- Lint & Style — Pint, ESLint, Prettier (under 30 seconds)
- Static Analysis — PHPStan level 6, Psalm, TypeScript strict mode
- Unit Tests — Fast tests that run in under 2 minutes
- Feature Tests — Integration tests against a real database
- Security Scan — Composer audit, npm audit, SAST tools
# Example GitHub Actions workflow for Laravel
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
steps:
- uses: actions/checkout@v4
- run: composer install
- run: php artisan test
Deployment Strategies
We use a blue-green deployment model with Laravel Envoyer. Zero-downtime deployments are achieved by running migrations before updating the symlink.
"A good CI/CD pipeline should make deploying to production feel boring. If your heart races during a deployment, your pipeline needs work."
Database Migrations in CI/CD
Always run migrations in a separate step before deploying the new code. Use php artisan migrate --force with --pretend first to preview changes.
Monitoring Deployments
After every deployment, automatically verify: health check endpoint responds 200, critical API endpoints return correct data, and error rates do not increase.