Skip to content

feat: cache the Vite+ toolchain in GitHub Actions - #207

Merged
fengmk2 merged 8 commits into
mainfrom
codex/cache-toolchain
Oct 19, 2026
Merged

fengmk2 merged 8 commits into
mainfrom
codex/cache-toolchain

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Fresh runners download the CLI dependencies and Node.js on each job. Add cache-toolchain: true to restore these files before installation.

The cache requires exact Vite+ and managed Node.js versions. Moving versions retain normal resolution. The installer recreates configuration and active links after restoration. Invalid caches fall back to installation. Windows restores recreate dependency junctions before validation.

The action has two independent caches:

Cache Input Cached files Restore point
Toolchain (new) cache-toolchain Vite+ CLI, its dependencies, and managed Node.js Before the installer
Project dependencies (existing) cache Package manager store or download cache Before vp install

The diagram shows fresh runners with the available caches enabled and run-install: true.

flowchart TB
  subgraph after["After"]
    direction TB
    A1[("NEW: toolchain<br/>Restore and validate")]
    A2["Install toolchain<br/>Hit: reuse files<br/>Miss: download"]
    A3[("Dependency cache<br/>Restore packages")]
    A4["vp install<br/>Use cached packages"]
    A1 --> A2 --> A3 --> A4
  end

  subgraph before["Before"]
    direction TB
    B1["Install toolchain<br/>Download files"]
    B2[("Dependency cache<br/>Restore packages")]
    B3["vp install<br/>Use cached packages"]
    B1 --> B2 --> B3
  end

  classDef newCache fill:#dafbe1,stroke:#1a7f37,color:#1f2328
  classDef existingCache fill:#ddf4ff,stroke:#0969da,color:#1f2328
  class A1 newCache
  class B2,A3 existingCache
Loading

vp install uses restored packages and downloads missing packages. Both caches default to false. cache-save controls uploads for both enabled caches after a successful job. When both caches need uploads, the post action saves them concurrently and waits for both. toolchain-cache-hit reports a validated toolchain restore. Toolchain caching applies only to GitHub Actions.

Hosted benchmark: six samples per OS, using action dc128ee and Node.js 22.23.1. The Vite+ preview is 65f9bc56f1f2d87e138013c5bcde9e7306d8eeb8.

These measurements isolate the toolchain cache: cache: false and run-install: false.

Each sample runs all three cases in one hosted job. Each case starts with an empty installation and package caches. Misses upload to GitHub's cache service; hits download from it. The uncached case alternates before or after the miss/hit pair.

These medians include the action's main and post processes. They include cache transfer, extraction, validation, and upload costs. They exclude checkout, separate correctness checks, and artifact uploads.

Runner Cache disabled Cache miss Cache hit Hit reduction Compressed cache
Linux x64 6.65 s 9.59 s 3.06 s 54.0% ~88 MiB
macOS ARM64 7.92 s 14.14 s 6.55 s 17.4% ~82 MiB
Windows x64 21.92 s 24.40 s 16.10 s 26.5% ~74 MiB

One entry per platform totals about 244 MiB (0.24 GiB) of compressed storage. These sizes exclude project dependency caches and extracted files on runners. Sizes vary with toolchain versions. Each new cache key stores a complete toolchain archive; cache hits reuse the existing entry.

Different keys and GitHub cache scopes can retain separate entries. Both cache types share the repository's Actions cache storage limit, which defaults to 10 GB. Use cache-save: false to restore without uploading new entries.

Misses cost more because they upload the cache. Results depend on runner and network conditions; caching remains opt-in. The run artifacts contain individual timings and logs.

All 54 cases check the exact versions, native binding, and formatter. The published-release run also passes cache misses and hits on all three operating systems with 1.3.0.

@fengmk2
fengmk2 added this pull request to stack #208 October 19, 2026 02:53
@fengmk2

fengmk2 commented Oct 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T03:44:12.990737Z 33d3e0d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 33d3e0d718

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from codex/setup-project-node to main October 19, 2026 03:46
@fengmk2
fengmk2 force-pushed the codex/cache-toolchain branch from 33d3e0d to 6bdb362 Compare October 19, 2026 03:49
@fengmk2
fengmk2 merged commit 03bf428 into main Oct 19, 2026
90 checks passed
@fengmk2
fengmk2 deleted the codex/cache-toolchain branch October 19, 2026 04:22
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