Skip to content

Update ci.yml#58

Merged
Dargon789 merged 3 commits intomasterfrom
Dargon789-patch-1
Oct 22, 2025
Merged

Update ci.yml#58
Dargon789 merged 3 commits intomasterfrom
Dargon789-patch-1

Conversation

@Dargon789
Copy link
Owner

@Dargon789 Dargon789 commented Oct 22, 2025

Summary by Sourcery

Add caching for Node.js and Rust dependencies across CI jobs to speed up builds and configure a fixed node matrix for assets builds

CI:

  • Enable npm dependency caching via setup-node cache and cache-dependency-path for backend, frontend, and e2e workflows
  • Use actions/cache@v4 to persist node_modules directories in backend, frontend, and e2e jobs
  • Add actions/cache@v4 to cache Rust dependencies including cargo registry, git database, and build targets
  • Introduce a fixed Node.js version matrix for the assets build job

Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 22, 2025

Reviewer's Guide

Enhances the CI pipeline by introducing npm and Rust caches across backend, frontend, and e2e jobs, and by parameterizing the cache job matrix to improve build performance.

Flow diagram for CI job caching steps

flowchart TD
  Checkout["Checkout repository"] --> SetupNode["Set up Node.js"]
  SetupNode --> NpmCacheStep["Restore NPM cache"]
  NpmCacheStep --> NodeModulesCacheStep["Restore node_modules cache"]
  NodeModulesCacheStep --> RustCacheStep["Restore Rust dependencies cache (if applicable)"]
  RustCacheStep --> InstallDeps["Install dependencies"]
  InstallDeps --> Build["Build/Run job"]
Loading

File-Level Changes

Change Details Files
Add npm caching for backend builds
  • Enable npm cache in setup-node step with cache-dependency-path
  • Insert actions/cache step to persist backend/node_modules per matrix
.github/workflows/ci.yml
Add Rust dependencies cache
  • Use actions/cache for Cargo registry, git DB, and build target directory
  • Key cache on OS, flavor, and Cargo.lock hash for restore efficiency
.github/workflows/ci.yml
Introduce matrix for cache assets job
  • Define strategy.matrix.node in the cache assets workflow
  • Ensure consistent node version across asset caching
.github/workflows/ci.yml
Add npm caching for frontend asset builds
  • Enable npm cache in setup-node step for assets/frontend
  • Add actions/cache step to persist assets/frontend/node_modules
.github/workflows/ci.yml
Add npm caching for flavor-specific frontend jobs
  • Enable npm cache with dependency path for each flavor
  • Add actions/cache step to persist matrix-based frontend/node_modules
.github/workflows/ci.yml
Add npm caching for e2e jobs
  • Enable npm cache for e2e setup-node step
  • Insert actions/cache step to persist e2e/frontend/node_modules
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@snyk-io
Copy link

snyk-io bot commented Oct 22, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 22, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The caching steps are highly repetitive across multiple jobs—consider extracting them into a reusable workflow or composite action to DRY up the CI configuration.
  • You’re using both setup-node’s cache option and separate actions/cache for npm installs; consolidating to a single caching approach (e.g., relying on setup-node’s built-in npm cache) could simplify the workflow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The caching steps are highly repetitive across multiple jobs—consider extracting them into a reusable workflow or composite action to DRY up the CI configuration.
- You’re using both setup-node’s cache option and separate actions/cache for npm installs; consolidating to a single caching approach (e.g., relying on setup-node’s built-in npm cache) could simplify the workflow.

## Individual Comments

### Comment 1
<location> `.github/workflows/ci.yml:51-56` </location>
<code_context>
         run: echo "::set-output name=toolchain::$(cat ./rust/gbt/rust-toolchain)"
         working-directory: ${{ matrix.node }}/${{ matrix.flavor }}

+      - name: Cache Rust dependencies
+        uses: actions/cache@v4
+        with:
+          path: |
+            ~/.cargo/bin/
+            ~/.cargo/registry/index/
+            ~/.cargo/registry/cache/
+            ~/.cargo/git/db/
+            ${{ matrix.node }}/${{ matrix.flavor }}/rust/gbt/target/
+          key: ${{ runner.os }}-cargo-${{ matrix.flavor }}-${{ hashFiles('${{ matrix.node }}/${{ matrix.flavor }}/rust/gbt/**/Cargo.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-cargo-${{ matrix.flavor }}-
+            ${{ runner.os }}-cargo-
</code_context>

<issue_to_address>
**suggestion:** Rust cache includes ~/.cargo/bin/, which may not be necessary.

Caching ~/.cargo/bin/ may cause conflicts if global binaries change or if jobs need different versions. It may be safer to cache only the registry and target directories.

```suggestion
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            ${{ matrix.node }}/${{ matrix.flavor }}/rust/gbt/target/
```
</issue_to_address>

### Comment 2
<location> `.github/workflows/ci.yml:323-326` </location>
<code_context>
           cache: "npm"
           cache-dependency-path: ${{ matrix.module }}/frontend/package-lock.json

+      - name: Cache node modules for e2e
+        uses: actions/cache@v4
+        with:
+          path: ${{ matrix.module }}/frontend/node_modules
+          key: ${{ runner.os }}-e2e-${{ matrix.module }}-node-22-${{ hashFiles('${{ matrix.module }}/frontend/package-lock.json') }}
+          restore-keys: |
+            ${{ runner.os }}-e2e-${{ matrix.module }}-node-22-
+            ${{ runner.os }}-e2e-${{ matrix.module }}-
</code_context>

<issue_to_address>
**suggestion:** E2E node_modules cache key is hardcoded to node version 22.

Parameterizing the node version in the cache key will help prevent issues if the version changes or if tests are run on multiple versions.

```suggestion
          key: ${{ runner.os }}-e2e-${{ matrix.module }}-node-${{ matrix.node }}-${{ hashFiles('${{ matrix.module }}/frontend/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-e2e-${{ matrix.module }}-node-${{ matrix.node }}-
            ${{ runner.os }}-e2e-${{ matrix.module }}-
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@Dargon789 Dargon789 merged commit b38fd12 into master Oct 22, 2025
15 of 16 checks passed
@Dargon789 Dargon789 deleted the Dargon789-patch-1 branch October 22, 2025 01:27
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