Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: stop skipping jobs behind PR-only quick; fail a skipped desktop smoke (#6693)

cua-agents[bot]fcf5accfcbee
diff --git a/.github/scripts/tests/test_ci_spaces_desktop_smoke_not_skipped.py b/.github/scripts/tests/test_ci_spaces_desktop_smoke_not_skipped.py
new file mode 100644
index 0000000000..afb40f54ce
--- /dev/null
+++ b/.github/scripts/tests/test_ci_spaces_desktop_smoke_not_skipped.py
@@ -0,0 +1,67 @@
+"""The desktop install smoke must test something, and no quick-gated job may be silently skipped.
+
+`quick` only runs on pull_request. GitHub skips every job behind a skipped job
+(through the whole needs chain) unless its own `if:` calls a status function, so
+a manual dispatch used to go green with the Windows and Linux jobs skipped.
+"""
+
+import re
+from pathlib import Path
+
+import pytest
+import yaml
+
+ROOT = Path(__file__).resolve().parents[3]
+WORKFLOWS = sorted((ROOT / ".github/workflows").glob("*.yml"))
+STATUS = re.compile(r"\b(always|failure|cancelled|success)\(\)")
+SMOKE = ROOT / ".github/workflows/ci-cua-spaces-desktop-install-smoke.yml"
+
+
+def _jobs(path: Path) -> dict:
+ return yaml.safe_load(path.read_text()).get("jobs") or {}
+
+
+def _needs(job: dict) -> list[str]:
+ needs = job.get("needs") or []
+ return [needs] if isinstance(needs, str) else list(needs)
+
+
[email protected]("path", WORKFLOWS, ids=lambda p: p.name)
+def test_no_job_is_skipped_just_because_quick_is_skipped(path: Path) -> None:
+ jobs = _jobs(path)
+ if "if" not in (jobs.get("quick") or {}):
+ pytest.skip("quick is not conditional")
+
+ def behind_quick(job: str, seen: set[str]) -> bool:
+ return any(
+ dep == "quick" or (dep in jobs and dep not in seen and behind_quick(dep, seen | {dep}))
+ for dep in _needs(jobs[job])
+ )
+
+ missing = [
+ job
+ for job, spec in jobs.items()
+ if job != "quick" and behind_quick(job, set()) and not STATUS.search(str(spec.get("if", "")))
+ ]
+ assert not missing, f"{path.name}: skipped whenever quick is skipped: {missing}"
+
+
+def test_smoke_fails_when_its_test_jobs_are_skipped() -> None:
+ jobs = _jobs(SMOKE)
+ verify = jobs["verify"]
+ assert set(_needs(verify)) >= {"windows", "linux"}
+ assert "always()" in str(verify["if"])
+ script = "\n".join(str(s.get("run", "")) for s in verify["steps"])
+ assert "exit 1" in script
+ assert "needs.windows.result" in str(verify["steps"])
+ assert "needs.linux.result" in str(verify["steps"])
+
+
[email protected]("path", WORKFLOWS, ids=lambda p: p.name)
+def test_no_blanket_skipped_needs_check(path: Path) -> None:
+ """Depend on the result of the specific job needed; a blanket check also
+ skipped jobs whose upstream job legitimately ran (observed on the smoke)."""
+ text = path.read_text()
+ assert not re.search(r"contains\(\s*needs\.\*\.result\s*,\s*'skipped'\s*\)", text), (
+ f"{path.name}: use needs.<job>.result == 'success' instead of contains(needs.*.result, 'skipped')"
+ )
diff --git a/.github/scripts/tests/test_e2e_cua_sdk_scope.py b/.github/scripts/tests/test_e2e_cua_sdk_scope.py
index d30a38c832..89c9787b94 100644
--- a/.github/scripts/tests/test_e2e_cua_sdk_scope.py
+++ b/.github/scripts/tests/test_e2e_cua_sdk_scope.py
@@ -363,7 +363,8 @@ def test_workflow_wiring():
assert "needs.changes.outputs.run != 'false'" in jobs[name]["if"], name
assert sorted(jobs["shard"]["needs"]) == sorted(builds)
assert jobs["matrix"]["needs"] == "shard"
- assert "needs" not in jobs["shard"].get("if", "")
+ # The shard is not behind the scope job: it depends only on the build results.
+ assert "needs.changes" not in jobs["shard"].get("if", "")
assert changes["outputs"] == {"run": "${{ steps.scope.outputs.run }}"}
checkout = changes["steps"][0]
assert checkout["with"]["fetch-depth"] == 2
diff --git a/.github/workflows/ci-check-docs.yml b/.github/workflows/ci-check-docs.yml
index 02d7701e38..35766d33ca 100644
--- a/.github/workflows/ci-check-docs.yml
+++ b/.github/workflows/ci-check-docs.yml
@@ -127,7 +127,7 @@ jobs:
native-reference:
name: Reference / ${{ matrix.library }} / ${{ matrix.platform }}
needs: scope
- if: needs.scope.outputs.selected == 'true'
+ if: ${{ !failure() && !cancelled() && needs.scope.result == 'success' && (needs.scope.outputs.selected == 'true') }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.scope.outputs.matrix) }}
diff --git a/.github/workflows/ci-cua-driver-contract-clients.yml b/.github/workflows/ci-cua-driver-contract-clients.yml
index a47d721499..9ae6e722ec 100644
--- a/.github/workflows/ci-cua-driver-contract-clients.yml
+++ b/.github/workflows/ci-cua-driver-contract-clients.yml
@@ -156,7 +156,7 @@ jobs:
mcp-client-discovery:
name: MCP discovery in pinned clients (${{ matrix.os }})
needs: changes
- if: needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_discovery != '[]'
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && (needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_discovery != '[]') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
@@ -217,7 +217,7 @@ jobs:
runtime-parity:
name: Portable contract parity (${{ matrix.os }})
needs: changes
- if: needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_parity != '[]'
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && (needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_parity != '[]') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
@@ -299,7 +299,7 @@ jobs:
verify:
name: Generated contract and SDK bindings
needs: changes
- if: needs.changes.outputs.run == 'true' && contains(needs.changes.outputs.matrix, 'ubuntu') && !contains(fromJSON(needs.changes.outputs.reused), 'Generated contract and SDK bindings')
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && (needs.changes.outputs.run == 'true' && contains(needs.changes.outputs.matrix, 'ubuntu') && !contains(fromJSON(needs.changes.outputs.reused), 'Generated contract and SDK bindings')) }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
diff --git a/.github/workflows/ci-cua-oci-spacesd.yml b/.github/workflows/ci-cua-oci-spacesd.yml
index 1c8fc031ce..fbcaa27d3c 100644
--- a/.github/workflows/ci-cua-oci-spacesd.yml
+++ b/.github/workflows/ci-cua-oci-spacesd.yml
@@ -96,6 +96,7 @@ jobs:
containers:
name: containers (docker, runc)
needs: static
+ if: ${{ !failure() && !cancelled() && needs.static.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
diff --git a/.github/workflows/ci-cua-sandbox-doctor.yml b/.github/workflows/ci-cua-sandbox-doctor.yml
index 8b6b2e4ca3..76b9c68371 100644
--- a/.github/workflows/ci-cua-sandbox-doctor.yml
+++ b/.github/workflows/ci-cua-sandbox-doctor.yml
@@ -102,7 +102,7 @@ jobs:
retention-days: 1
doctor:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ if: ${{ !failure() && !cancelled() && needs.build.result == 'success' && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: Image doctor (overlaid cua-spacesd and cua-driver)
needs: build
runs-on: ubuntu-latest
@@ -148,7 +148,7 @@ jobs:
PY
stale:
- if: ${{ !startsWith(github.head_ref, 'release-please--branches--') }}
+ if: ${{ !failure() && !cancelled() && needs.build.result == 'success' && (!startsWith(github.head_ref, 'release-please--branches--')) }}
name: The bundled builds are reported stale
needs: build
runs-on: ubuntu-latest
diff --git a/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml b/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
index 807229fa44..eedffb4947 100644
--- a/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
+++ b/.github/workflows/ci-cua-spaces-desktop-install-smoke.yml
@@ -62,6 +62,7 @@ jobs:
windows:
name: Windows x64 install, launch, uninstall
needs: resolve
+ if: ${{ !failure() && !cancelled() && needs.resolve.result == 'success' }}
runs-on: windows-latest
env:
RUN_ID: ${{ needs.resolve.outputs.run_id }}
@@ -155,6 +156,7 @@ jobs:
linux:
name: Linux x64 deb and AppImage
needs: resolve
+ if: ${{ !failure() && !cancelled() && needs.resolve.result == 'success' }}
runs-on: ubuntu-latest
env:
RUN_ID: ${{ needs.resolve.outputs.run_id }}
@@ -232,3 +234,20 @@ jobs:
name: gh-linux
path: out
if-no-files-found: warn
+
+ # A smoke run where the real test jobs were skipped must not pass green.
+ verify:
+ name: Smoke jobs ran
+ needs: [resolve, windows, linux]
+ if: ${{ always() }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - env:
+ RESULTS: ${{ needs.resolve.result }} ${{ needs.windows.result }} ${{ needs.linux.result }}
+ run: |
+ echo "resolve windows linux: $RESULTS"
+ if [ "$RESULTS" != "success success success" ]; then
+ echo "::error::the install smoke did not fully run: $RESULTS"
+ exit 1
+ fi
diff --git a/.github/workflows/ci-cua-spaces-macos.yml b/.github/workflows/ci-cua-spaces-macos.yml
index 0fe955802f..c8f9608dfe 100644
--- a/.github/workflows/ci-cua-spaces-macos.yml
+++ b/.github/workflows/ci-cua-spaces-macos.yml
@@ -217,7 +217,7 @@ jobs:
retention-days: 1
swift-tests:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
+ if: ${{ !failure() && !cancelled() && needs.ffi.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft)) }}
name: SwiftUI app (swift tests, bridge contract)
needs: ffi
runs-on: macos-26
@@ -291,7 +291,7 @@ jobs:
# shell's TypeScript) still match the library. These run the bindgen tools
# with cargo, so this job has the Rust toolchain; the other Swift jobs do not.
bindings:
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
+ if: ${{ !failure() && !cancelled() && needs.ffi.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft)) }}
name: SwiftUI and Electron bindings are up to date
needs: ffi
runs-on: macos-26
@@ -337,7 +337,7 @@ jobs:
app-bundle:
# On a pull request only when it changes a packaging path (see `changes`);
# always on main and on a manual run.
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'pull_request' || needs.changes.outputs.packaging == 'true') }}
+ if: ${{ !failure() && !cancelled() && needs.ffi.result == 'success' && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'pull_request' || needs.changes.outputs.packaging == 'true')) }}
name: SwiftUI app (bundle, launch check, XCUITest)
needs: [ffi, changes]
runs-on: macos-26
diff --git a/.github/workflows/ci-cua-spaces-web.yml b/.github/workflows/ci-cua-spaces-web.yml
index 90d0fa7f64..2485478e79 100644
--- a/.github/workflows/ci-cua-spaces-web.yml
+++ b/.github/workflows/ci-cua-spaces-web.yml
@@ -124,6 +124,7 @@ jobs:
parity:
name: parity flows (${{ matrix.host }})
needs: test
+ if: ${{ !failure() && !cancelled() && needs.test.result == 'success' }}
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/ci-cua-spaces.yml b/.github/workflows/ci-cua-spaces.yml
index 5509f36a2a..b1876d8207 100644
--- a/.github/workflows/ci-cua-spaces.yml
+++ b/.github/workflows/ci-cua-spaces.yml
@@ -246,7 +246,7 @@ jobs:
# release-please PRs (fast checks only). Main pushes, manual runs and
# `ci:full` PRs build them.
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.bundle == 'true' && !startsWith(github.head_ref, 'release-please--branches--') && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full'))) }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.bundle == 'true' && !startsWith(github.head_ref, 'release-please--branches--') && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full')))) }}
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/ci-cua-spacesd.yml b/.github/workflows/ci-cua-spacesd.yml
index 41361ee33e..38703e56d3 100644
--- a/.github/workflows/ci-cua-spacesd.yml
+++ b/.github/workflows/ci-cua-spacesd.yml
@@ -156,7 +156,7 @@ jobs:
test:
name: fmt, clippy, test (${{ matrix.os }})
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_test != '[]') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.run == 'true' && needs.changes.outputs.legs_test != '[]')) }}
strategy:
fail-fast: false
matrix:
@@ -335,7 +335,7 @@ jobs:
relay-e2e:
name: relay e2e (docker)
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.run == 'true' && contains(needs.changes.outputs.matrix, 'ubuntu') && !contains(fromJSON(needs.changes.outputs.reused), 'relay e2e (docker)')) }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (needs.changes.outputs.run == 'true' && contains(needs.changes.outputs.matrix, 'ubuntu') && !contains(fromJSON(needs.changes.outputs.reused), 'relay e2e (docker)'))) }}
runs-on: ubuntu-latest
timeout-minutes: 60
defaults:
diff --git a/.github/workflows/e2e-cua-sdk.yml b/.github/workflows/e2e-cua-sdk.yml
index 1f6475f0c6..5ddaaeac17 100644
--- a/.github/workflows/e2e-cua-sdk.yml
+++ b/.github/workflows/e2e-cua-sdk.yml
@@ -166,7 +166,7 @@ jobs:
build-sdk:
name: build / release SDK
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false')) }}
runs-on: ubuntu-latest
timeout-minutes: 150
env:
@@ -208,7 +208,7 @@ jobs:
build-cli:
name: build / debug CLI, TypeScript, wasm
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false')) }}
runs-on: ubuntu-latest
timeout-minutes: 150
env:
@@ -256,7 +256,7 @@ jobs:
build-fixtures:
name: build / fixtures, static cua-spacesd
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false')) }}
runs-on: ubuntu-latest
timeout-minutes: 150
env:
@@ -309,7 +309,7 @@ jobs:
build-rust-tests:
name: build / Rust test binaries
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false')) }}
runs-on: ubuntu-latest
timeout-minutes: 150
env:
@@ -350,7 +350,7 @@ jobs:
build-images:
name: build / reference images
needs: changes
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false') }}
+ if: ${{ !failure() && !cancelled() && needs.changes.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && (!startsWith(github.head_ref, 'release-please--branches--') && needs.changes.outputs.run != 'false')) }}
runs-on: ubuntu-latest
timeout-minutes: 120
env:
@@ -387,7 +387,7 @@ jobs:
shard:
# The nightly runs the build jobs only to save their caches; its suite is `live`.
- if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && github.event_name != 'schedule' }}
+ if: ${{ !failure() && !cancelled() && needs.build-sdk.result == 'success' && needs.build-cli.result == 'success' && needs.build-fixtures.result == 'success' && needs.build-rust-tests.result == 'success' && needs.build-images.result == 'success' && ((github.event_name != 'pull_request' || !github.event.pull_request.draft) && github.event_name != 'schedule') }}
name: tests (shard ${{ matrix.shard }})
needs: [build-sdk, build-cli, build-fixtures, build-rust-tests, build-images]
runs-on: ubuntu-24.04