Skip to content

CI: cache the Puppeteer/Chromium download in the mermaid job#9

Merged
grammy-jiang merged 1 commit into
masterfrom
claude/pre-commit-hooks-setup-2sc78y
Jul 20, 2026
Merged

CI: cache the Puppeteer/Chromium download in the mermaid job#9
grammy-jiang merged 1 commit into
masterfrom
claude/pre-commit-hooks-setup-2sc78y

Conversation

@grammy-jiang

Copy link
Copy Markdown
Owner

What

The mermaid job installed @mermaid-js/mermaid-cli fresh each run, and its Puppeteer dependency re-downloaded Chromium every time (~hundreds of MB). This caches it:

  • Pin the mermaid-cli version (MERMAID_CLI_VERSION: "11.16.0") so the cache key is stable.
  • Cache ~/.cache/puppeteer (where Puppeteer stores the browser) keyed on runner.os + that version. On a cache hit, the install's postinstall finds the browser and skips the download.
  • Bump MERMAID_CLI_VERSION to refresh the browser (the key changes → cache miss → re-download + re-save).

Notes

  • The first run after this lands is still a cache miss (it populates the cache); the speed-up shows on subsequent runs.
  • Cache scope: the browser is version-keyed, so a mermaid-cli bump correctly invalidates it rather than serving a stale Chromium.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn


Generated by Claude Code

The mermaid job installed @mermaid-js/mermaid-cli fresh each run, and its
Puppeteer dependency re-downloaded Chromium every time (~hundreds of MB).
Cache it:

- Pin the mermaid-cli version (MERMAID_CLI_VERSION: "11.16.0") so the browser
  cache key is stable and knowable before install. npm's floating `@11` resolves
  to a list of versions, so a runtime-resolved key would be fragile; pinning
  makes the key deterministic and a version bump the single, explicit way to
  refresh the cached browser.
- Cache ~/.cache/puppeteer (where Puppeteer stores the browser) keyed on
  runner.os + that version, before the install step. On a cache hit the
  postinstall finds the browser and skips the download.

Rebased onto the uv-managed CI: the cache step slots ahead of the existing
`npm install -g` in the mermaid job, leaving the uv-based lint / egress /
test jobs untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn
@grammy-jiang
grammy-jiang force-pushed the claude/pre-commit-hooks-setup-2sc78y branch from 8b1d50b to 8a19470 Compare July 20, 2026 00:24
@grammy-jiang
grammy-jiang merged commit 33f08ce into master Jul 20, 2026
13 of 14 checks passed
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.

2 participants