Skip to content

perf(ci): Vite deps cache + per-suite e2e sharding - #59

Merged
faultless-casey merged 4 commits into
mainfrom
casey/vite-deps-cache
May 3, 2026
Merged

faultless-casey merged 4 commits into
mainfrom
casey/vite-deps-cache

Conversation

@faultless-casey

@faultless-casey faultless-casey commented May 3, 2026 •

Copy link
Copy Markdown
Collaborator

Adds two improvements to ci-e2e.yml:

Vite pre-bundled deps cache — persists frontend*/node_modules/.vite across runs using actions/cache@v5, keyed on lockfile + vite.config.ts. Saves ~3–5s per Vite instance on warm runs (two instances per shard). The path uses a glob so no frontend dir names are hardcoded in this repo. Vite self-invalidates via _metadata.json if anything sneaks past the key.

Per-suite shard counts — adds an e2e_suite_shards string input (JSON map, default '{}') that lets consumers set different shard counts per suite, e.g. '{"frontend": 3, "frontend-book": 2}'. Falls back to the existing e2e_shards for any suite not listed, so all existing callers are unaffected. The discover job now builds an explicit {suite, shard, shard_total} include-list instead of a cross-product matrix, which also removes the previous hard cap of 4 shards.

🤖 Generated with Claude Code

Note

Add per-suite e2e sharding and Vite dependency caching to CI

  • The ci-e2e.yml workflow now accepts an e2e_suite_shards input (JSON string) mapping suite names to individual shard counts, replacing the single global shard count.
  • The discover job builds a flat matrix of {suite, shard, shard_total} objects, one entry per shard per suite, so each suite can run with a different number of shards.
  • Playwright is invoked with --shard={matrix.shard}/{matrix.shard_total} using the per-suite value, removing the previous cap of 4 shards.
  • Adds an actions/cache@v5 step to cache frontend*/node_modules/.vite keyed on the pnpm lockfile and vite.config.ts, avoiding redundant Vite pre-bundling across runs.
  • Behavioral Change: callers using the old suites/shards/shard_total matrix outputs will need to update to the new single matrix output.

Macroscope summarized 292b628.

Summary by CodeRabbit

  • New Features

    • Per-frontend-suite sharding for end-to-end test runs; the test matrix now drives shard counts passed to the test runner.
    • CI now detects when no E2E suites exist and skips E2E runs.
  • Chores

    • Simplified CI matrix output and orchestration.
    • Added caching for pre-bundled frontend dependencies to speed CI.
    • Runner now uses generated shard totals (no manual cap).

@github-actions
github-actions Bot requested a review from CharlieHelps May 3, 2026 14:57
@coderabbitai

coderabbitai Bot commented May 3, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a workflow_call input e2e_suite_shards (string, default '{}'). The discover job now emits a single JSON matrix of {suite, shard, shard_total} entries (using per-suite shard counts from e2e_suite_shards with fallback to e2e_shards) or matrix=[]/has_e2e=false when no suites are found. The e2e job uses fromJson(needs.discover.outputs.matrix) for its strategy. Playwright is invoked with --shard={matrix.shard}/{matrix.shard_total}. A Vite cache was added for frontend*/node_modules/.vite, keyed by runner.os plus hashes of frontend*/pnpm-lock.yaml and frontend*/vite.config.ts.

Suggested reviewers

  • CharlieHelps
  • macroscopeapp
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main changes: Vite deps cache and per-suite e2e sharding improvements to CI workflow. Both improvements are present in the changeset and match the title's focus.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch casey/vite-deps-cache

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

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes May 3, 2026
@macroscopeapp

macroscopeapp Bot commented May 3, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

1 blocking correctness issue found.

You can customize Macroscope's approvability policy. Learn more.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/ci-e2e.yml (1)

155-162: 💤 Low value

Cache implementation looks good; consider dynamic paths for future-proofing.

The cache step is correctly placed and configured. However, the hardcoded paths (frontend/node_modules/.vite, frontend-book/node_modules/.vite) differ from the dynamic suite discovery pattern used at lines 70-73. If a new frontend*/ directory is added in the future, it won't benefit from Vite caching until these paths are updated.

This is a minor maintainability consideration rather than a functional issue, since the current structure is stable and the cache will work correctly as-is.

♻️ Optional: generate cache paths dynamically

You could align with the suite discovery logic by generating paths dynamically, though this adds complexity for marginal benefit:

      - name: Prepare Vite cache paths
        id: vite-paths
        run: |
          paths=()
          for dir in frontend*/; do
            [ -d "$dir" ] || continue
            paths+=("${dir}node_modules/.vite")
          done
          # Convert to multiline string for cache action
          printf 'paths<<EOF\n' >> "$GITHUB_OUTPUT"
          printf '%s\n' "${paths[@]}" >> "$GITHUB_OUTPUT"
          printf 'EOF\n' >> "$GITHUB_OUTPUT"

      - name: Cache Vite pre-bundled deps
        uses: actions/cache@v5
        with:
          path: ${{ steps.vite-paths.outputs.paths }}
          key: vite-deps-${{ runner.os }}-${{ hashFiles('frontend*/pnpm-lock.yaml', 'frontend*/vite.config.ts') }}
          restore-keys: vite-deps-${{ runner.os }}-

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ba9b902-74f9-461f-8fb9-dd2927f334b6

📥 Commits

Reviewing files that changed from the base of the PR and between 47bbe4f and a2d8ee5.

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

@macroscopeapp
macroscopeapp Bot dismissed their stale review May 3, 2026 15:03

Dismissing prior approval to re-evaluate fa4307c

@faultless-casey faultless-casey changed the title perf(ci): cache Vite pre-bundled deps in e2e workflow perf(ci): Vite deps cache + per-suite e2e sharding May 3, 2026
@github-actions
github-actions Bot requested review from CharlieHelps and removed request for CharlieHelps May 3, 2026 15:03
Comment thread .github/workflows/ci-e2e.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 921bf076-2d62-40e2-860f-40a2fdfdeea0

📥 Commits

Reviewing files that changed from the base of the PR and between a2d8ee5 and fa4307c.

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

Comment thread .github/workflows/ci-e2e.yml
@github-actions
github-actions Bot requested review from CharlieHelps and removed request for CharlieHelps May 3, 2026 15:10
Comment thread .github/workflows/ci-e2e.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9285c2ac-3045-4ca1-9b06-b96661ce1d39

📥 Commits

Reviewing files that changed from the base of the PR and between fa4307c and 292b628.

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

Comment thread .github/workflows/ci-e2e.yml Outdated
@github-actions
github-actions Bot requested review from CharlieHelps and removed request for CharlieHelps May 3, 2026 15:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aa036aa8-e105-4a78-a1c4-ef43248c2004

📥 Commits

Reviewing files that changed from the base of the PR and between 292b628 and 2fdc640.

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

Comment thread .github/workflows/ci-e2e.yml
@faultless-casey
faultless-casey merged commit 9245bd3 into main May 3, 2026
5 checks passed
@faultless-casey
faultless-casey deleted the casey/vite-deps-cache branch May 3, 2026 17:29
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