CI and CD

Continuous Integration encourages frequent code integration with automated checks. Continuous Delivery keeps software deployable; Continuous Deployment automatically releases qualifying changes to production.

Typical stages

1. Checkout source code.

2. Install dependencies from lock files.

3. Run linting and automated tests.

4. Build an artifact or container image.

5. Scan dependencies and images.

6. Deploy to a target environment.

7. Verify health and monitor the release.

Small GitHub Actions example

name: PHP syntax check

on: [push, pull_request]

jobs:

check:

runs-on: ubuntu-latest

steps:

  • uses: actions/checkout@v4
  • uses: shivammathur/setup-php@v2

with:

php-version: '8.2'

  • run: php -l public/index.php

This checks syntax only; it is not a full production deployment pipeline. Review and pin third-party actions appropriately.

Pipeline security

  • Keep secrets in the CI platform secret manager.
  • Use least-privilege deployment identities.
  • Protect production environments with approvals when needed.
  • Keep artifacts traceable to a source revision.
  • Plan rollback and verify after deployment.

Interview practice

Explain continuous delivery versus continuous deployment. How would you roll back a failed release? How would you prevent secrets appearing in build logs?