Lesson 49 +20 XP

Git CI/CD

Git CI/CD

CI/CD stands for Continuous Integration and Continuous Delivery/Deployment. Git hooks into CI tools to test and ship your code automatically.

Continuous Integration (CI)

Every time you push, a server automatically:

  • Pulls your code.
  • Runs your tests.
  • Reports pass or fail.

If a change breaks something, you find out right away.

Continuous Deployment (CD)

After tests pass, the server can also:

  • Build your app.
  • Deploy it to a server or app store.
  • Publish a new version.

Popular CI/CD tools

  • GitHub Actions (built into GitHub)
  • GitLab CI (built into GitLab)
  • CircleCI
  • Travis CI

GitHub Actions

You add workflow files in a folder named .github/workflows. Each workflow runs on events like push or pull_request.

A simple workflow

name: Test
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test

This runs npm test on every push.

Why CI/CD matters

Bugs are caught early, releases are automatic, and the team trusts that a green checkmark means the code works.

TL;DR

  • CI automatically tests every push.
  • CD automatically builds and deploys after tests pass.
  • GitHub Actions runs workflows from .github/workflows.
  • CI/CD catches bugs early and ships releases faster.