Commit 2c70b95
ci: optimize build pipeline with caching and parallelization (#2974)
## Summary
Optimizes the CI build pipeline from ~7 min to ~2.5 min (warm cache) or ~5 min (cold cache).
### What changed
**1. Cache reference types + docs** (`reference_gen/types/` + `reference_gen/gen/`)
- On cache hit, skips type extraction (86s) and doc generation (162s) entirely
- Keyed on `hashFiles('reference_gen/**')` — only regenerates when scripts, configs, or dependency versions change
- First run after merge seeds the cache; all subsequent PRs hit it
**2. Cache std-docs** (`runtime/reference/std/`)
- Skips 43 sequential JSR API fetches
- Keyed on `hashFiles('scripts/generate_std_docs.ts')`
**3. Split Lume into two builds**
- New `_config-reference.ts`: minimal config that renders only API reference pages (JSX only — no markdown-it, esbuild, tailwind, sitemap, toc, or OG images)
- CI runs reference build first, then main build with `SKIP_REFERENCE=1`
- Both write to `_site/` with `emptyDest: false`
- Main build no longer renders hundreds of API pages through the full plugin chain
**4. Eliminate redundant reference generation**
- Build step runs `deno task lume` directly instead of `deno task build` which re-ran `generate:reference`
**5. Parallelize I/O**
- afterBuild tasks (lint rule copy, LLM files, md source copy) run concurrently via `Promise.all`
- Std-docs JSR fetches batched 10 at a time instead of 43 sequential
**6. Fix `SKIP_REFERENCE` check**
- Use `=== "1"` instead of `env.has()`, which incorrectly triggered on empty strings
**7. Add build profiling** (`LUME_PROFILE=1`)
- Instruments build phases and individual processor timings
- `LUME_PROFILE=1 deno task build:light` to use locally
### Expected CI times
| Step | Before | After (warm cache) | After (cold cache) |
|------|--------|-------------------|-------------------|
| Setup + fmt + test | 20s | 20s | 20s |
| Reference types + docs | 248s | **~2s** | 248s |
| Std-docs | 15s | **~1s** | ~5s |
| Build: reference pages | _(in main build)_ | **~30-40s** | ~30-40s |
| Build: main site | 158s | **~80s** | ~80s |
| Server + link checker | 35s | 35s | 35s |
| **Total** | **~7 min** | **~2.5 min** | **~5 min** |
### New tasks
- `deno task lume:reference` — run the reference-only Lume build
- `deno task build:split` — full build using the split strategy
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Jo Franchetti <jofranchetti@gmail.com>1 parent 5533c85 commit 2c70b95
6 files changed
Lines changed: 376 additions & 110 deletions
File tree
- .github/workflows
- reference
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
36 | 49 | | |
| 50 | + | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
40 | 67 | | |
41 | 68 | | |
42 | 69 | | |
| |||
45 | 72 | | |
46 | 73 | | |
47 | 74 | | |
48 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
49 | 82 | | |
50 | 83 | | |
51 | 84 | | |
52 | 85 | | |
53 | 86 | | |
54 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
55 | 90 | | |
56 | 91 | | |
57 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
0 commit comments