Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/cmux-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ name: cmux-next
# A same-repository pull request runs every tier the router picks on its own
# branch, with no label (#22303), except the two heavy app compiles (native and
# scheme), which need full-ci again (2026-10-21: the Mac queue was ~350 jobs
# deep); a MEMBER or OWNER dev-build PR keeps its scheme compile, and the
# deep), and the swift tier, which needs full-ci too (2026-11-05: of 78 PR
# swift-test check runs, 37 were cancelled by a merge, a newer push or a re-run
# and none passed; the tip suite dispatch gives the base its verdict); a MEMBER or OWNER dev-build PR keeps its scheme compile, and the
# native tier compiles the PR's head on the build fleet instead
# (app-compile-fleet; the Mac Release compile only when it gives no verdict, and only for a PR
# that changes an input only that xcodebuild sees: path_route's mac_release,
Expand Down Expand Up @@ -846,12 +848,12 @@ jobs:
tree_reason: ${{ steps.marker-upload.outcome == 'failure' && 'the tree wait marker was not uploaded, so no publish would start the tree jobs; re-run this run' || steps.tree-final.outputs.tree_reason || steps.tree.outputs.tree_reason }}
# The one job that checks the generated files on its own package build (HQ#4724: skip compiles
# that add no signal). daemon-test on a push it runs on (a ready tree), else swift-test where it
# runs and builds (its targets), else daemon-test where it runs, else the generated-files job's
# own build. swift-test and daemon-test then never compete with a third
# runs and builds (its targets; on a pull request only with full-ci), else daemon-test where it
# runs, else the generated-files job's own build. swift-test and daemon-test then never compete with a third
# `swift build --build-tests`; generated-verdict gives the folded verdict its own check.
# A base tier run (inputs.base_tier) checks them on the generated-files job itself: its standalone
# `cmux-next generated files` verdict is the base verdict a pull request's is compared with.
generated_host: ${{ steps.route.outputs.generated != 'true' && 'none' || inputs.base_tier == true && 'generated-files' || github.event_name == 'push' && steps.route.outputs.daemon == 'true' && (steps.marker-upload.outcome == 'failure' && 'failed' || steps.tree-final.outputs.tree_state || steps.tree.outputs.tree_state) == 'ready' && 'daemon-test' || !(github.event_name == 'push' && github.ref == 'refs/heads/feat-cmux-next') && steps.route.outputs.swift == 'true' && steps.route.outputs.swift_targets != '' && 'swift-test' || steps.route.outputs.daemon == 'true' && (steps.marker-upload.outcome == 'failure' && 'failed' || steps.tree-final.outputs.tree_state || steps.tree.outputs.tree_state) == 'ready' && 'daemon-test' || 'generated-files' }}
generated_host: ${{ steps.route.outputs.generated != 'true' && 'none' || inputs.base_tier == true && 'generated-files' || github.event_name == 'push' && steps.route.outputs.daemon == 'true' && (steps.marker-upload.outcome == 'failure' && 'failed' || steps.tree-final.outputs.tree_state || steps.tree.outputs.tree_state) == 'ready' && 'daemon-test' || !(github.event_name == 'push' && github.ref == 'refs/heads/feat-cmux-next') && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci')) && steps.route.outputs.swift == 'true' && steps.route.outputs.swift_targets != '' && 'swift-test' || steps.route.outputs.daemon == 'true' && (steps.marker-upload.outcome == 'failure' && 'failed' || steps.tree-final.outputs.tree_state || steps.tree.outputs.tree_state) == 'ready' && 'daemon-test' || 'generated-files' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down Expand Up @@ -1474,7 +1476,7 @@ jobs:
needs.path_route.outputs.swift_canary == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'full-ci')) && 'swift-canary' || '',
(inputs.same_tree_sha != '' && inputs.same_tree_state == 'ready' && contains(inputs.same_tree_tiers, 'scheme') || needs.path_route.outputs.scheme == 'true' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci') || (github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'OWNER') && contains(github.event.pull_request.labels.*.name, 'dev-build'))) && 'cmux-scheme-compile' || '',
needs.path_route.outputs.native == 'true' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci')) && 'release-compile' || '',
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.path_route.outputs.swift == 'true' && 'swift-test' || '',
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'full-ci') && needs.path_route.outputs.swift == 'true' && 'swift-test' || '',
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.path_route.outputs.daemon == 'true' && needs.path_route.outputs.tree_state == 'ready' && 'daemon-test' || '',
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.path_route.outputs.generated == 'true' && needs.path_route.outputs.generated_host == 'generated-files' && 'generated-files' || '') }}
CASCADE_JOBS: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'swift-test daemon-test generated-files' || '' }}
Expand Down Expand Up @@ -3668,11 +3670,15 @@ jobs:
# Keep the existing owned-pool switch: when disabled, retain its small overflow.
swift-test:
needs: [path_route, macos-placement, push-head-preflight, web-bundles]
# A same-repository PR runs the targets its change reaches; a fork PR
# only with full-ci. A feat-cmux-next push skips this job (push CI is the
# app build only, see the jobs comment), so the PR or a dispatch is where
# a change's Swift suites run.
if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/feat-cmux-next') && (!cancelled() && (needs.web-bundles.result == 'success' || needs.web-bundles.result == 'skipped') && needs.path_route.outputs.swift == 'true' && needs.push-head-preflight.outputs.current == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'full-ci'))) }}
# A pull request (same-repository or fork) runs it only with full-ci. On
# every PR push it gave no signal: of 78 PR check runs (2026-11-02 to 11-05)
# 37 were cancelled (17 by the PR merging first, 10 by a newer push, 10 by a
# re-run at the same head), 37 skipped, 4 failed and none passed. A
# feat-cmux-next push skips it too (push CI is the app build only, see the
# jobs comment), so a dispatch is where the Swift suites run: main's
# cmux-next-tip-swift-suite-dispatch.yml runs them on the tip when Swift
# changed (the base verdict), and gh workflow run runs them on any ref.
if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/feat-cmux-next') && (!cancelled() && (needs.web-bundles.result == 'success' || needs.web-bundles.result == 'skipped') && needs.path_route.outputs.swift == 'true' && needs.push-head-preflight.outputs.current == 'true' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci'))) }}
name: cmux-next swift test
continue-on-error: false
# A push's Mac job waits for the same job of the running push run and is
Expand Down
8 changes: 6 additions & 2 deletions docs/ci/cmux-next-tiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ is routed.
| swift canary | `cmux-next Swift canary` (Debug SwiftPM build of the changed production targets) | production Swift files under `Packages/macOS/CmuxNext/Sources/` only | mini, placed first |
| native | `cmux-next app compile (build fleet)` on a same-repository PR; `cmux-next Release compile (Xcode 26)` with `full-ci`, from a fork, on a push, or when the fleet gives no verdict | Swift and app sources (a fork PR: any `.swift` file under `Packages/macOS/CmuxNext/`, other sources with `full-ci`) | build fleet (Linux); mini for Release |
| scheme | `cmux app scheme compile (Debug)` | the app host, Xcode project, CLI, resources, webviews, local packages CmuxNext uses, an executable target | mini |
| swift | `cmux-next swift test` | the test targets the target graph reaches | mini |
| swift | `cmux-next swift test` (a pull request only with `full-ci`; the tip suite dispatch runs it on the `feat-cmux-next` tip) | the test targets the target graph reaches | mini |
| daemon | `cmux-next daemon tests` (`same-tree cmux-tui` reports a tree that nothing will publish) | cmux-tui tree inputs, daemon capabilities, `pin-cmux-tui.sh`, CmuxNextDaemon or CmuxNextMobile and their dependencies, CmuxNextControl | a mini, once the tree is published |

A web nit runs no Mac tier. When every changed file is under `webviews/`, the
Expand Down Expand Up @@ -153,7 +153,11 @@ Every tier runs on:
- a dispatch on any ref (`gh workflow run cmux-next.yml --ref <branch>`);
- every `feat-cmux-next` push, except `swift test`: push CI is the app build
(Release compile and app scheme compile), so a merged PR's Swift suites run
on the PR itself or a dispatch. A superseded push skips its other Mac jobs,
in main's tip suite dispatch (`cmux-next-tip-swift-suite-dispatch.yml`, on the
tip whenever Swift changed), a dispatch, or a PR labeled `full-ci`. A pull
request without `full-ci` skips `swift test` (2026-11-05): run on every PR
push it was cancelled by a merge, a newer push or a re-run before it
finished (37 of 78 check runs cancelled, none passed), so it gave no signal. A superseded push skips its other Mac jobs,
so a burst of merges is checked once at its newest commit. The Release
compile still runs on superseded pushes: one runs at a time and only the
newest waits (a newer push replaces a waiting one), so a base compile break
Expand Down
14 changes: 8 additions & 6 deletions tests/test_cmux_next_checks_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,13 @@ def test_path_route_gates_each_mac_job_on_its_tier(self):
self.assertIn("needs.path_route.outputs.scheme == 'true'", jobs["cmux-scheme-compile"]["if"])
# A same-repository PR runs its routed tiers; full-ci is what a fork PR needs
# (SameRepositoryPullRequestsRunTheirTiers evaluates the conditions).
for job_id in ("swift-canary", "swift-test", "generated-files", "daemon-test"):
for job_id in ("swift-canary", "generated-files", "daemon-test"):
self.assertIn("github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || "
"contains(github.event.pull_request.labels.*.name, 'full-ci')", jobs[job_id]["if"], job_id)
# The two heavy app compiles are back behind full-ci on every PR (HeavyMacCompilesBehindFullCi).
for job_id in HEAVY_COMPILES:
# The two heavy app compiles and swift-test are behind full-ci on every PR
# (HeavyMacCompilesBehindFullCi; swift-test since 2026-11-05: on every PR push it was
# cancelled or skipped and never passed, and the tip suite dispatch gives the base verdict).
for job_id in HEAVY_COMPILES + ("swift-test",):
self.assertIn("github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci')",
jobs[job_id]["if"], job_id)
self.assertNotIn("github.event.pull_request.head.repo.full_name == github.repository || ", jobs[job_id]["if"], job_id)
Expand Down Expand Up @@ -2723,9 +2725,9 @@ def running(self, context: dict) -> set[str]:
return {name for name in self.TIER_JOBS + ("macos-placement", "checks") if evaluate(jobs[name]["if"], context)}

def test_a_same_repository_pr_runs_every_routed_tier_without_a_label(self):
# Except the two heavy app compiles, which need full-ci (HeavyMacCompilesBehindFullCi).
# Except the two heavy app compiles and swift-test, which need full-ci (HeavyMacCompilesBehindFullCi).
self.assertEqual(self.running(self.context()),
set(self.TIER_JOBS) - set(HEAVY_COMPILES) | {"macos-placement", "checks"})
set(self.TIER_JOBS) - set(HEAVY_COMPILES) - {"swift-test"} | {"macos-placement", "checks"})
self.assertEqual(self.running(self.context(labels=("full-ci",))),
set(self.TIER_JOBS) | {"macos-placement", "checks"})

Expand Down Expand Up @@ -2795,7 +2797,7 @@ def test_the_cascade_counts_pr_package_checks_and_the_compiles_that_run(self):
place = next(step for step in self.jobs()["macos-placement"]["steps"] if step.get("id") == "place")
expression = place["env"]["CASCADE_RUNS"]
self.assertEqual(set(evaluate(expression, self.context()).split()),
{"fast-tier", "swift-canary", "swift-test", "daemon-test"})
{"fast-tier", "swift-canary", "daemon-test"})
self.assertEqual(set(evaluate(expression, self.context(labels=("full-ci",))).split()),
{"fast-tier", "swift-canary", "cmux-scheme-compile", "release-compile", "swift-test", "daemon-test"})
generated = self.context()
Expand Down
32 changes: 21 additions & 11 deletions tests/test_cmux_next_generated_fold.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ def truthy(v):
NEXT = "refs/heads/feat-cmux-next"


def route_ctx(event, ref, generated, swift, targets, daemon, tree, marker):
def route_ctx(event, ref, generated, swift, targets, daemon, tree, marker, labels=()):
"""path_route's own expression context: its route step, the tree probes and the marker upload."""
return {"github": {"event_name": event, "ref": ref},
return {"github": {"event_name": event, "ref": ref,
"event": {"pull_request": {"labels": [{"name": label} for label in labels]}}},
"steps": {"route": {"outputs": {"generated": generated, "swift": swift, "swift_targets": targets,
"daemon": daemon}},
"tree": {"outputs": {"tree_state": tree}}, "tree-final": {"outputs": {}},
Expand Down Expand Up @@ -220,18 +221,19 @@ def test_every_routed_run_builds_once_for_its_generated_files(self):
events = [("push", NEXT), ("push", "refs/heads/main"),
("pull_request", "refs/pull/1/merge"), ("workflow_dispatch", NEXT)]
cases = pr_single = 0
for (event, ref), generated, swift, targets, daemon, tree, marker, web, current, fork in itertools.product(
for (event, ref), generated, swift, targets, daemon, tree, marker, web, current, fork, labels in itertools.product(
events, ("true", "false"), ("true", "false"), ("all", ""), ("true", "false"),
("ready", "deferred", "failed", ""), ("", "failure"), ("success", "failure"), ("true", "false"),
(False, True)):
rctx = route_ctx(event, ref, generated, swift, targets, daemon, tree, marker)
(False, True), ((), ("full-ci",))):
rctx = route_ctx(event, ref, generated, swift, targets, daemon, tree, marker, labels)
host = Expr(host_expr, rctx).value()
tree_state = Expr(tree_expr, rctx).value()
outputs = {"generated": generated, "swift": swift, "swift_targets": targets, "daemon": daemon,
"tree_state": tree_state, "generated_host": host}
head = "someone/fork" if fork else REPO
ctx = {"github": {"event_name": event, "ref": ref, "repository": REPO,
"event": {"pull_request": {"head": {"repo": {"full_name": head}}, "labels": []}}},
"event": {"pull_request": {"head": {"repo": {"full_name": head}},
"labels": [{"name": label} for label in labels]}}},
"inputs": {}, "cancelled": False,
"needs": {"path_route": {"outputs": outputs}, "web-bundles": {"result": web},
"push-head-preflight": {"outputs": {"current": current}}}}
Expand All @@ -251,9 +253,13 @@ def test_every_routed_run_builds_once_for_its_generated_files(self):
verdict = truthy(Expr(self.verdict["if"], ctx).value())
# The generated-files job's condition before generated_host: its shared prerequisites.
gen_routed = (generated == "true" and web == "success" and current == "true"
and not (event == "pull_request" and fork))
and not (event == "pull_request" and fork and not labels))
with self.subTest(event=event, ref=ref, generated=generated, swift=swift, targets=targets, daemon=daemon,
tree=tree, marker=marker, web=web, current=current, fork=fork, host=host):
tree=tree, marker=marker, web=web, current=current, fork=fork, labels=labels, host=host):
# A pull request runs swift-test only with full-ci (2026-11-05).
if event == "pull_request" and not labels:
self.assertFalse(runs["swift-test"])
self.assertNotEqual(host, "swift-test")
checked_by = [job_id for job_id in HOSTS if folds[job_id]] + (
["generated-files"] if runs["generated-files"] else [])
self.assertEqual(len(checked_by), 1 if gen_routed else 0, checked_by)
Expand All @@ -273,15 +279,19 @@ def test_every_routed_run_builds_once_for_its_generated_files(self):
self.assertEqual(producers, 1)
pr_single += 1
cases += 1
self.assertEqual(cases, 4 * 2 * 2 * 2 * 2 * 4 * 2 * 2 * 2 * 2)
self.assertEqual(cases, 4 * 2 * 2 * 2 * 2 * 4 * 2 * 2 * 2 * 2 * 2)
self.assertGreater(pr_single, 0)

def test_a_pull_request_with_daemon_or_swift_and_generated_inputs_has_one_build_producer(self):
"""HQ#4724's case, spelled out: before, swift-test (or daemon-test) and generated-files both built."""
pr = ("pull_request", "refs/pull/1/merge")
self.assertEqual(self.host(*pr, "true", "true", "all", "false", "", ""), "swift-test")
# A pull request runs swift-test only with full-ci (2026-11-05), so without it the daemon tests
# or the generated-files job's own build check the generated files.
self.assertEqual(self.host(*pr, "true", "true", "all", "false", "", ""), "generated-files")
self.assertEqual(self.host(*pr, "true", "true", "all", "true", "ready", ""), "daemon-test")
self.assertEqual(self.host(*pr, "true", "true", "all", "false", "", "", ("full-ci",)), "swift-test")
self.assertEqual(self.host(*pr, "true", "false", "", "true", "ready", ""), "daemon-test")
self.assertEqual(self.host(*pr, "true", "true", "all", "true", "ready", ""), "swift-test")
self.assertEqual(self.host(*pr, "true", "true", "all", "true", "ready", "", ("full-ci",)), "swift-test")
# No targets: swift-test does not build, so the daemon tests or the job's own build check them.
self.assertEqual(self.host(*pr, "true", "true", "", "true", "ready", ""), "daemon-test")
self.assertEqual(self.host(*pr, "true", "true", "", "false", "", ""), "generated-files")
Expand Down