Skip to content

ci: distribute CI checks across Nx Agents (cost-aware cloud)#454

Merged
hakalb merged 1 commit into
mainfrom
cod-406-ci-distribute-ci-checks-across-nx-agents-cost-aware-cloud
Jul 25, 2026
Merged

ci: distribute CI checks across Nx Agents (cost-aware cloud)#454
hakalb merged 1 commit into
mainfrom
cod-406-ci-distribute-ci-checks-across-nx-agents-cost-aware-cloud

Conversation

@hakalb

@hakalb hakalb commented Jul 25, 2026

Copy link
Copy Markdown
Member

Tracked in COD-406.

Summary

Move the CI / checks job (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 template cdwr-linux-medium-js (Node 22.22.2, pnpm, Playwright browser) on ubuntu22.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 — guarded nx-cloud start-ci-run (--require-explicit-completion, --stop-agents-on-failure=false) + guarded complete-ci-run; NX_CLOUD_CONTINUOUS_ASSIGNMENT: true.
  • ci.yml + chromatic.ymlNX_NO_CLOUD now disables cloud only for renovate branches / vars.NX_NO_CLOUD, so pushes to main and workflow_dispatch use cloud (previously off).

Cost rule

Cloud on for PRs, pushes to main, merge_group, manual dispatch. Off for renovate/** (matched via head_ref/ref_name on both push and PR) — the high-frequency bot actor — and via the vars.NX_NO_CLOUD kill switch.

Intentionally unchanged

  • e2e-matrix.yml — cross-OS/PM matrix, can't run on Linux-only agents; already renovate-guarded + opt-in via NX_E2E_USE_CLOUD.
  • ci-extended.ymlNX_NO_CLOUD: true; deliberate opt-out (e2e/integration need Fly/Infisical secrets, not distribution candidates).

Validation still required

  • Trial PR run: agents start, receive tasks, restore cache, shut down via complete-ci-run.
  • Confirm Nx Cloud org has Nx Agents enabled and accepts the custom launch template.
  • Watch first cms build/test on medium+ for OOM (bump to large if needed).
  • Confirm install-browsers provisions the Chromium build the Storybook test target expects.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 25, 2026 16:34
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@nx-cloud

nx-cloud Bot commented Jul 25, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 45097f2

Command Status Duration Result
nx affected -t chromatic ✅ Succeeded 36s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-25 17:27:11 UTC

@github-actions github-actions Bot added the preview-deploy PR Trigger: run continuous preview deployments label Jul 25, 2026

Copilot AI 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.

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 CI workflow to start/complete an Nx Cloud CI run with --distribute-on and continuous task assignment.
  • Updated the Nx Cloud disablement rule in ci.yml and chromatic.yml to 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.

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/chromatic.yml Outdated
Comment thread .nx/workflows/distribution-config.yaml Outdated
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.77%. Comparing base (8aac503) to head (d6337c2).
⚠️ Report is 1 commits behind head on main.

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.
📢 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.

@codeware-actions

codeware-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

✨ Your pull request projects are ready for preview

Project Status Preview
cms (_default) ✅ Deployed https://cdwr-cms-pr-454.fly.dev
cms (demo) ✅ Deployed https://cdwr-cms-pr-454-demo.fly.dev
web (demo) ✅ Deployed https://cdwr-web-pr-454-demo.fly.dev

Copilot AI review requested due to automatic review settings July 25, 2026 17:05

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/ci.yml
Comment thread .nx/workflows/agents.yaml
Copilot AI review requested due to automatic review settings July 25, 2026 17:17

Copilot AI 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.

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-run will run even if start-ci-run errored (e.g., when continue-on-error is 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 uses node-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.

Comment thread .github/workflows/ci.yml
Copilot AI review requested due to automatic review settings July 25, 2026 17:25
@hakalb
hakalb force-pushed the cod-406-ci-distribute-ci-checks-across-nx-agents-cost-aware-cloud branch from 25e9485 to d6337c2 Compare July 25, 2026 17:25

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/ci.yml
@hakalb
hakalb added this pull request to the merge queue Jul 25, 2026
Merged via the queue into main with commit ff2e2b4 Jul 25, 2026
13 checks passed
@hakalb
hakalb deleted the cod-406-ci-distribute-ci-checks-across-nx-agents-cost-aware-cloud branch July 25, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-deploy PR Trigger: run continuous preview deployments

Development

Successfully merging this pull request may close these issues.

2 participants