What Is CI/CD? The Software Assembly Line, Explained
You and two classmates build an app for a project. Each of you codes alone for a month, and the night before the demo you combine your work: the app will not start, and nobody can tell whose change broke it. Teams that ship software daily avoid that night with a habit and some automation. This lesson answers what is CI/CD: what continuous integration, delivery and deployment mean, and what a pipeline does.
Continuous integration: merge small, test every change
Two Git terms first. A branch is a separate line of work where your commits, saved snapshots of your changes, stay apart from everyone else's. To merge is to combine one branch's commits into another. Most teams share one main branch, usually named main, which holds the code everyone has agreed on.
Without CI, people work on their own branches for weeks and merge at the end. By then the code has drifted apart: two people changed the same lines, or one used a function the other deleted. Developers call what follows "integration hell".
Continuous integration (CI) is the practice of merging small changes into the shared main branch often, at least daily. Every change triggers an automatic build and test run on a clean CI machine, as in lesson 2. If your change breaks a test, you hear soon after you push, while you still remember what you changed.
In the illustrative timeline, one big merge surfaces six defects together in week four, and each could come from any of a month's changes. With twenty small merges, each defect shows up the day its change lands. This works only for defects a test can catch, so tests come first.
Continuous delivery vs continuous deployment
CI tells you a change works with everyone else's code. The CD in CI/CD goes further, and can mean either of two practices that differ in one step.
Continuous delivery keeps every change that passes the pipeline ready to release. The pipeline builds, tests and packages it and deploys it to staging automatically; production waits until a person approves, often with one button. You could release any day, and people decide when.
Continuous deployment removes that last click: every change that passes all the gates goes to production with no human approval. It suits teams with strong automated tests and monitoring, usually backed by safety nets from later lessons, such as canary releases and feature flags.
In the diagram, look at where the green stops: CI automates the first two stages, delivery all but production, deployment all five.
Lesson 1 read CD as continuous delivery, the usual meaning, but some teams mean deployment. When someone says "we do CD", ask whether a person still approves production.
Anatomy of a pipeline
A pipeline, as lesson 2 put it, is the automated chain of build, test and deploy steps. Each stage is a gate: a check the change must pass before it moves on.
- Commit: you push a commit or open a pull request, which starts a run.
- Build: a fresh machine fetches the code, installs its dependencies and compiles it.
- Test: automated tests run, starting with unit tests, small, fast tests that each check one piece of code.
- Package: the result becomes one build artifact, such as a container image, built once and reused unchanged.
- Deploy: the artifact goes to staging and is checked, then to production.
Fast feedback means the author learns the result in minutes, not days. Fail fast means the pipeline runs quick checks first and stops at the first failed gate, so a broken change never reaches a later stage. In the flowchart, the pink arrows mark this: any failed gate stops the line, and the author fixes the change and pushes again.
What a real pipeline file looks like
Most CI systems read the pipeline from a text file in the repository, reviewed like any other change. Below is a trimmed excerpt of .github/workflows/test.yml from the public actions/checkout repository, in YAML, a plain-text settings format. You will write your own in lesson 12.
name: Build and Test
on:
pull_request:
push:
branches:
- main
- releases/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v6
with:
node-version: 24.x
- uses: actions/checkout@v7
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- run: npm test
Read it as the stages above. The on: block lists what starts a run: every pull request, and every push to main or to a release branch such as releases/v2. The build job runs on a fresh Linux machine, and each run: line is a gate: npm ci installs the exact library versions in the project's lock file, npm run build compiles the code, format-check and lint check its layout and common mistakes, and npm test runs the tests.
If one command fails, the steps after it are skipped and the run is marked failed: fail fast. The real file has more jobs, and the version numbers after @ change over time. It stops at testing; packaging and deploying come in lesson 13 and lesson 15.
What you gain, and what must come first
Teams that adopt CI/CD usually gain three things:
- Fewer big-bang merges. Code joins main in small pieces, so conflicts stay small.
- Faster feedback. A broken change is flagged soon after the push, while its author still has it in mind.
- Repeatable releases. The same scripted steps run every time, not a checklist followed by hand.
A pipeline automates checks; it cannot invent them. Three things must exist first:
- Automated tests. With none, a green tick only proves the code builds (lesson 5).
- Small pull requests. A pull request, from lesson 1, is a proposed change that teammates review before it merges. Keep them small enough to merge within a day or so.
- A shared main branch. Everyone merges into one branch often, instead of keeping branches that drift for weeks.
Add one rule from the assembly line: when the main branch fails its checks, fixing it comes before new work, with a quick fix or by reverting the change, undoing it with a new commit. If people learn to ignore red, the gates stop meaning anything.
Common tools, same idea
Three tools you will meet often:
- GitHub Actions, built into GitHub, reads YAML files in
.github/workflows. - Jenkins, an open-source automation server you run yourself, usually reads a
Jenkinsfile. - GitLab CI/CD, built into GitLab, reads
.gitlab-ci.ymlat the repository root.
Their files look different, but each answers the same questions: which events start a run, which stages run in what order, and what counts as a failure. This course uses GitHub Actions because standard GitHub-hosted runners, the machines that run each job, are free for public repositories.
Check yourself
Every passing change reaches staging automatically, and a person clicks Deploy for production. Is that continuous delivery or continuous deployment?
Continuous delivery, because a person still decides when production changes. Removing that click, so every passing change goes live on its own, would make it continuous deployment.
A developer works alone on a branch for three weeks, and the merge breaks five things. How would CI have made this easier?
With small daily merges, each break would show up within a day, in the run for the one small change that caused it. A three-week merge mixes every possible cause together.
Why does a pipeline stop at the first failed gate instead of running the remaining stages anyway?
Later stages would package or deploy a change already known to be broken, wasting time and risking users. Stopping early gives the author fast, clear feedback on what to fix.