Skip to content

feat: add dependency caching to GitHub Action workflows#1589

Open
giwaov wants to merge 1 commit intogenlayerlabs:mainfrom
giwaov:feat/330-add-github-action-caching
Open

feat: add dependency caching to GitHub Action workflows#1589
giwaov wants to merge 1 commit intogenlayerlabs:mainfrom
giwaov:feat/330-add-github-action-caching

Conversation

@giwaov
Copy link
Copy Markdown

@giwaov giwaov commented Apr 7, 2026

Summary

Adds dependency caching to GitHub Action workflows that were missing it, reducing CI run times by avoiding redundant dependency downloads.

Changes

  • frontend-unit-tests.yml: Added npm cache via \�ctions/setup-node\ with \cache-dependency-path: frontend/package-lock.json\
  • genvm-lint.yml: Added pip cache via \�ctions/setup-python\ with \cache: pip\
  • release-from-main.yml: Added npm cache via \�ctions/setup-node\ with \cache: npm\

Already cached (no changes needed)

  • .pre-commit.yml\ - pip + npm cache
  • \�ackend_integration_tests_pr.yml\ - pip + Docker buildx + GenVM cache
  • \docker-build-and-push-image.yml\ - Docker buildx cache
  • \unit-tests-pr.yml\ (backend job) - pip cache

Related Issue

Closes #330

Summary by CodeRabbit

  • Chores
    • Optimized the overall build infrastructure by enabling dependency caching mechanisms across multiple Node.js and Python runtime environments, improving continuous integration and continuous deployment pipeline performance and reliability. These infrastructure optimizations reduce overall build execution times, streamline development and release workflows, and enhance development productivity without affecting user-facing functionality or features.

- 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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Updated 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

Cohort / File(s) Summary
GitHub Actions Caching Configuration
.github/workflows/frontend-unit-tests.yml, .github/workflows/genvm-lint.yml, .github/workflows/release-from-main.yml
Enabled dependency caching across three workflows: npm cache with scoped dependency path for frontend tests and release workflows, and pip cache for linting workflow.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Caching makes the workflows fly,
No more downloads, oh my, oh my!
Swift npm and pip so keen,
Fastest builds the CI's seen!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides a clear summary of changes and related issue but lacks sections from the template like 'What', 'Why', 'Testing done', and 'Decisions made'. Expand the description to include 'What' (detailed change list), 'Why' (motivation), 'Testing done' (verification steps), and complete the 'Checks' section.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding dependency caching to GitHub Action workflows.
Linked Issues check ✅ Passed The PR successfully implements caching for npm and pip in three workflows as required by issue #330, reducing CI runtime and redundant dependency downloads.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing dependency caching in GitHub Action workflows as specified in issue #330; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between cd554a6 and 62562bb.

📒 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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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.yml

Repository: 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/null

Repository: 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:

  1. actions/setup-node searches for package-lock.json at the repository root by default (cache key miss)
  2. npm install @semantic-release/... at root will fail: no package.json exists 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.

Copy link
Copy Markdown
Member

@MuncleUscles MuncleUscles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — good CI optimization, thanks!

@giwaov
Copy link
Copy Markdown
Author

giwaov commented Apr 9, 2026

Both CI failures are unrelated to this PR's changes - they're upstream config issues:

  • backend-unit-tests / SonarCloud Scan: Project not found - the project key yeagerai_genlayer-simulator isn't resolving. Likely a SonarCloud org/token config issue.
  • frontend / Codecov Upload: Token required - not valid tokenless upload - Codecov token isn't available for fork PRs.

Actual unit tests passed in both jobs.

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.

SIM-OPS-Use cache for GitHub Action

2 participants