Our pipeline took twenty-three minutes. People pushed a commit and went for coffee, and when they came back they had forgotten what they were doing. We set a target of five minutes and reached four minutes and forty seconds. Nothing we did was clever. We measured, and we removed waste.

Why five minutes
There is a threshold at about five minutes. Below it, people wait for the result and fix problems at once. Above it, they switch to another task, and each failed build costs a second switch back. A team of eight that pushes forty times a day loses hours to this.
Step 1: measure each stage
Before we changed anything, we wrote down where the time went.
| Stage | Before |
|---|---|
| Checkout and setup | 1 min 40 s |
| Install dependencies | 4 min 10 s |
| Lint and type check | 2 min 30 s |
| Unit tests | 6 min 20 s |
| Build image | 5 min 00 s |
| Integration tests | 3 min 20 s |
Two stages made up half the time. We started with those.