Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Possibly not dominik-friendly but we shall see.
📝 WalkthroughWalkthroughThe workflow adds caching steps using 🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
0066052 to
7120228
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/ci.yml (2)
39-42: Missingrestore-keysfallback.Without
restore-keys, any change topnpm-lock.yamlresults in a complete cache miss with no partial restoration. Consider adding a fallback key to restore an older cache that can then be updated incrementally.Proposed fix to add restore-keys
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: path: node_modules - key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} + key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + node-modules-${{ runner.os }}-${{ runner.arch }}-
39-42: Consider extracting repeated caching logic into a composite action.The identical cache configuration is duplicated across 7 jobs. If the caching strategy changes (e.g., adding
restore-keysor adjusting the key), all instances must be updated.Consider creating a composite action or reusable workflow to centralise this logic, improving maintainability.
Also applies to: 66-69, 93-96, 126-129, 169-172, 202-205, 235-238
| - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 | ||
| with: | ||
| path: node_modules | ||
| key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
pnpm GitHub Actions cache setup best practices node_modules
💡 Result:
Best practices (pnpm + GitHub Actions caching)
- Cache the pnpm store, not
node_modules.actions/setup-nodeexplicitly does not cachenode_modules; it caches package-manager data (for pnpm: the store) instead. [1] - Use built-in caching (
actions/setup-node) whenever possible: setcache: 'pnpm'so you don’t have to hand-rollactions/cachekeys/paths. [1][2] - For monorepos / non-root lockfiles, set
cache-dependency-pathto the correctpnpm-lock.yamllocation(s), otherwise the cache key may not reflect the right dependency graph. [1] - Pin pnpm via
packageManager(or explicit action version) to keep installs reproducible across runners/over time (e.g.,pnpm/action-setup@v4+version: 10, or rely onpackageManagerinpackage.json). [3] - If you use
pnpm/action-setupcaching instead, enable its store caching (cache: true) and (for monorepos) point it at the right lockfile(s) viacache_dependency_path. [3]
Recommended workflow snippet (most common / simplest)
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v6
with:
node-version: 20
cache: pnpm
# monorepo example:
# cache-dependency-path: |
# pnpm-lock.yaml
# packages/*/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm testSources: actions/setup-node caching behavior + cache-dependency-path + “does not cache node_modules” [1]; pnpm’s GitHub Actions example using cache: "pnpm" [2]; pnpm/action-setup cache inputs (cache, cache_dependency_path) [3].
References
[1] https://github.com/actions/setup-node
[2] https://pnpm.io/next/continuous-integration
[3] https://github.com/pnpm/action-setup
🏁 Script executed:
# Find and examine the full CI workflow file to understand the context
fd "ci.yml" --type fRepository: npmx-dev/npmx.dev
Length of output: 43
🏁 Script executed:
# Now let's examine the actual workflow file
cat -n .github/workflows/ci.yml | head -50Repository: npmx-dev/npmx.dev
Length of output: 1635
🏁 Script executed:
# Also check if there are pnpm/action-setup references
rg "pnpm/action-setup" .github/workflows/ci.yml -A 2 -B 2Repository: npmx-dev/npmx.dev
Length of output: 1415
Remove the manual actions/cache step for node_modules.
The pnpm/action-setup with cache: true (line 37) already caches the pnpm store, making the separate node_modules cache (lines 39–42) redundant and potentially problematic. According to pnpm's official guidance, node_modules should not be cached directly because it contains symlinks to the pnpm store. Caching both separately creates a risk of broken symlinks if the cache restoration order or state becomes inconsistent.
The recommended approach is to rely solely on the pnpm store cache provided by pnpm/action-setup with cache: true. Remove the actions/cache step entirely.
Alternatively, consider using actions/setup-node with cache: 'pnpm' instead, which provides built-in, first-class support for pnpm caching and automatically includes the Node.js version in the cache key to prevent native module compatibility issues.
|
closing this as it conflicts with pnpm cache. ill find another way to speed things up 👍 |
Possibly not dominik-friendly but we shall see.