Cheap checks first, expensive checks last.
Each gate costs more than the one before it — order them so a cheap failure surfaces before an expensive one runs.
1
Lint~seconds
2
Unit tests1-2 min
3
Buildcompile/package
4
Integrationseveral min
5
Scanvulnerability
6
Pushonly if all pass
Same discipline as a manufacturing line's early inline quality checks — catching a defect at the first station is far cheaper than after the whole product is built.