Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Aug 11, 2025

Summary

  • add cache-yarn, cache-bundler, cache-gradle, and cache-pods composite actions
  • replace direct actions/cache usage with shared actions in mobile workflows
  • document caching policy in AGENTS instructions

Testing

  • yarn lint
  • yarn build
  • yarn workspace @selfxyz/contracts build (fails: HH8 config error)
  • yarn types
  • yarn workspace @selfxyz/common test
  • yarn workspace @selfxyz/circuits test (fails: Unsupported signature algorithm: undefined)
  • yarn workspace @selfxyz/mobile-app test
  • yarn workspace @selfxyz/mobile-sdk-alpha test

https://chatgpt.com/codex/tasks/task_b_6899342965d4832d857774a75648463e

Summary by CodeRabbit

  • Chores

    • Introduced shared composite actions to standardize dependency caching (Yarn, Bundler, Gradle, CocoaPods) across mobile CI.
    • Updated mobile deploy and E2E workflows to use unified, lock-file–based cache versioning and local caching actions; mobile dependency installation now uses the local setup action.
  • Documentation

    • Added CI caching guidance with examples recommending the shared actions and added formatting guidance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Warning

Rate limit exceeded

@transphorm has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8b23713 and 53f5df9.

📒 Files selected for processing (1)
  • .github/workflows/mobile-e2e.yml (3 hunks)

Walkthrough

Adds four new composite GitHub Actions for caching (Yarn, Bundler, CocoaPods, Gradle), updates mobile CI workflows to use these local actions and a local mobile-setup action, and documents the shared caching guidance and formatting rules in AGENTS.md.

Changes

Cohort / File(s) Summary
New composite cache actions
.github/actions/cache-yarn/action.yml, .github/actions/cache-bundler/action.yml, .github/actions/cache-pods/action.yml, .github/actions/cache-gradle/action.yml
Add composite actions that wrap actions/cache@v4 with standardized inputs (path, lock-file where applicable, cache-version), consistent cache key construction using OS + cache-version + lock-file hashes, and defined restore-keys/outputs.
Workflow updates: mobile deploy
.github/workflows/mobile-deploy.yml
Replace direct actions/cache@v4 uses with local composite cache actions for Yarn, Bundler, Pods, Gradle; switch Install Mobile Dependencies to ./.github/actions/mobile-setup; supply cache-version and lock-file inputs where applicable.
Workflow updates: mobile E2E
.github/workflows/mobile-e2e.yml
Swap CI caching steps to local composite cache actions for Android (Gradle) and iOS (Bundler, Pods); retain Xcode cache step.
Docs
AGENTS.md
Add CI caching guidance recommending the local composite actions, document inputs (cache-version patterns), and add formatting/line-ending guidance.

Sequence Diagram(s)

sequenceDiagram
  participant WF as Workflow (mobile-*)
  participant Local as Local composite action (.github/actions/cache-*)
  participant Cache as actions/cache@v4

  WF->>Local: uses ./.github/actions/cache-*
  Local->>Cache: run cache step (with path, key, restore-keys)
  Cache-->>Local: returns cache-hit / restored files
  Local-->>WF: expose outputs (cache-hit) and restore files for job
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • remicolin

Poem

Cache actions hum, keys neatly spun,
Lockfiles guide each versioned run.
Pods and gems and Gradle cheer,
Workflows faster, caches clear.
Small changes, big CI fun. 🚀

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/create-composite-actions-for-caching

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@transphorm
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

✅ Actions performed

Full review triggered.

@transphorm
Copy link
Member Author

@transphorm
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

✅ Actions performed

Full review triggered.

Copy link
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: 9

🧹 Nitpick comments (8)
AGENTS.md (1)

53-63: Good centralization; add guidance on cache-versioning and node_modules with Yarn v4

  • The directive to use shared composite actions is solid. Consider explicitly instructing folks to bump a global GH_CACHE_VERSION env to invalidate all caches across workflows when needed.
  • For Yarn v4, recommend caching .yarn/cache (and optionally ~/.cache/yarn), not node_modules. Caching node_modules can be large/fragile (native rebuilds, postinstall scripts) and is usually unnecessary with Yarn’s immutable installs. Clarifying this here will prevent divergent cache strategies in workflows.
.github/actions/cache-pods/action.yml (1)

6-15: Double-check tilde expansion in paths

actions/cache typically handles ~ in paths, but it’s safer to use $HOME for clarity and portability in composite actions.

Optional tweak:

  • Replace ~/Library/Caches/CocoaPods with $HOME/Library/Caches/CocoaPods in the default path.
.github/actions/cache-yarn/action.yml (1)

5-11: Yarn v4 defaults: consider documenting multiple common cache paths

Default only includes .yarn/cache. Many setups benefit from also caching ~/.cache/yarn. Optionally add a note to the action description, or expand the default to:

 default: |
   .yarn/cache
+  ~/.cache/yarn
.github/workflows/mobile-e2e.yml (4)

48-49: Pass an explicit cache-version for Yarn

To enable controlled cache busting across repos/runs (e.g., breaking changes), pass a cache-version env or input. The composite defaults to v1.

Example:

-      - name: Cache Yarn dependencies
-        uses: ./.github/actions/cache-yarn
+      - name: Cache Yarn dependencies
+        uses: ./.github/actions/cache-yarn
+        with:
+          cache-version: ${{ env.GH_CACHE_VERSION || 'v1' }}

67-68: Pass an explicit cache-version for Gradle

Same reasoning as Yarn: make cache busting intentional and repeatable.

-      - name: Cache Gradle packages
-        uses: ./.github/actions/cache-gradle
+      - name: Cache Gradle packages
+        uses: ./.github/actions/cache-gradle
+        with:
+          cache-version: ${{ env.GH_CACHE_VERSION || 'v1' }}

175-179: Bundler cache: good inputs; consider cache-version

Lock file and path are correct. Consider adding a pluggable cache-version for manual busts across changes.

       - name: Cache Ruby gems
         uses: ./.github/actions/cache-bundler
         with:
           path: app/vendor/bundle
           lock-file: app/Gemfile.lock
+          cache-version: ${{ env.GH_CACHE_VERSION || 'v1' }}

180-186: Pods cache: good inputs; consider cache-version

Path and lock-file look right. Add cache-version for controlled busts.

       - name: Cache Pods
         uses: ./.github/actions/cache-pods
         with:
           path: |
             app/ios/Pods
             ~/Library/Caches/CocoaPods
           lock-file: app/ios/Podfile.lock
+          cache-version: ${{ env.GH_CACHE_VERSION || 'v1' }}
.github/workflows/mobile-deploy.yml (1)

557-560: Gradle cache: consider passing cache-version here as well

You’re already versioning other caches; mirror that here for consistent busting.

       - name: Cache Gradle dependencies
         id: gradle-cache
         uses: ./.github/actions/cache-gradle
         with:
-          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GRADLE_CACHE_VERSION }}
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GRADLE_CACHE_VERSION }}

Note: Also ensure the composite exposes cache-hit if you want to log it.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa35965 and 9a8c5e1.

📒 Files selected for processing (7)
  • .github/actions/cache-bundler/action.yml (1 hunks)
  • .github/actions/cache-gradle/action.yml (1 hunks)
  • .github/actions/cache-pods/action.yml (1 hunks)
  • .github/actions/cache-yarn/action.yml (1 hunks)
  • .github/workflows/mobile-deploy.yml (2 hunks)
  • .github/workflows/mobile-e2e.yml (4 hunks)
  • AGENTS.md (1 hunks)
🔇 Additional comments (1)
.github/workflows/mobile-e2e.yml (1)

154-155: Yarn cache step LGTM

Switching to the shared action improves consistency and maintainability across workflows. No issues.

@transphorm
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

✅ Actions performed

Full review triggered.

Copy link
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

🔭 Outside diff range comments (4)
.github/workflows/mobile-deploy.yml (4)

115-125: Invalid inputs for composite cache-yarn; switch to lock-file and cache-version

The composite action ignores key and restore-keys. Use lock-file and cache-version (including Node version) to avoid cache skew and fix lints.

       - name: Cache Yarn dependencies
         id: yarn-cache
-        uses: ./.github/actions/cache-yarn
-        with:
-          path: |
-            .yarn/cache
-            node_modules
-            ${{ env.APP_PATH }}/node_modules
-          key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
-          restore-keys: |
-            ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-
-            ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-
+        uses: ./.github/actions/cache-yarn
+        with:
+          path: |
+            .yarn/cache
+            node_modules
+            ${{ env.APP_PATH }}/node_modules
+          lock-file: yarn.lock
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-node${{ env.NODE_VERSION }}

128-135: Invalid inputs for composite cache-bundler; switch to lock-file and cache-version

key/restore-keys aren’t valid inputs for the composite. Include Ruby version in cache-version.

       - name: Cache Ruby gems
         id: gems-cache
-        uses: ./.github/actions/cache-bundler
-        with:
-          path: ${{ env.APP_PATH }}/vendor/bundle
-          key: ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-${{ hashFiles('app/Gemfile.lock') }}
-          restore-keys: |
-            ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-
-            ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-
+        uses: ./.github/actions/cache-bundler
+        with:
+          path: ${{ env.APP_PATH }}/vendor/bundle
+          lock-file: app/Gemfile.lock
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-ruby${{ env.RUBY_VERSION }}

544-554: Android: fix cache-yarn inputs (same as iOS)

Remove key/restore-keys and provide lock-file and cache-version to the composite.

       - name: Cache Yarn dependencies
         id: yarn-cache
-        uses: ./.github/actions/cache-yarn
-        with:
-          path: |
-            .yarn/cache
-            node_modules
-            ${{ env.APP_PATH }}/node_modules
-          key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
-          restore-keys: |
-            ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-
-            ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ env.GH_CACHE_VERSION }}-
+        uses: ./.github/actions/cache-yarn
+        with:
+          path: |
+            .yarn/cache
+            node_modules
+            ${{ env.APP_PATH }}/node_modules
+          lock-file: yarn.lock
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-node${{ env.NODE_VERSION }}

557-564: Android: fix cache-bundler inputs

As above, use lock-file and cache-version; remove key/restore-keys.

       - name: Cache Ruby gems
         id: gems-cache
-        uses: ./.github/actions/cache-bundler
-        with:
-          path: ${{ env.APP_PATH }}/vendor/bundle
-          key: ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-${{ hashFiles('app/Gemfile.lock') }}
-          restore-keys: |
-            ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-
-            ${{ runner.os }}-ruby${{ env.RUBY_VERSION }}-gems-${{ env.GH_CACHE_VERSION }}-
+        uses: ./.github/actions/cache-bundler
+        with:
+          path: ${{ env.APP_PATH }}/vendor/bundle
+          lock-file: app/Gemfile.lock
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-ruby${{ env.RUBY_VERSION }}
🧹 Nitpick comments (5)
.github/actions/cache-bundler/action.yml (1)

14-17: Doc: Encourage including Ruby version in cache-version

To avoid cross-version conflicts in cached gems, recommend composing cache-version with RUBY_VERSION (e.g., v1-ruby${{ env.RUBY_VERSION }}) in workflows. No code change needed here—just usage guidance.

.github/actions/cache-yarn/action.yml (2)

9-11: Consider caching Yarn install state by default

For Yarn v4, adding .yarn/install-state.gz improves restore speed and determinism.

   default: |
     .yarn/cache
+    .yarn/install-state.gz

11-18: Lock-file guidance

Defaulting lock-file to yarn.lock is fine for a root-managed monorepo. If you ever introduce nested locks, consider allowing a glob in workflows (e.g., lock-file: '**/yarn.lock').

AGENTS.md (1)

62-63: Add example for composing cache-version with runtime versions

To avoid cache poisoning across Node/Ruby upgrades, show how to include versions in cache-version.

 Each action accepts an optional `cache-version` input (often combined with `GH_CACHE_VERSION` and a tool-specific version). Avoid calling `actions/cache` directly so future workflows follow the same strategy.
+For example:
+- Yarn: `cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_YARN_CACHE_VERSION }}-node${{ env.NODE_VERSION }}`
+- Bundler: `cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GEMS_CACHE_VERSION }}-ruby${{ env.RUBY_VERSION }}`
+- Pods/Gradle: `cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_PODS_CACHE_VERSION }}` / `${{ env.GH_GRADLE_CACHE_VERSION }}`
.github/workflows/mobile-e2e.yml (1)

72-73: Optional: provide cache-version for Gradle in e2e

To keep invalidation consistent with other jobs, pass a composed cache-version here too.

-      - name: Cache Gradle packages
-        uses: ./.github/actions/cache-gradle
+      - name: Cache Gradle packages
+        uses: ./.github/actions/cache-gradle
+        with:
+          cache-version: ${{ env.GH_CACHE_VERSION }}-${{ env.GH_GRADLE_CACHE_VERSION }}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd2ec0d and 8b23713.

📒 Files selected for processing (7)
  • .github/actions/cache-bundler/action.yml (1 hunks)
  • .github/actions/cache-gradle/action.yml (1 hunks)
  • .github/actions/cache-pods/action.yml (1 hunks)
  • .github/actions/cache-yarn/action.yml (1 hunks)
  • .github/workflows/mobile-deploy.yml (6 hunks)
  • .github/workflows/mobile-e2e.yml (2 hunks)
  • AGENTS.md (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/mobile-e2e.yml

188-188: input "key" is not defined in action "Cache Bundler" defined at "./.github/actions/cache-bundler". available inputs are "cache-version", "lock-file", "path"

(action)


189-189: input "restore-keys" is not defined in action "Cache Bundler" defined at "./.github/actions/cache-bundler". available inputs are "cache-version", "lock-file", "path"

(action)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e-ios
🔇 Additional comments (8)
.github/actions/cache-bundler/action.yml (1)

19-22: Good: cache-hit output is correctly exposed

The composite forwards actions/cache output via steps.cache.outputs.cache-hit. Downstream workflows can log or branch on hit/miss reliably.

.github/actions/cache-yarn/action.yml (1)

20-23: Good: cache-hit is exposed from inner cache step

The outputs mapping is correct and will let workflows log cache hits.

.github/actions/cache-gradle/action.yml (2)

17-21: Good: exposes cache-hit for Gradle cache

Output wiring is correct; the step id matches and callers can read hit/miss.


29-33: Key composition is reasonable

OS + cache-version + hash of gradle files strikes a good balance. No change needed.

.github/actions/cache-pods/action.yml (2)

21-25: Good: cache-hit output correctly forwarded

Workflows can branch/log status from composite output.


33-37: Key strategy is correct for Pods

Using Podfile.lock for the key ensures cache invalidates when dependencies change. Restore keys provide graceful fallback.

.github/workflows/mobile-deploy.yml (2)

138-145: Pods caching step looks correct

Uses the composite with path, lock-file, and cache-version; aligns with the new policy.


567-570: Gradle caching looks good

Using the composite with cache-version keeps invalidation centralized.

@transphorm transphorm merged commit 29c620b into dev Aug 11, 2025
13 checks passed
@transphorm transphorm deleted the codex/create-composite-actions-for-caching branch August 11, 2025 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants