DevOpsCI/CD pipelinesLesson 59 / 69

A GitHub Actions workflow

Fill-gap30 min

A GitHub Actions workflow

A workflow is YAML with jobs and steps:

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

The structure is a pipeline: on (when) → jobs (what, in parallel) → steps (how, in order). Add a services: block and CI gets its own PostgreSQL — that is exactly how this app's backend tests run against a real database on every push.

Write it once, and every future push is reviewed by a tireless machine.

Exercise

Write a workflow that runs the frontend's lint + build on every PR. Compare it with this repo's frontend-ci.yml.