Module 4 · Project 04 · Build Your First CI Pipeline · Lesson 15 of 48

What CI is and how a workflow is built

Continuous integration, and the parts of a GitHub Actions workflow: triggers, jobs, steps and runners.

In this lesson · about 25 minutes

  • Explain continuous integration and why teams use it
  • Read a GitHub Actions workflow: on, jobs, runs-on, steps, uses and run
  • Write a workflow that installs, lints, tests and builds

Continuous integration

When several people change the same code, mistakes hide until someone merges, and then everything breaks at once. Continuous integration (CI) means every push is automatically checked: the code is installed, linted, tested and built on a clean machine, and the result shows up on the pull request within minutes. Broken changes are caught while they're small and fresh in the author's mind.

The parts of a pipeline

  • Trigger: what starts it, such as a push or a pull request.
  • Runner: the machine that does the work, a fresh virtual machine or container each time.
  • Jobs: groups of steps. Jobs run in parallel unless one needs another.
  • Steps: individual commands, or ready-made actions such as "check out the code".
  • Artifact: a file the pipeline produces and keeps, such as a build or a test report.

We'll use GitHub Actions because it's free for public repos and lives next to your code. Jenkins and GitLab CI use the same ideas with different syntax.

# .github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4             # get the code
      - uses: actions/setup-node@v4           # install Node
        with:
          node-version: 22
          cache: npm                          # cache downloaded packages
      - run: npm ci                           # install exact versions
      - run: npm run lint
      - run: npm test
      - run: npm run build
      - uses: actions/upload-artifact@v4      # keep the build
        with:
          name: app-build
          path: dist/

Each run step is a shell command; if it exits with a non-zero code (remember Project 01?), the step fails, the job fails, and the pull request shows a red ✗.

Try it · watch it run

Watch a CI pipeline run

Push and watch the jobs run. Then push a lint error or a failing test, and try turning caching and parallel jobs off and on to see the run time change.

expected run time 0m 57s
○ Check out code3s
→
○ Install dependencies6s
→
○ Lint12s
○ Unit tests (3 shards in parallel)22s
→
○ Build22s
→
○ Upload artifact4s

Whiteboard · watch and try

From push to green check

Press Play to see what happens after git push.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Hands-on lab (simulated terminal)

Lab: your first workflow

A repo with the notes app and the ci.yml above. You're using the GitHub CLI (gh).

Step 1 of 5. Type each command and press Enter. Nothing runs on your computer.

Lab: your first workflow

1. Create a branch called add-ci.

you@laptop:~/notes-app$

Check your understanding0 of 3 correct

Question 1

1.What is the main goal of continuous integration?

Question 2

2.Why must a CI job install dependencies every time?

Question 3

3.A run step's command exits with code 1. What happens?

Key terms

Say the meaning to yourself, then tap a card to check.

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.