CI means every change is checked automatically before it joins main. CD means the checked result is packaged and shipped. Around them sit three things that are easy to mix up: the tests themselves, the CI workflow files that tell GitHub to run them, and the written rules that ask people to run them. Only one of those three can stop a bad merge, and only if it is set up to.
I mapped this out at work for a web app my team maintains, to see which stages ran by themselves and which a person still did.
The words
| Term | What it means |
|---|---|
| Continuous integration (CI) | Every change is built and tested by a machine when it arrives, before it joins main. Small changes, merged often, each one proven. |
| Continuous delivery (CD) | Every green main is packaged and tried on a practice copy automatically, so a release is one button. A person still presses it. |
| Continuous deployment (also CD) | The same, but nobody presses the button. Every green change goes live by itself. It’s common for websites and rare where a mistake can damage real records. |
A standard pipeline
Most teams use this shape, even when the details vary. Prove the change, package it once, try the package somewhere safe, then release that same package. Many small teams automate the CI half and leave the CD half as a written checklist that a person follows on the server. Releases with database changes are the usual reason. They must back up, migrate and then switch over, in that order, and automating that safely needs a staging copy to rehearse on first.
How a change gets checked
The same test files run twice. First on your laptop, so problems are fixed before anyone sees them. Then on GitHub, where the result is shown on the pull request for everyone. Written rules, such as a project’s contributing guide or its instructions for an AI assistant, can only ask for the first run. Only a CI check combined with branch protection can actually refuse a merge.
Inside one CI run
- GitHub starts a fresh machine, rented for this run only.
- It checks out the code. For a pull request, that’s your branch already merged into the target, so it also catches a clash with work someone merged since you started.
- It installs everything the project needs, including an empty database.
- It runs the same checks you run on your laptop.
- It reports a tick or a cross on the pull request, then throws the machine away.
That fresh start is the point. It catches what “works on my laptop” hides: a file you forgot to commit, a package only you installed, or a test that depends on your local data.
The checks and what each catches
| Check | What it catches |
|---|---|
| Backend tests | A server rule broken, such as who may sign, void or edit a record |
| Frontend tests | A screen behaving wrongly, such as a button enabled when it shouldn’t be |
| Type checks | The wrong kind of value passed around, such as text where a number belongs |
| Lint | Likely mistakes and messy code |
| Build | Code that fails to compile for production |
| End-to-end tests | The whole app in a hidden browser: pages load, logins work |
Every test has the same three parts. Its name states the rule it checks, so a failure says which rule broke. The setup invents a small situation. The test then runs the real code on it and checks the result against what the rule expects.
Which databases the tests touch
| Database | Who uses it | Touched by tests? |
|---|---|---|
| Your development database | You, clicking through the app | Never |
| A local test database | Tests on your laptop | Yes. Each test’s rows are rolled back afterwards. |
| A throwaway database in CI | GitHub’s machine | Yes. It’s created for the run and deleted after. |
| Production | Real users | Never |
Tests bring their own invented data into a database made for them. Nothing you typed into the app, and nothing from real users, is read by a test.
What CI doesn’t do by itself
A workflow only runs when its trigger matches. If the workflow lists only main, a pull request into any other branch gets no checks at all, and your laptop is the only test. Tagging and releasing are separate steps too, and deploying is another one. A team can automate any of them, but none come free with CI.
A red cross blocks nothing unless branch protection says so
CI only reports. Merging stays possible while a check is red unless the repository’s branch protection requires the checks to pass. That setting is visible only to repository admins, so ask rather than assume.