feat: add dependency caching to GitHub Action workflows#1589
feat: add dependency caching to GitHub Action workflows#1589giwaov wants to merge 1 commit intogenlayerlabs:mainfrom
Conversation
- Add npm cache to frontend-unit-tests.yml (setup-node with cache-dependency-path) - Add pip cache to genvm-lint.yml (setup-python with cache: pip) - Add npm cache to release-from-main.yml (setup-node with cache: npm) These changes reduce CI run times by caching pip and npm dependencies between runs. Closes genlayerlabs#330
📝 WalkthroughWalkthroughUpdated three GitHub Actions workflows to enable dependency caching: npm caching for Node.js jobs in frontend-unit-tests and release-from-main workflows, and pip caching for the Python setup in the genvm-lint workflow. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release-from-main.yml:
- Line 30: The workflow enables actions/setup-node caching but doesn't point to
the frontend package files and later runs npm install at the repo root; update
the actions/setup-node step to include cache-dependency-path: "./frontend" and
ensure the release install step runs in the frontend folder (either add
working-directory: ./frontend to the run step or change the install command to
use npm --prefix ./frontend install and npm --prefix ./frontend install
`@semantic-release/`...). This fixes the cache key lookup and prevents npm install
from running where package.json is missing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f5f933a2-a057-4758-90d5-d264eb89ff2b
📒 Files selected for processing (3)
.github/workflows/frontend-unit-tests.yml.github/workflows/genvm-lint.yml.github/workflows/release-from-main.yml
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: "lts/*" | ||
| cache: "npm" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Checking root-level npm lockfiles expected by setup-node cache..."
fd -HI '^(package-lock\.json|npm-shrinkwrap\.json)$' .
echo
echo "Inspecting release workflow setup-node block..."
rg -n -C3 'name: Setup Node\.js|cache: "npm"|cache-dependency-path|npm install `@semantic-release`' .github/workflows/release-from-main.ymlRepository: genlayerlabs/genlayer-studio
Length of output: 773
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Checking for root-level package.json..."
if [ -f package.json ]; then
echo "ROOT package.json found."
head -20 package.json
else
echo "ROOT package.json NOT found."
fi
echo
echo "Checking for frontend-level package.json..."
if [ -f frontend/package.json ]; then
echo "FRONTEND package.json found."
head -20 frontend/package.json
else
echo "FRONTEND package.json NOT found."
fi
echo
echo "Full listing of package-lock.json locations..."
find . -name "package-lock.json" -o -name "npm-shrinkwrap.json" 2>/dev/nullRepository: genlayerlabs/genlayer-studio
Length of output: 1203
The release workflow will fail at the npm install step.
Line 30 enables npm caching without specifying cache-dependency-path, and line 32 attempts to run npm install at the repository root. However, there is no package.json at the root—all dependencies are defined in ./frontend/package.json. The workflow will fail because:
actions/setup-nodesearches forpackage-lock.jsonat the repository root by default (cache key miss)npm install@semantic-release/...at root will fail: nopackage.jsonexists there
Fix: Either add cache-dependency-path: "./frontend" to the setup-node step (line 30), or reorganize the release dependencies to the root.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/release-from-main.yml at line 30, The workflow enables
actions/setup-node caching but doesn't point to the frontend package files and
later runs npm install at the repo root; update the actions/setup-node step to
include cache-dependency-path: "./frontend" and ensure the release install step
runs in the frontend folder (either add working-directory: ./frontend to the run
step or change the install command to use npm --prefix ./frontend install and
npm --prefix ./frontend install `@semantic-release/`...). This fixes the cache key
lookup and prevents npm install from running where package.json is missing.
MuncleUscles
left a comment
There was a problem hiding this comment.
LGTM — good CI optimization, thanks!
|
Both CI failures are unrelated to this PR's changes - they're upstream config issues:
Actual unit tests passed in both jobs. |
Summary
Adds dependency caching to GitHub Action workflows that were missing it, reducing CI run times by avoiding redundant dependency downloads.
Changes
Already cached (no changes needed)
Related Issue
Closes #330
Summary by CodeRabbit