Skip to content

chore(build): pin bun + CI cache hygiene#332

Merged
pftg merged 3 commits into
masterfrom
chore/pin-bun-version
May 10, 2026
Merged

chore(build): pin bun + CI cache hygiene#332
pftg merged 3 commits into
masterfrom
chore/pin-bun-version

Conversation

@pftg
Copy link
Copy Markdown
Member

@pftg pftg commented May 10, 2026

Bun Version Pinning

Why: Local bun (v1.2.2) diverged from CI's unpinned oven-sh/setup-bun@v2 action (installs latest), causing non-deterministic lockfile regeneration.

Strategy: Use bun-version: latest in CI workflows + --frozen-lockfile flag to detect drift loudly. engines.bun: ">=1.3" floor documents minimum version; if lockfile drifts, CI fails, dev rebuilds it.

Changes:

  • .github/workflows/_hugo.yml + .github/actions/setup-hugo/action.yml: Pin bun-version to latest
  • Removed fixed packageManager field (would cause churn against latest CI bun)
  • Added --frozen-lockfile to enforce lockfile immutability

CI Cache Hygiene

Why: PR #332 build logs (run 25633387289) showed all 3 cache tiers hit primary keys but build still took 84s with full cache restoration → wasted I/O.

Changes:

  1. Dropped Tier 3 entirely (public/ + hugo_stats.json caching)

    • --cleanDestinationDir wipes public/ on every build
    • Hugo regenerates hugo_stats.json each run
    • Net: pure I/O waste (~5-10s per build)
  2. Split Tier 2 into two caches for image retention across CSS/HTML edits

    • Tier 2a (image cache): resources/_gen/images, key on assets + content images only
    • Tier 2b (asset cache): resources/_gen/assets, key on themes/layouts/config
    • Result: 177 processed images now survive CSS edits without cache invalidation
  3. Removed unused HUGO_CACHEDIR

    • /tmp/hugo_cache is not used by Hugo config (no remote data fetches, no HTTP caching needed)
    • Dropped env var and cache path entry

Verification: ENVIRONMENT=production bin/hugo-build succeeds locally (1012 pages, ~35s)

Expected improvement: Warm cache builds <2m00s (baseline 2m16s from prior run)

Fixes non-deterministic lockfile regeneration caused by version drift between local bun (1.2.2) and CI's unpinned oven-sh/setup-bun@v2 (latest 1.3+). Added packageManager field to package.json (Corepack-compatible), pinned bun@1.3.0 in both CI workflows, and changed bun install to --frozen-lockfile to catch future mismatches. Regenerated bun.lockb with bun v1.3.13.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

📝 Walkthrough

Walkthrough

Bun package manager is pinned to version 1.3.0 across the project configuration. The version is declared in package.json via the packageManager field, enforced in the composite GitHub Action for Hugo setup, and used consistently in the Hugo workflow with frozen-lockfile dependency installation.

Changes

Bun Version Pinning

Layer / File(s) Summary
Package Manager Declaration
package.json
Adds packageManager: "bun@1.3.0" to declare the required Bun version.
GitHub Actions Setup
.github/actions/setup-hugo/action.yml
Configures oven-sh/setup-bun@v2 step to use pinned Bun version 1.3.0 via bun-version input.
Workflow Configuration
.github/workflows/_hugo.yml
Hugo workflow specifies Bun 1.3.0 in setup step and changes dependency installation to bun install --frozen-lockfile.

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A bunny hops through versions with care,
Pinning 1.3.0 here and there,
Frozen lockfiles keep things stable and sweet,
From package to workflow, the versions now meet! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(build): pin bun + CI cache hygiene' accurately summarizes the main changes: pinning Bun version and improving CI cache behavior through frozen lockfile enforcement.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/pin-bun-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

pftg and others added 2 commits May 10, 2026 18:18
Replace fixed bun@1.3.0 version pin with latest. The --frozen-lockfile flag already added to CI will catch any lockfile-version drift loudly. Removed packageManager field since fixed pin would create churn against latest CI bun. engines.bun floor (>=1.3) remains the safety net.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removed Tier 3 (public/ + hugo_stats.json) — wasted I/O since --cleanDestinationDir wipes public/ and Hugo regenerates hugo_stats.json on every build. Dropped HUGO_CACHEDIR (/tmp/hugo_cache) — unused by Hugo config.

Split Tier 2 into: Tier 2a (image cache, key on assets + content images only — survives CSS/HTML edits) + Tier 2b (asset compilation cache, key on themes/layouts/config — updates on build-affecting changes).

Result: 177 processed images now retain across CSS edits; ~5-10s faster warm cache builds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pftg pftg changed the title chore(build): pin bun version end-to-end chore(build): pin bun + CI cache hygiene May 10, 2026
@pftg pftg merged commit a2b96ae into master May 10, 2026
3 checks passed
@pftg pftg deleted the chore/pin-bun-version branch May 10, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant