CLDSRV-955: Cache node_modules instead of yarn download cache#6227
CLDSRV-955: Cache node_modules instead of yarn download cache#6227tcarmet wants to merge 2 commits into
Conversation
Replace `cache: yarn` (which only caches the yarn download dir) with an actions/cache on node_modules keyed by the yarn.lock hash, and make the yarn install / typescript steps conditional on a cache miss. Because the git dependencies compile TypeScript at install time, a warm cache now skips the clone, tsc build and relink entirely. Applied to the setup-ci composite action (used by all functional jobs) and the lint, async-migration-report, unit-tests and cleanup-gcp-buckets jobs.
Hello tcarmet,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
@@ Coverage Diff @@
## development/9.3 #6227 +/- ##
===================================================
+ Coverage 84.93% 84.99% +0.05%
===================================================
Files 206 206
Lines 13366 13366
===================================================
+ Hits 11353 11360 +7
+ Misses 2013 2006 -7
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
The prettier check formats whole changed files; touching action.yaml brought its pre-existing double-quoted name/description into scope. Reformat them to single quotes to match the prettier style.
| uses: actions/cache@v4 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} |
There was a problem hiding this comment.
The cache key doesn't include the Node.js version. Since this project has native addons (leveldown, node-gyp-build), a Node version bump (e.g. 22.23.1 → 22.x.y) without a yarn.lock change would serve node_modules compiled for the old version, risking segfaults or load failures.
The comment on line 33 already notes native addons as the reason for including runner.os — the same reasoning applies to the Node version. Same fix needed in tests.yaml (lines 94, 142, 162, 1117).
| key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} | |
| key: ${{ runner.os }}-node-22.23.1-modules-${{ hashFiles('yarn.lock') }} |
Speeds up CI by caching the installed dependency tree between runs instead of only the package-manager download cache. Because several dependencies compile TypeScript at install time, previous runs re-cloned, recompiled and relinked them on every job despite a "cache hit"; now a warm cache skips that work entirely and jobs reuse the prior install.
Measured impact (warm run vs a development/9.3 baseline)
lintunit-testsfile-ft-testssetup-cicomposite action).${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}; a lockfile bump invalidates it and the next run repopulates.See the pinned comparison comment for full details.