Most CI/CD writing assumes a platform team, a build cluster, and someone whose whole job is the pipeline. If you’re three engineers on a shared main branch, a fair amount of that advice works against you: more gates, slower runs, and a deploy nobody fully trusts. This is the shape I keep for that situation, and the parts of it that aren’t obvious.
Trust is the metric, not speed
Speed matters, but what actually decides whether CI helps you is whether people trust it. A pipeline they trust, they wait for. One they don’t, they route around — re-running until green, merging past a “known flaky” failure, shipping on a Friday and hoping. Every decision below is really about protecting that trust, because once it’s gone you have all the cost of CI and none of the benefit.
Flaky tests are the tax that compounds
The fastest way to lose that trust is one or two flaky tests. The moment “red” sometimes means “nothing’s wrong, run it again,” red stops meaning anything — and people quietly start ignoring the real failures next to the noise. So I treat a flaky test as an incident, not an annoyance: quarantine it out of the blocking set the day it flakes, then fix or delete it that week. A small suite people believe beats a large suite they’ve trained themselves to re-run.
Make the run short enough to run locally
The number people quote is time-to-green, but the one that matters more is whether the same checks run on a laptop before the push. If npm run ci locally does what CI does, most failures never reach a runner. Order things cheapest-first so the common mistakes fail in seconds, and run independent jobs in parallel rather than in a chain.
# fail on the cheap, high-signal checks before spending minutes on the slow ones
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm run test
Cache carefully — a stale cache fails you silently
Caching is where teams quietly break their own pipeline. Too loose a key and CI restores a stale dependency or build and goes green for the wrong reason; too tight and it never hits and you’ve added complexity for nothing. Key the cache on a hash of the lockfile, not the branch, and accept that a slow honest build beats a fast one that passed against last week’s node_modules.
Gate less than you think
For a small team, a handful of gates carry their weight: lint and type-check, tests for the paths that actually page you, building the real artifact, and one dependency/secret scan. If you ship a container or a Helm chart, render it in CI and diff it — a broken template should fail there, not at apply.
Everything else — coverage thresholds, performance budgets, formatting — starts as a warning, not a blocker. A gate earns the right to block by catching a real regression first. Block on noise and people learn to override the override, which is worse than not having it.
Don’t hand a fork’s pull request your secrets
The one security footgun worth calling out: on GitHub, pull_request_target runs with your repository’s secrets in scope, and if you also check out the PR’s head you’re running a stranger’s code with your deploy credentials. For anything public, keep secrets off PR-triggered runs entirely and only expose them on protected branches. It’s an easy mistake to copy from a tutorial and a genuinely bad one to ship.
Reversibility before automation
This is the part that matters most and gets skipped. A deploy you can’t undo in one step will always feel risky, and risky deploys get batched into big scary ones. So get reversibility first: immutable artifacts tagged by commit SHA (never a moving latest), a one-command or one-revert-PR rollback, and a health check that actually gates the rollout so a bad deploy halts itself.
Only once rollback is a non-event should you automate the deploy on merge. Automating on top of an irreversible deploy doesn’t make you faster — it just lets you break production with less typing.
You probably don’t need a merge queue yet
Merge queues solve a real problem: PRs that are each green but break once combined. At three people that almost never happens, and a queue is latency and machinery you don’t need. Keep main green by making CI required and fast and rebasing before merge. Revisit when you’re landing enough changes that they start invalidating each other’s green — that’s the signal, not the headcount you wish you had.
A small team’s pipeline is working when it’s not a topic of conversation. You get there by keeping it trustworthy — fast, honest, reversible — not by adding stages.