CI/CD

GitHub Actions pipeline for testing, building, and deploying

CI/CD Pipeline

The backend includes a GitHub Actions pipeline that runs on every push to main.

Pipeline Overview

Push to main
    │
    ▼
┌─────────┐     ┌────────────┐     ┌──────────┐
│  Test    │ ──▶ │ Build Prod │ ──▶ │  Deploy  │
└─────────┘     └────────────┘     └──────────┘

Stage 1: Test

Builds the dev Docker image and runs the full quality suite with PostgreSQL 16 and Redis 7 services:

  1. Validate composer.json
  2. Check composer.lock — verifies lock file is up to date
  3. Security audit for known vulnerabilities
  4. Install dependencies
  5. Set up test database (PostgreSQL + migrations)
  6. Generate JWT keys
  7. Run unit tests
  8. Run functional tests
  9. PHPStan static analysis
  10. PHP CS Fixer check (dry-run)

Stage 2: Build Production Image

Runs only if all tests pass. Builds the frankenphp_prod Docker target and pushes to GitHub Container Registry (ghcr.io/{owner}/{repo}:main).

Stage 3: Deploy

Sends a POST request to the Dokploy webhook URL. Dokploy pulls the new image and restarts the application.

Required GitHub Secrets

SecretDescription
DOKPLOY_WEBHOOK_URLDokploy deployment webhook URL

GITHUB_TOKEN is automatically provided by GitHub Actions for pushing to GHCR.

Running Checks Locally

Before pushing, run the same checks the CI runs:

make test       # Tests
make phpstan    # Static analysis
make csfix      # Code style (auto-fix)

If make csfix changes any files, commit them before pushing — the CI runs CS Fixer in dry-run mode.