Skip to content

ci: single-leg coverage and cached utoo package store#6006

Merged
killagu merged 1 commit into
nextfrom
feat/ci-single-leg-coverage-cache
Jun 27, 2026
Merged

ci: single-leg coverage and cached utoo package store#6006
killagu merged 1 commit into
nextfrom
feat/ci-single-leg-coverage-cache

Conversation

@killagu

@killagu killagu commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

Cut CI wall time on the 3-OS × 2-Node test matrix without adding matrix jobs (sharding is intentionally out of scope — it multiplies jobs and queues the runner pool at this repo's PR volume). Two independent, low-risk levers.

Task A — collect coverage on one matrix leg only

ut run ci (= ut run test -- --coverage) ran v8 coverage on all 6 legs, but codecov only needs one upload. Coverage adds ~10–30% per-leg overhead.

  • Add a coverage matrix axis (default false), enabled on a single ubuntu/node-24 leg.
  • Split "Run tests" into two guarded steps — ut run ci (with --coverage) on the coverage leg, ut run test on the other 5. Both reach the same pretest prep (clean-dist + workspace pretest); only --coverage differs. (ut run ci only reaches clean-dist via its nested ut run test, so dropping ci for test keeps the prep identical.)
  • Gate the codecov upload on matrix.coverage (was matrix.os != 'windows-latest'), so exactly one leg uploads. Applied to test, test-egg-bin, and test-egg-scripts.

Note

exclude is required, not just include. GitHub's include cannot overwrite an existing matrix dimension. With coverage: [false] in the base, include: { coverage: true } would create a separate ubuntu/24 leg → 7 legs, ubuntu/24 run twice. The added exclude of the base ubuntu/24/coverage:false combo makes the coverage leg replace it. Leg counts stay 6 / 2 / 2; the done gate is unaffected.

Task B — cache the utoo package download store

Verified where ut install --from pnpm actually reads from before caching:

  • It clones from a content-addressable store at $HOME/.cache/nm/<pkg>/<version>/ (default), redirectable via the UTOO_CACHE_DIR env var (both confirmed empirically — a fresh uncached install populated exactly those dirs; warm installs report cloned, not downloaded). Not a no-op.
  • Pin the store to ${{ runner.temp }}/utoo-store (deterministic, identical expression in env and the cache path, outside the checkout) and wrap ut install with actions/cache in every installing job (typecheck, test, test-egg-bin, test-egg-scripts).

Note

Cache key deviates from a lockfile hash. This repo commits no lockfile — dependency versions live in pnpm-workspace.yaml's catalog + the package.json files (utoo generates an uncommitted package-lock.json at install time). hashFiles('**/pnpm-lock.yaml') would be empty → a constant key that never re-saves the growing store. The key hashes pnpm-workspace.yaml + **/package.json instead, with restore-keys: pkgstore-<os>- falling back to the latest per-OS store on a key miss.

Per repo convention, every action is pinned by commit SHA (actions/cache@0057852… = v4.3.0).

Test evidence

  • actionlint passes on the workflow.
  • Matrix expansion simulated against GitHub's documented include/exclude algorithm: 6 / 2 / 2 legs (unchanged), exactly 1 coverage leg each (ubuntu/24).

Before/after timings — to fill in from this PR's first runs

These require real CI runs and will be added once the workflow executes here:

  • 5 non-coverage test legs: duration vs. next baseline (Task A).
  • warm-cache ut install step duration vs. cold (Task B); cache hit-rate visible in the Actions cache UI.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved CI reliability by refining how dependencies are cached during validation runs.
    • Streamlined test execution with an explicit coverage vs. non-coverage flow, ensuring coverage runs only for the intended OS/node combinations.
    • Reduced redundant coverage reporting by uploading coverage results only when running in coverage-enabled mode.

Copilot AI review requested due to automatic review settings June 27, 2026 14:23
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b1af916a-70ee-4f14-8b13-6cebfedde43c

📥 Commits

Reviewing files that changed from the base of the PR and between a39c3be and 46e83bb.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

The CI workflow adds utoo package store caching with UTOO_CACHE_DIR in typecheck and test jobs, and introduces a coverage matrix dimension for test, test-egg-bin, and test-egg-scripts. Those jobs now branch between ut run ci and ut run test, with Codecov uploads gated by matrix.coverage.

Changes

CI Cache and Coverage Matrix

Layer / File(s) Summary
utoo cache in typecheck job
.github/workflows/ci.yml
Adds actions/cache for the utoo package store and sets UTOO_CACHE_DIR during dependency install in the typecheck job.
coverage matrix + steps for test job
.github/workflows/ci.yml
Adds a coverage matrix branch for the test job, caches the utoo package store, splits ut run ci and ut run test, and gates Codecov upload on matrix.coverage.
coverage matrix + steps for test-egg-bin job
.github/workflows/ci.yml
Applies the same coverage matrix, utoo cache, execution split, and Codecov gate changes to test-egg-bin.
coverage matrix + steps for test-egg-scripts job
.github/workflows/ci.yml
Applies the same coverage matrix, utoo cache, execution split, and Codecov gate changes to test-egg-scripts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • eggjs/egg#5845: Also changes .github/workflows/ci.yml test-job matrix/execution shape and CI command selection.

Poem

🐇 I hop through cache with speedy feet,
The coverage path makes CI neat.
One branch runs tests, one shines with trace,
Codecov lands in the proper place.
A rabbit approves this matrix dance 🌙

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the CI coverage split and utoo package store caching changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ci-single-leg-coverage-cache

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 46e83bb
Status: ✅  Deploy successful!
Preview URL: https://0ac94a39.egg-cci.pages.dev
Branch Preview URL: https://feat-ci-single-leg-coverage.egg-cci.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 46e83bb
Status: ✅  Deploy successful!
Preview URL: https://84664ac8.egg-v3.pages.dev
Branch Preview URL: https://feat-ci-single-leg-coverage.egg-v3.pages.dev

View logs

@killagu killagu force-pushed the feat/ci-single-leg-coverage-cache branch from f9d7f50 to a39c3be Compare June 27, 2026 14:33
@socket-security

socket-security Bot commented Jun 27, 2026

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account.

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.99%. Comparing base (22d5585) to head (46e83bb).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #6006      +/-   ##
==========================================
- Coverage   82.85%   81.99%   -0.87%     
==========================================
  Files         676      676              
  Lines       20522    20522              
  Branches     4060     4060              
==========================================
- Hits        17004    16826     -178     
- Misses       3040     3189     +149     
- Partials      478      507      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Two independent levers to cut CI wall time without adding matrix jobs.

Task A — collect coverage on one matrix leg only:
- add a `coverage` matrix axis (default false) and enable it on a single
  ubuntu/node-24 leg via include; an explicit exclude of the base
  ubuntu/24/coverage:false combo is required because `include` cannot
  overwrite an existing matrix dimension and would otherwise *duplicate*
  the ubuntu/24 leg (7 legs instead of 6).
- split "Run tests" into two guarded steps: `ut run ci` (with --coverage)
  on the coverage leg, `ut run test` on the other 5. Both reach the same
  pretest prep (clean-dist + workspace pretest); only --coverage differs.
- gate the codecov upload on `matrix.coverage` instead of OS, so exactly
  one leg uploads. Applied to test, test-egg-bin and test-egg-scripts.
  Leg counts are unchanged (6 / 2 / 2); the `done` gate is unaffected.

Task B — cache the utoo package download store:
- `ut install --from pnpm` clones from a content-addressable store
  (default `$HOME/.cache/nm`, redirectable via `UTOO_CACHE_DIR`). Pin it
  to `${{ runner.temp }}/utoo-store` for a deterministic cross-OS path and
  restore/save it with actions/cache before install in every installing
  job (typecheck, test, test-egg-bin, test-egg-scripts).
- the repo commits no lockfile (versions live in pnpm-workspace.yaml's
  catalog + package.json files), so the cache key hashes those rather than
  a non-existent pnpm-lock.yaml; restore-keys fall back to the latest
  per-OS store so it warms even on a key miss.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@killagu killagu force-pushed the feat/ci-single-leg-coverage-cache branch from a39c3be to 46e83bb Compare June 27, 2026 16:14
Copilot AI review requested due to automatic review settings June 27, 2026 16:14

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@killagu killagu merged commit 5134d9c into next Jun 27, 2026
23 of 26 checks passed
@killagu killagu deleted the feat/ci-single-leg-coverage-cache branch June 27, 2026 16:49
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.

2 participants