CI/CD for Small Teams

matt
Matthew Gros · Dec 1, 2025

TLDR

Start with GitHub Actions. Run tests on every push. Auto-deploy to staging. Manual approval for production.

CI/CD for Small Teams

Automate Everything

Manual deployments are error-prone. Let machines do it.

GitHub Actions Basics

Create .github/workflows/ci.yml:

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.3'

      - name: Install dependencies
        run: composer install

      - name: Run tests
        run: php artisan test

Add Linting

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npm ci
      - run: npm run lint

Auto-Deploy to Staging

  deploy-staging:
    needs: [test, lint]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to staging
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.STAGING_HOST }}
          username: ${{ secrets.STAGING_USER }}
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          script: |
            cd /var/www/staging
            git pull
            composer install --no-dev
            php artisan migrate --force

Production Deploy

Manual approval:

  deploy-production:
    needs: [deploy-staging]
    runs-on: ubuntu-latest
    environment: production  # Requires approval
    steps:
      - name: Deploy to production
        # Same as staging but different host

What to Run

  1. On every push: Tests, linting
  2. On PR merge to main: Deploy to staging
  3. Manual trigger: Deploy to production

Tips

  • Keep builds fast (cache dependencies)
  • Run tests in parallel
  • Fail fast - stop on first error
  • Notify on failures (Slack, email)

About the Author

matt

I build and ship automation-driven products using Laravel and modern frontend stacks (Vue/React), with a focus on scalability, measurable outcomes, and tight user experience. I’m based in Toronto, have 13+ years in PHP, and I also hold a pilot’s license. I enjoy working on new tech projects and generally exploring new technology.