ci: distribute CI checks across Nx Agents (cost-aware cloud)#454
Conversation
|
|
|
View your CI Pipeline Execution ↗ for commit 45097f2
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Pull request overview
This PR (COD-406) moves the main CI / checks workflow workload (lint/test/build) onto Nx Cloud distributed task execution via Nx Agents, and updates the Nx Cloud enablement rule to be cost-aware (on for human-driven runs, off for renovate and via a repo-variable kill switch).
Changes:
- Added Nx Agents launch template configuration and a distribution tier config for scaling agent count with affected graph size.
- Updated
CIworkflow to start/complete an Nx Cloud CI run with--distribute-onand continuous task assignment. - Updated the Nx Cloud disablement rule in
ci.ymlandchromatic.ymlto focus on renovate branches / kill switch rather than broadly disabling for pushes/dispatches.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.nx/workflows/distribution-config.yaml |
Adds tiered agent distribution config for the CI “checks” job. |
.nx/workflows/agents.yaml |
Defines a custom Nx Agents launch template (Node 22 + pnpm + Playwright browser). |
.github/workflows/ci.yml |
Starts/finishes Nx Cloud CI run with distribution enabled; enables continuous assignment; updates cloud-off rule. |
.github/workflows/chromatic.yml |
Aligns cloud-off rule with CI workflow (renovate/kill-switch). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
=======================================
Coverage 85.77% 85.77%
=======================================
Files 63 63
Lines 1139 1139
Branches 247 247
=======================================
Hits 977 977
Misses 162 162 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
✨ Your pull request projects are ready for preview
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
.github/workflows/ci.yml:125
complete-ci-runwill run even ifstart-ci-runerrored (e.g., whencontinue-on-erroris added, or if start fails before creating a run), which can produce a secondary failure and mask the original issue. Guard completion on the start step outcome.
- name: Stop Nx Cloud CI run
if: always() && env.NX_NO_CLOUD != 'true'
run: pnpm nx-cloud complete-ci-run
.github/workflows/ci.yml:32
- The comment says the kill switch is the NX_NO_CLOUD repo variable, but the logic is specifically
vars.NX_NO_CLOUD == 'true'. Consider clarifying the comment so it's obvious what value enables the kill switch.
# - Disabled only for machine-driven runs — renovate branches (matched on
# push and PR via head_ref/ref_name) — or via the NX_NO_CLOUD repo variable,
# to keep costs down on high-frequency bot traffic.
.nx/workflows/agents.yaml:31
- This comment says the agent Node version is pinned to match the coordinator's
setup-node, but the coordinator usesnode-version: 22(not a pinned patch). Either pin the coordinator too or update this comment to avoid claiming an exact match.
# Pin Node 22 to match .nvmrc (22.22.2) and the coordinator's setup-node,
# rather than relying on the base image's bundled Node.
25e9485 to
d6337c2
Compare
Tracked in COD-406.
Summary
Move the
CI / checksjob (nx affected -t lint,test,build -c ci) onto Nx Agents distributed task execution, and align the Nx Cloud enablement rule to be cost-aware — human-driven runs use cloud, renovate bot traffic does not.Changes
.nx/workflows/agents.yaml(new) — custom launch templatecdwr-linux-medium-js(Node 22.22.2, pnpm, Playwright browser) onubuntu22.04-node24.14-v1..nx/workflows/distribution-config.yaml(new) — dynamic agent tiers (3 / 5 / 8) scaling with affected-graph size..github/workflows/ci.yml— guardednx-cloud start-ci-run(--require-explicit-completion,--stop-agents-on-failure=false) + guardedcomplete-ci-run;NX_CLOUD_CONTINUOUS_ASSIGNMENT: true.ci.yml+chromatic.yml—NX_NO_CLOUDnow disables cloud only for renovate branches /vars.NX_NO_CLOUD, so pushes tomainandworkflow_dispatchuse cloud (previously off).Cost rule
Cloud on for PRs, pushes to
main,merge_group, manual dispatch. Off forrenovate/**(matched viahead_ref/ref_nameon both push and PR) — the high-frequency bot actor — and via thevars.NX_NO_CLOUDkill switch.Intentionally unchanged
e2e-matrix.yml— cross-OS/PM matrix, can't run on Linux-only agents; already renovate-guarded + opt-in viaNX_E2E_USE_CLOUD.ci-extended.yml—NX_NO_CLOUD: true; deliberate opt-out (e2e/integration need Fly/Infisical secrets, not distribution candidates).Validation still required
complete-ci-run.build/testonmedium+for OOM (bump tolargeif needed).install-browsersprovisions the Chromium build the Storybooktesttarget expects.🤖 Generated with Claude Code