A CI pipeline that finishes in five minutes

From twenty-three minutes to under five, with caching, parallel jobs and a little less work.

A CI pipeline that finishes in five minutes

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.

A slow pipeline costs more than compute. It breaks concentration.
A slow pipeline costs more than compute. It breaks concentration.

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.

StageBefore
Checkout and setup1 min 40 s
Install dependencies4 min 10 s
Lint and type check2 min 30 s
Unit tests6 min 20 s
Build image5 min 00 s
Integration tests3 min 20 s

Two stages made up half the time. We started with those.

Great! Check your inbox and click the link to confirm.