A build pipeline is a sequence of automated steps that takes your source code and turns it into something you can deploy — a compiled binary, a Docker image, a bundled frontend app, or any other production-ready artifact. Every step in the pipeline runs without manual intervention: code gets pulled, dependencies get installed, tests run, and if everything passes, the artifact is ready for deployment.
The term gets confused with CI/CD pipeline
constantly. Here's the distinction: a build pipeline focuses specifically on the build and validation phase — compiling code, running tests, producing artifacts. A CI/CD pipeline is broader and includes deployment, environment promotion, and monitoring on top of the build steps.
How a Build Pipeline Works
Every build pipeline follows the same core flow, regardless of the tooling:
flowchart LR
A[Code Commit] --> B[Source Checkout]
B --> C[Dependency Install]
C --> D[Compile / Bundle]
D --> E[Run Tests]
E --> F[Static Analysis]
F --> G[Build Artifact]
G --> H[Store Artifact]
Stage by Stage
1. Source checkout — The pipeline pulls the latest code from your repository. This is triggered automatically — typically by a push to a branch or a merged pull request.
2. Dependency installation — Package managers (npm install, composer install, pip install, bundle install) resolve and download everything your project needs. This step is often cached between runs to avoid re-downloading unchanged packages every time.
3. Compile or bundle — For compiled languages (Java, Go, C#, TypeScript), this is where source code becomes executable output. For frontend projects, this is where bundlers like Webpack, Vite, or esbuild produce optimized assets. Interpreted languages like Python or Ruby might skip this step entirely.
4. Run tests — Unit tests and integration tests run against the freshly built code. If any test fails, the pipeline stops here. This is the pipeline's primary quality gate — code that doesn't pass tests never makes it to an artifact.
5. Static analysis and linting — Tools like ESLint, PHPStan, RuboCop, or SonarQube scan the code for style violations, potential bugs, and security issues without actually running it. Some teams run this before tests to catch obvious problems faster.
6. Build the artifact — The output of a successful pipeline is a deployable artifact. What this looks like depends on your stack:
| Stack | Artifact |
|---|---|
| Java | JAR or WAR file |
| Node.js / Frontend | Bundled dist/ directory |
| Docker | Container image |
| .NET | Published DLL or NuGet package |
| Go | Static binary |
| PHP | Vendor-included archive |
7. Store the artifact — The artifact gets pushed to a registry or storage: Docker Hub, AWS ECR, JFrog Artifactory, Nexus, or even a simple S3 bucket. If you use GitHub and S3 as your deployment target, see how to deploy code from your GitHub repository to an Amazon S3 bucket using DeployHQ. From here, a separate deployment process picks it up.
A Real-World Example
Here's what a build pipeline looks like for a Node.js application using GitHub Actions:
# .github/workflows/build.yml
name: Build Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
Each step maps directly to the stages described above. If npm test fails, the pipeline stops — npm run build never runs, and no artifact gets produced. That's the whole point.
Build Pipeline vs. Build Server
These terms come up together but mean different things:
A build server (Jenkins, TeamCity, Bamboo, GitHub Actions runners) is the machine that executes your pipeline. It provides the CPU, memory, installed toolchains, and network access needed to run each step.
A build pipeline is the process definition — the ordered sequence of steps, their dependencies, and their success criteria. The pipeline runs on the build server.
Think of it like a recipe and a kitchen. The pipeline is the recipe (what to do, in what order). The build server is the kitchen (where it happens, with what equipment). You can run the same pipeline on different build servers — move from Jenkins to GitHub Actions, for instance — without changing what the pipeline does, only where it runs.
How to Set Up a Build Pipeline
If you don't have a build pipeline yet, here's how to approach it:
Start with what you already run manually. Every development team has some version of the steps to get the code ready.
Maybe it's npm install && npm test && npm run build. Maybe it's a Makefile. Whatever you do before deploying — that's your pipeline, just not automated yet.
Pick a pipeline runner. The most common options:
- GitHub Actions — built into GitHub, YAML-based, generous free tier
- GitLab CI/CD — built into GitLab, also YAML-based, strong Docker integration
- Bitbucket Pipelines — built into Bitbucket, simple YAML config
- Jenkins — self-hosted, maximum flexibility, steeper setup curve
- CircleCI / Travis CI — hosted services with their own configuration formats
Each of these uses a YAML file (or Jenkinsfile) to define the pipeline stages.
Define your stages explicitly. Even if you only start with install, test, build
— write it down as a pipeline config. You can add linting, security scanning, and artifact storage later. The important thing is that it runs automatically on every push.
Add caching. Dependencies don't change on every commit. Caching node_modules/, .m2/, vendor/, or __pycache__/ between runs can cut pipeline time by 50-80%.
Set up failure notifications. A build pipeline that fails silently is worse than no pipeline at all. Connect it to Slack, email, or your team's notification channel so broken builds get fixed fast.
Where Build Pipelines Fit in the Deployment Workflow
A build pipeline produces an artifact. A deployment pipeline takes that artifact and puts it on a server. These are often separate concerns — and separating them is a good practice.
flowchart LR
A[Build Pipeline] --> B[Artifact Registry]
B --> C[Deployment Tool]
C --> D[Staging]
C --> E[Production]
Tools like DeployHQ handle the deployment side: they take your code (or built artifacts), connect to your servers via SSH/SFTP/cloud APIs, and push changes to staging or production. DeployHQ's build pipeline feature lets you run build commands (like npm run build or composer install --no-dev) on DeployHQ's own build servers before deploying the result — so you get both build and deploy in one workflow without maintaining separate infrastructure.
For a hands-on walkthrough of configuring this in practice, see how to streamline your workflow with DeployHQ build pipelines. This matters when your build step produces something different from your source code. If you deploy a React app, you don't want to push the src/ directory to your server — you want the compiled build/ output. A build pipeline ensures that transformation happens consistently every time, not just when someone remembers to run it locally.
Common Mistakes
Running the entire pipeline on every file change. Use path filters to skip the pipeline when only documentation or config files change. Most pipeline tools support paths or paths-ignore filters.
No caching. A 10-minute pipeline that could be 2 minutes with dependency caching will slow your team down and waste compute resources.
Testing in the wrong order. Run fast tests first (linting, unit tests) and slow tests last (integration, E2E). If a lint error would have caught the problem in 5 seconds, there's no reason to wait 8 minutes for the full test suite to fail.
Ignoring flaky tests. A test that passes 95% of the time will fail roughly once every 20 builds. If your team starts ignoring pipeline failures because it's probably that flaky test,
the pipeline has lost its value as a quality gate.
Building differently in CI vs. locally. If npm run build produces different output on your laptop vs. in the pipeline, you'll spend hours debugging environment-specific issues. Pin your tool versions, use lock files, and match Node/Ruby/Python versions between local and CI.
Build Pipelines and DevOps
In a DevOps context, build pipelines are the automation backbone that makes continuous integration possible. Without them, continuous integration
is just developers merging code and hoping it works.
The practical impact: teams with well-configured build pipelines deploy more frequently with fewer failures. Not because the pipeline magically fixes bugs — but because it catches them within minutes of being introduced, when the developer still has the context to fix them quickly. A bug discovered 30 minutes after writing the code takes 5 minutes to fix. The same bug discovered 3 weeks later during manual QA takes hours.
Build pipelines also enable build automation tools to compile, optimize, and package code in repeatable ways that don't depend on any one developer's local environment.
FAQs
What triggers a build pipeline?
Most commonly, a git push or a pull request event. Pipelines can also be triggered on a schedule (nightly builds), manually (via a button in the CI tool), or by an external webhook.
How long should a build pipeline take? Aim for under 10 minutes for the core build-and-test cycle. Anything over 15 minutes starts hurting developer productivity — people context-switch away and lose focus. If your pipeline is slow, look at caching, parallelizing test suites, and splitting into smaller pipelines.
Do I need a build pipeline for a small project?
Yes. Even a 3-step pipeline (install → test → build) catches mistakes before they reach production. The investment is 30 minutes of setup; the payoff is every deployment being reliable instead of manual.
What's the difference between a build pipeline and a CI/CD pipeline? A build pipeline covers the build and validation steps (compile, test, produce artifact). A CI/CD pipeline adds deployment stages on top — pushing the artifact to staging, running acceptance tests, promoting to production. Every CI/CD pipeline contains a build pipeline; not every build pipeline includes deployment.
Ready to automate your build and deployment workflow? DeployHQ connects to your repository, runs your build commands, and deploys to any server — with zero-downtime deployments and automatic rollbacks. Start your free trial.
Have questions? Reach out at support@deployhq.com or find us on X (@deployhq).