流水线跑一次 12 分钟,PR 反馈太慢。逐段 profile 后压到 4 分钟,分享下都做了啥。
优化点:
- install 缓存(pnpm store)省 90s。
- Docker build 缓存(buildx gha)省 120s。
- 测试并行化(分 shard 跑)省 80s。
- lint / typecheck / build 并行 job 跑省 60s。
- 跳过无关路径的 job(paths filter)省 ~30s。
- uses: dorny/paths-filter@v3
if: github.event_name == 'pull_request'
最大的认知误区:缓存不命中等于没配。要持续监控命中率。
大家的流水线都多长?