Every engineering team eventually has the same meeting. The build is slow, the bill for running tests has grown, and someone suggests the obvious fix: run fewer of them.
It is a reasonable suggestion and almost always the wrong one. I wrote a rule at the top of our plan before we started work on build costs this autumn: do not thin the gates. No test removed, no check skipped, no “we’ll run the full suite nightly”.
Why the rule comes first
A cost project with a target and no constraint will hit the target. That is the problem. If the instruction is “cut the bill by half”, the fastest route is to delete the slow tests, and the slow tests are slow because they exercise the parts of the system that are hard to exercise.
The rule forces a better question. Not “what can we stop checking?” but “what are we paying for that is not checking anything?”
What the measurement showed
We broke 30 days of build history down to the step. Three kinds of waste accounted for most of it.
Repeated setup. Several jobs each spent minutes installing the same dependencies. None of that time tested anything.
Jobs with no reason to run. A change to documentation triggered the full data-processing test suite.
Serial tests that did not need to be. A small number of tests could not safely run in parallel. Because nobody had listed them, everything ran one at a time. Once we named the unsafe ones and isolated them, the rest ran side by side.
Fixing those three roughly halved the billed minutes per pull request. Not one assertion changed.
Then move the work, not the standard
The remaining cost was real work: heavy jobs that need a lot of compute. For those we changed where they ran. We had capable machines sitting idle, and the same tests ran about five times faster on them than on hosted runners.
Owned hardware brings its own risk, so there is a heartbeat. If the machines stop answering, jobs return to hosted runners without anyone noticing except the invoice.
The part that applies to you
This is not really about build pipelines. Any cost review, whether cloud spend, vendor contracts or headcount, goes better with the same two steps in the same order.
First, write down what must not degrade. Be specific. Then measure where the money goes at a finer grain than you think you need.
You will usually find that the expensive part and the valuable part are different things. When they are, you can cut one and keep the other. When they are the same thing, at least you know what you are trading.