A CI pipeline is the automated sequence every code change goes through before it merges: build, test, report and merge. It turns continuous integration from a team habit into a check that runs the same way every time. Keploy fits in as one of those steps, running API tests with recorded mocks on every pull request.
CI pipeline problems rarely announce themselves. A build that takes 40 minutes, a test that fails once a week for no clear reason, a merge that slips past a red check on a Friday afternoon. None of these break anything on day one. Over a few months, though, they teach a team to stop trusting the pipeline, and that’s when bugs start reaching main.
The fix is usually not a new tool. It’s a pipeline that runs the right steps in the right order, gives a clear answer quickly, and blocks the merge when the answer is no. Getting there comes down to a handful of design choices you make once and then keep honest.
What Is a CI Pipeline?
CI pipeline meaning: a CI (continuous integration) pipeline is a set of automated stages, defined in a file stored with your code, that builds and tests every change pushed to a shared repository and reports whether it’s safe to merge.
In practice, the pipeline is the part of continuous integration that a machine handles. The team agrees to merge small changes often. The pipeline then checks each of those changes the same way, every time, so nobody has to remember to run the tests.
A CI pipeline stops at a verified change that’s ready to merge. A CI/CD pipeline keeps going after that point, packaging the change and releasing it to staging or production.
|
Aspect |
CI pipeline |
CI/CD pipeline |
|
Final stage |
Merge, once the required checks pass |
Release to staging or production |
|
Output |
A built, tested change that’s safe to merge |
A deployed version of the application |
|
Ships code to users? |
No |
Yes, automatically or after an approval |
How Does a CI Pipeline Work?
Continuous integration works by turning every push into a pipeline run. When a developer pushes a commit or opens a pull request, the CI tool reads the pipeline file, starts a clean build machine (called a runner), and executes each stage in order. If a stage fails, the run stops and a failed check appears on the pull request. If everything passes, the change is cleared to merge.
Continuous Integration Pipeline Steps
Most CI pipelines follow the same five steps, whatever tool runs them. The details of the CI process vary from team to team, but the order rarely does.
1. Commit and Push
Everything starts with a commit pushed to a branch, usually followed by a pull request. That push is the trigger. Most teams run the pipeline on every pull request and again on the main branch after a merge, so both the change and the combined result get checked.
2. Build
The runner checks out the code, installs dependencies, and compiles or packages the application. This is the CI build. If the build itself fails, there’s no point running tests, so the pipeline stops here. A passing build often produces an artifact, such as a binary or container image, that later steps reuse.
3. Test
Next, the automated tests run against that build. Unit tests go first because they’re fast, followed by integration and API tests that check how the parts work together. This is where most failures surface, and our guide to continuous integration testing covers which tests belong here and how to keep them reliable.
4. Report
The pipeline then sends its result back to where developers already work. A green or red status check appears on the pull request, and the logs show exactly which step failed. Many teams also add a chat or email alert when a run fails on main.
5. Merge
Finally, the change merges, but only if the required checks passed. Branch protection rules turn those checks into quality gates, so a red pipeline actually blocks the merge instead of being something people can click past.

How to Implement Continuous Integration
If you’re setting this up from scratch, or wondering how to do continuous integration without turning it into a big project, start small. Get the first steps stable, then add more. This checklist works with any of the common continuous integration tools:
- Put the pipeline file in the repository: Version it alongside the code, so changes to the pipeline get reviewed like any other change.
- Start with build and unit tests: A pipeline that compiles the code and runs your existing unit tests on every pull request is useful on day one.
- Run it on every pull request: Running only on main means you find problems after they’ve merged, which defeats the purpose.
- Make the checks required: Turn on branch protection, so a failing pipeline blocks the merge.
- Add integration and API tests next: Mock databases and third-party services, so these tests don’t fail because a shared environment broke for unrelated reasons.
- Set a time budget: Decide how long a run is allowed to take, and treat going over it as a bug.
- Make failures visible: Post results on the pull request and alert the team as soon as main goes red.
CI Pipeline Example
Here’s a complete CI pipeline for a Node.js API, written as a GitHub Actions workflow. It runs on every pull request and every push to main. It builds the app, runs the unit tests, and then replays Keploy’s recorded API tests, with dependencies like the database mocked from the recorded calls.\
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build # remove if your project has no build step
- name: Run unit tests
run: npm test
- name: Run Keploy API tests
env:
KEPLOY_API_KEY: ${{ secrets.KEPLOY_API_KEY }}
run: |
source /dev/stdin <<<"$(curl -fsSL https://keploy.io/install.sh || echo 'echo Keploy installer download failed >&2; return 1')"
keploy test -c "node src/app.js" --delay 10
Here’s what each block does:
|
Block |
What it does |
|
on |
Runs the pipeline on every pull request and on every push to main |
|
actions/checkout |
Pulls the commit being tested onto the runner |
|
setup-node and npm ci |
Installs a fixed Node.js version and the exact dependencies from the lockfile |
|
npm run build and npm test |
The CI build and unit tests. The run stops here if either one fails |
|
Keploy step |
Installs Keploy, starts the app, and replays the recorded API tests against it with dependencies mocked |
The Keploy step assumes you’ve already recorded tests locally and committed the generated keploy folder, and it reads KEPLOY_API_KEY from your repository secrets. Keploy’s docs show the same setup for GitHub, GitLab and Jenkins, and our walkthrough on how to integrate Keploy in GitHub Actions covers recording and replay end to end.
\
Continuous Integration Best Practices
Once the pipeline runs, these practices keep it fast and trustworthy. For testing-specific advice, such as which tests to automate at each stage, see our CI/CD testing best practices.
Commit Small Changes Often
Small pull requests mean short pipeline runs and failures that point to one obvious cause. By contrast, when a 2,000-line change fails, the logs tell you very little about where to look.
Keep the Pipeline in Version Control
Store the pipeline file with the code, not in a CI tool’s settings page. As a result, every change to the pipeline gets reviewed, and you can see exactly what ran for any past commit.
Keep Builds Under 10 Minutes
Martin Fowler’s long-standing guideline is a ten-minute build, and it still holds. Past that point, developers stop waiting for results and start stacking new changes on top of unverified ones. Caching dependencies and splitting tests into parallel jobs are the usual first fixes.
Run Fast Checks First
Order the stages so the cheapest checks fail first: linting and compilation, then unit tests, then slower integration and API tests. A typo should never take 15 minutes to report.

Build Once and Reuse the Artifact
Build the binary or container image once, then pass that same artifact to every later step. Rebuilding at each stage wastes time. Worse, it means you aren’t testing exactly what you’ll ship.
Mock External Dependencies
Tests that call real third-party APIs or shared databases fail for reasons that have nothing to do with your change. To avoid that, Keploy records those calls once and replays them as mocks in CI, so API tests stay fast and give the same result on every run. Its guide on how to run mocked tests in CI shows the setup.
Quarantine or Fix Flaky Tests
Flaky tests that fail at random teach people to rerun the pipeline instead of reading it. Move a flaky test out of the required checks right away, then fix it or delete it.
Fix Broken Builds Immediately
When main goes red, fixing it comes before any new work. Otherwise, every extra commit on a broken main makes the original failure harder to trace.
Protect the Main Branch With Required Checks
Require the pipeline to pass before anything merges, and apply the rule to admins too. Without it, the pipeline is only a suggestion.
Keep Secrets Out of Pipeline Files
API keys and credentials belong in your CI tool’s encrypted secrets store, referenced by name in the pipeline file. Anything committed in plain text is readable by everyone with access to the repository.
Conclusion
My take: a CI pipeline earns trust slowly and loses it fast. Five clear steps, a time budget and required checks get you most of the way there. The rest is refusing to let flaky tests and red builds slide.
If you’re starting today, put a build and unit test job on your pull requests this week. Once that run is stable, add API tests with mocked dependencies, and only then start tuning for speed.
FAQs
How do I skip CI for a commit?
Add a skip keyword to the commit message. GitHub Actions recognizes [skip ci], [ci skip], [no ci], [skip actions] and [actions skip] for push and pull request events. GitLab accepts [skip ci] or [ci skip], plus the git push -o ci.skip option. On GitHub, a skipped run leaves required checks pending, which blocks the merge.
What is a CI build?
A CI build is the stage that compiles or packages the application on a clean machine, using only what’s in the repository. It proves the change builds outside the developer’s laptop, and it usually produces the artifact that the test stage runs against.
What is the difference between a CI pipeline and a CI/CD pipeline?
A CI pipeline ends once a change is built, tested and cleared to merge. A CI/CD pipeline adds delivery or deployment stages that package the change and release it to staging or production.
Is a CI workflow the same as a CI pipeline?
Yes, in most contexts. GitHub Actions calls the YAML file that defines a pipeline a workflow, while GitLab, Jenkins and most other tools call it a pipeline. The stages inside work the same way.
How long should a CI pipeline take?
Aim for under 10 minutes for the checks that run on every pull request. Slower suites, such as full end-to-end tests, can run on a schedule or after merge, so they don’t hold up every change.
What should run first in a CI pipeline?
The fastest checks that catch the most common mistakes: linting, formatting and compilation, followed by unit tests. Slower integration, API and end-to-end tests come after, so a simple error fails the run in seconds instead of minutes.

Leave a Reply