diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 86bba0e736..452e4d6f84 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -2180,15 +2180,14 @@ jobs: # lanes, so COFF-only link defects reached master (`undefined symbol: # obs_encoder_get_caps`, merge_group 42390201886 green, push 42393067345 # red). This is only the cross lane's link step for Windows x64: no clippy, - # Dylint; selected Tier 2 links also cover Darwin, nothing executed. + # Dylint. Selected Tier 2 links run in the independent alias matrix below. rust-windows-link: timeout-minutes: 30 name: Windows Link Check 🔗 (x86_64-pc-windows-msvc) runs-on: ${{ inputs.mq-heavy-labels != '' && fromJSON(inputs.mq-heavy-labels) || 'ubuntu-26.04' }} needs: [check-event, ci-mode] - # Every fallback non-docs PR links categories. Tier 2 selections always run - # before the queue: existing client proofs do not attest these CMake links. - if: ${{ (github.event_name != 'pull_request' || needs.ci-mode.outputs.fast_path != 'true' || needs.check-event.outputs.cmocka_link == 'true') && !inputs.flatpak-measurement-only && !inputs.native-cache-measurement-only && needs.check-event.outputs.deferred == 'true' && needs.check-event.outputs.docs_only != 'true' && needs.check-event.outputs.windows_link == 'true' }} + # Category links retain their existing member-admission policy. + if: ${{ (github.event_name != 'pull_request' || needs.ci-mode.outputs.fast_path != 'true') && !inputs.flatpak-measurement-only && !inputs.native-cache-measurement-only && needs.check-event.outputs.deferred == 'true' && needs.check-event.outputs.docs_only != 'true' && needs.check-event.outputs.windows_link == 'true' }} defaults: run: shell: bash @@ -2225,14 +2224,67 @@ jobs: save-cache: ${{ github.ref == 'refs/heads/master' }} cache-suffix: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || '' }} - - name: Set Up Native Link Tools - run: sudo apt-get update -qq && sudo apt-get install -y cmake ninja-build pkg-config - - name: Link Windows Test Binaries 🔗 env: - OBS_CMOCKA_LINK: ${{ needs.check-event.outputs.cmocka_link }} + OBS_CMOCKA_LINK: 'false' run: uv run --no-project ci/windows_link_check.py + cmocka-link: + timeout-minutes: 30 + name: Tier 2 Link Check 🔗 (${{ matrix.alias }}) + runs-on: ${{ inputs.mq-heavy-labels != '' && fromJSON(inputs.mq-heavy-labels) || 'ubuntu-26.04' }} + needs: [check-event, ci-mode] + # Both full inventories are required independently, including attested PRs. + # No category or other alias dependency: the three link legs can overlap. + if: ${{ !inputs.flatpak-measurement-only && !inputs.native-cache-measurement-only && needs.check-event.outputs.deferred == 'true' && needs.check-event.outputs.docs_only != 'true' && needs.check-event.outputs.cmocka_link == 'true' }} + strategy: + fail-fast: false + matrix: + alias: [win-x64, mac-arm64] + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set Up soldr 🦀 + uses: zackees/setup-soldr@db9aa035e488f4dde7d31d5c8cb4ec20ec99c6c1 # merge of forge-ci/setup-soldr#676: persistent-root cook store and recipes (#675) + with: + # Same scope and layer as rust-cross-lint, so it replays master's cache. + verdict-scope: build-project + version: 0.9.45 + build-cache: false + # Cross-release archives and Corrosion use separate target trees (#5224). + prebuild-deps: none + cargo-registry-cache: true + cache-key-suffix: linux-host-v3 + save-cache-remote: ${{ github.ref == 'refs/heads/master' }} + # The Windows target is added mid-job (see rust-cross-lint, #969). + solo-toolchain-cache: false + # S3 remote cache: bucket forge-ci on DO Spaces nyc3; the 50G watermark is + # enforced only on the merge_group singleton. No bucket/creds = feature off. + s3-bucket: forge-ci + s3-endpoint: nyc3.digitaloceanspaces.com + s3-region: nyc3 + s3-cache-limit: 50G + env: + SOLDR_S3_CACHE_ACCESS_KEY: ${{ secrets.SOLDR_S3_CACHE_ACCESS_KEY }} + SOLDR_S3_CACHE_SECRET_KEY: ${{ secrets.SOLDR_S3_CACHE_SECRET_KEY }} + + - name: Set Up uv 🐍 + uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + with: + save-cache: ${{ github.ref == 'refs/heads/master' }} + cache-suffix: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || '' }} + + # uv wheels avoid the 165 s apt mirror setup observed in run 44495240642. + # CMake 3.31 retains clang-cl /showIncludes, understood by pinned ccache; + # 4.3 forwards -clang:-M* dependency flags which ccache cannot cache. + - name: Link Tier 2 Fixtures 🔗 + run: uv run --no-project --with cmake==3.31.10 --with ninja==1.13.0 ci/cmocka_link_check.py --alias ${{ matrix.alias }} + rust-cross-lint-release: timeout-minutes: 45 name: Rust Cross Lint 🦀 (release targets) diff --git a/ci/ci_scope.py b/ci/ci_scope.py index 9ac3121a15..e955923cc2 100644 --- a/ci/ci_scope.py +++ b/ci/ci_scope.py @@ -171,7 +171,7 @@ class Scope: "cmocka_link": ( "libobs/**", "rust/libobs-rust/**", "rust/obs-build/**", "test/cmocka/**", "deps/**", "cmake/cross/**", "cmake/common/soldr.cmake", "ci/cmocka_link_check.py", - "ci/windows_link_check.py", "ci/ci_scope.py", ".github/workflows/build-project.yaml", + "ci/windows_link_check.py", "ci/tier2_front_cache.py", "ci/ci_scope.py", ".github/workflows/build-project.yaml", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "CMakeLists.txt", ), "tier2": ( diff --git a/ci/cmocka_link_check.py b/ci/cmocka_link_check.py index 043b8b9e97..5e64de3f50 100644 --- a/ci/cmocka_link_check.py +++ b/ci/cmocka_link_check.py @@ -15,9 +15,11 @@ import shlex import subprocess import time +import tempfile from pathlib import Path import local_gate +import tier2_front_cache ROOT = Path(__file__).resolve().parent.parent TRIPLES = {"win-x64": "x86_64-pc-windows-msvc", "mac-arm64": "aarch64-apple-darwin"} @@ -77,13 +79,45 @@ def query(option: str) -> str: return path +def cache_env(work: Path, tools: Path | None = None) -> dict[str, str]: + """Fresh per-pass cache: share identical support compiles, never link results.""" + # Keep the launcher command stable for kept Ninja trees; only cached objects + # and policy are ephemeral. The installer re-verifies its pinned binary. + binary = tier2_front_cache.install(tools or work) + config = work / "ccache.conf" + config.write_text("") + env = {key: value for key, value in local_gate.soldr_env().items() if not key.startswith("CCACHE_")} + env.update(CCACHE_CONFIGPATH=str(config), CCACHE_DIR=str(work / "objects"), + CCACHE_MAXSIZE="512M", CCACHE_COMPILERCHECK="content", + CMAKE_C_COMPILER_LAUNCHER=str(binary), CMAKE_CXX_COMPILER_LAUNCHER=str(binary)) + return env + + +def build_targets(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None: + targets = discover_targets(work / ".cmake/api/v1/reply") + (work / "link-targets.json").write_text(json.dumps(targets, indent=2) + "\n") + print(f"Tier 2 {alias}: linking hybrid libobs and {len(targets) - 1} Rust fixtures ({jobs} Ninja workers)", flush=True) + subprocess.run(["cmake", "--build", str(work), "--parallel", str(jobs), "--target", *targets, + "--", "-k", "0"], cwd=ROOT, env=env, check=True) + + def link(alias: str, work: Path, jobs: int) -> None: + with tempfile.TemporaryDirectory(prefix="cmocka-link-cache-") as directory: + env = cache_env(Path(directory), work / "compiler-cache") + try: + _link(alias, work, jobs, env) + finally: + subprocess.run([env["CMAKE_C_COMPILER_LAUNCHER"], "--show-stats"], env=env, check=False) + + +def _link(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None: started = time.monotonic() target = TRIPLES[alias] local_gate.add_target(target) # Invoke Cargo even on a warm tree: the cross project's legacy custom # command only depends on manifests, which cannot detect a Rust source edit. local_gate.soldr_cargo(["build", "--release", "--locked", "--target", target, "-p", "libobs-rust"]) + print(f"Tier 2 {alias}: Rust archive ready in {time.monotonic() - started:.2f}s", flush=True) work.mkdir(parents=True, exist_ok=True) wrappers = work / "soldr-tools" wrappers.mkdir(exist_ok=True) @@ -97,18 +131,18 @@ def link(alias: str, work: Path, jobs: int) -> None: query.touch() archiver = subprocess.run(["soldr", "cc", "--target", target, "--print-ar"], cwd=ROOT, capture_output=True, text=True, check=True).stdout.strip() - env = local_gate.soldr_env({"OBS_CROSS_TARGET": alias, "SOLDR_PORCELAIN": "0", - f"AR_{target.replace('-', '_')}": archiver}) + env = dict(env, OBS_CROSS_TARGET=alias, SOLDR_PORCELAIN="0") + env[f"AR_{target.replace('-', '_')}"] = archiver + configured = time.monotonic() subprocess.run(["cmake", "-S", str(ROOT), "-B", str(work), "-G", "Ninja", f"-DOBS_CROSS_TARGET={alias}", "-DOBS_CROSS_LINK=ON", "-DOBS_CROSS_TIER2=ON", "-DCMAKE_BUILD_TYPE=Release", f"-DRust_CARGO={wrappers / 'cargo'}", f"-DRust_COMPILER={wrappers / 'rustc'}", f"-DRust_CARGO_TARGET={target}", - "-DOBS_TEST_SANITIZE_PER_TARGET=OFF", *toolchain_args], cwd=ROOT, env=env, check=True) - targets = discover_targets(work / ".cmake/api/v1/reply") - (work / "link-targets.json").write_text(json.dumps(targets, indent=2) + "\n") - print(f"Tier 2 {alias}: linking hybrid libobs and {len(targets) - 1} Rust fixtures", flush=True) - subprocess.run(["cmake", "--build", str(work), "--parallel", str(jobs), "--target", *targets, - "--", "-k", "0"], cwd=ROOT, env=env, check=True) + "-DOBS_TEST_SANITIZE_PER_TARGET=OFF", + f"-DCMAKE_C_COMPILER_LAUNCHER={env['CMAKE_C_COMPILER_LAUNCHER']}", + f"-DCMAKE_CXX_COMPILER_LAUNCHER={env['CMAKE_CXX_COMPILER_LAUNCHER']}", *toolchain_args], cwd=ROOT, env=env, check=True) + print(f"Tier 2 {alias}: configured in {time.monotonic() - configured:.2f}s", flush=True) + build_targets(alias, work, jobs, env) print(f"Tier 2 {alias}: linked in {time.monotonic() - started:.2f}s", flush=True) @@ -116,7 +150,7 @@ def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--alias", choices=TRIPLES, default="win-x64") parser.add_argument("--build", type=Path) - parser.add_argument("--jobs", type=int, default=min(4, os.cpu_count() or 1)) + parser.add_argument("--jobs", type=int, default=min(4, os.process_cpu_count() or 1)) args = parser.parse_args() if args.jobs < 1: parser.error("--jobs must be positive") diff --git a/ci/gate_jobs.py b/ci/gate_jobs.py index 2befd12959..03acfaf1ec 100644 --- a/ci/gate_jobs.py +++ b/ci/gate_jobs.py @@ -125,6 +125,12 @@ def data_selected(files) -> bool: )) for path in files) +def cmocka_jobs(selected: Scope) -> set[str]: + """Both alias jobs are required whenever the Tier 2 link lane is selected.""" + return ({f"Build 🧱 / Tier 2 Link Check 🔗 ({alias})" for alias in ("win-x64", "mac-arm64")} + if getattr(selected, "cmocka_link", False) else set()) + + def expected_jobs(selected: Scope, files: list[str] | tuple[str, ...] = ()) -> set[str]: """The queue execution manifest: exact job names, never proof credit. @@ -137,6 +143,7 @@ def expected_jobs(selected: Scope, files: list[str] | tuple[str, ...] = ()) -> s expected.add("Build 🧱 / Fast Gate ⚡") if selected.windows_link: expected.add("Build 🧱 / Windows Link Check 🔗 (x86_64-pc-windows-msvc)") + expected.update(cmocka_jobs(selected)) if selected.cross_lint: expected.update({ "Build 🧱 / Rust Cross Lint 🦀 (x86_64-pc-windows-msvc)", @@ -198,8 +205,7 @@ def pr_expected_jobs(selected: Scope, files: list[str], plan: dict) -> set[str]: expected -= heavy # Existing client proofs cover category links, not the cmocka CMake # pass. The base-owned selector must witness that pass even on fast PRs. - if getattr(selected, "cmocka_link", False): - expected.add("Build 🧱 / Windows Link Check 🔗 (x86_64-pc-windows-msvc)") + expected.update(cmocka_jobs(selected)) for key, job_names in names.items(): status = plan["jobs"].get(key, {}) needed = status.get("required_gates", []) diff --git a/ci/test_ci_scope.py b/ci/test_ci_scope.py index 06ed453cef..dc2eec78cd 100644 --- a/ci/test_ci_scope.py +++ b/ci/test_ci_scope.py @@ -315,7 +315,7 @@ def test_queue_runner_selection_preserves_hosted_fallbacks(self): heavy = { "rust-cross-lint", "rust-cross-lint-release", "rust-tests-macos-build", - "rust-linux-tier2-build", "rust-linux-tier2", "rust-windows-link", + "rust-linux-tier2-build", "rust-linux-tier2", "rust-windows-link", "cmocka-link", } light = { "ci.yml": { @@ -435,6 +435,26 @@ def test_queue_runs_merge_result_tests_and_windows_link(self): self.assertIn('echo "windows_link=${windows_link:-true}"', text) self.assertIn("(github.event_name == 'merge_group' || needs.ci-mode.outputs.rust-test_hit != 'true')", text) + def test_both_cmocka_aliases_are_independent_selected_jobs(self): + from test_windows_link_check import job_block + + block = job_block("cmocka-link") + self.assertIn("alias: [win-x64, mac-arm64]", block) + self.assertIn("fail-fast: false", block) + self.assertIn("needs: [check-event, ci-mode]", block) + condition = next(line for line in block.splitlines() if line.startswith(" if:")) + self.assertIn("outputs.cmocka_link == 'true'", condition) + self.assertNotIn("fast_path", condition) + self.assertNotIn("apt-get", block) + self.assertIn("--with cmake==3.31.10 --with ninja==1.13.0", block) + self.assertIn("ci/cmocka_link_check.py --alias ${{ matrix.alias }}", block) + gate = (ROOT / ".github/workflows/ci.yml").read_text() + self.assertIn("build-project", gate.split(" ci-gate:", 1)[1].split(" steps:", 1)[0]) + for event in ("pull_request", "merge_group"): + for path in ("libobs/obs.c.h", "ci/cmocka_link_check.py", "ci/tier2_front_cache.py"): + with self.subTest(event=event, path=path): + self.assertTrue(scope([path], event=event).cmocka_link) + def test_core_file_content_is_not_read(self): # Core files carry no platform defines (the ratchet lint enforces # it), so a core file is Linux-only whatever it contains (#897). diff --git a/ci/test_cmocka_link_check.py b/ci/test_cmocka_link_check.py index 980f9a5f93..a984901fa0 100644 --- a/ci/test_cmocka_link_check.py +++ b/ci/test_cmocka_link_check.py @@ -62,6 +62,56 @@ def test_windows_uses_managed_clang_cl_and_the_target_sdk(self): self.assertIn("--target=x86_64-pc-windows-msvc", wrapper) +class BuildTest(unittest.TestCase): + def test_each_alias_builds_the_full_inventory_at_the_cpu_budget(self): + inventory = ["libobs-cross-shared", "test_existing_rust", "test_new_steps_rust"] + for alias in cmocka_link_check.TRIPLES: + with self.subTest(alias=alias), tempfile.TemporaryDirectory() as temporary: + work = Path(temporary) + with mock.patch.object(cmocka_link_check, "discover_targets", return_value=inventory), \ + mock.patch.object(cmocka_link_check.subprocess, "run") as run: + cmocka_link_check.build_targets(alias, work, 3, {}) + args = run.call_args.args[0] + self.assertEqual(args[args.index("--parallel") + 1], "3") + self.assertEqual(args[args.index("--target") + 1:args.index("--")], inventory) + self.assertEqual(json.loads((work / "link-targets.json").read_text()), inventory) + + def test_alias_link_failures_propagate(self): + import subprocess + + for alias in cmocka_link_check.TRIPLES: + with self.subTest(alias=alias), tempfile.TemporaryDirectory() as temporary: + work = Path(temporary) + failure = subprocess.CalledProcessError(1, ["cmake", "--build"]) + with mock.patch.object(cmocka_link_check, "discover_targets", return_value=["libobs-cross-shared", "test_existing_rust"]), \ + mock.patch.object(cmocka_link_check.subprocess, "run", side_effect=failure): + with self.assertRaises(subprocess.CalledProcessError): + cmocka_link_check.build_targets(alias, work, 2, {}) + + def test_kept_tree_uses_a_stable_verified_launcher_with_a_fresh_cache(self): + with tempfile.TemporaryDirectory() as temporary: + work = Path(temporary) + tools = work / "build" / "compiler-cache" + with mock.patch.object(cmocka_link_check.tier2_front_cache, "install", return_value=tools / "ccache") as install: + env = cmocka_link_check.cache_env(work, tools) + install.assert_called_once_with(tools) + self.assertEqual(env["CMAKE_C_COMPILER_LAUNCHER"], str(tools / "ccache")) + self.assertEqual(env["CCACHE_DIR"], str(work / "objects")) + + def test_cache_is_fresh_and_cannot_inherit_relaxed_or_remote_policy(self): + with tempfile.TemporaryDirectory() as temporary: + work = Path(temporary) + with mock.patch.object(cmocka_link_check.tier2_front_cache, "install", return_value=work / "ccache"), \ + mock.patch.dict("os.environ", {"CCACHE_SLOPPINESS": "time_macros", "CCACHE_REMOTE_STORAGE": "remote", "CCACHE_PREFIX": "unsafe"}): + env = cmocka_link_check.cache_env(work) + self.assertNotIn("CCACHE_SLOPPINESS", env) + self.assertNotIn("CCACHE_REMOTE_STORAGE", env) + self.assertNotIn("CCACHE_PREFIX", env) + self.assertEqual(Path(env["CCACHE_CONFIGPATH"]).read_text(), "") + self.assertEqual(env["CCACHE_MAXSIZE"], "512M") + self.assertEqual(env["CCACHE_COMPILERCHECK"], "content") + + class DiscoveryTest(unittest.TestCase): def test_uses_generated_target_types_and_names_not_source_regexes(self): with tempfile.TemporaryDirectory() as temporary: diff --git a/ci/test_cook_profiles.py b/ci/test_cook_profiles.py index 5d0a4c3ef3..2daad99a59 100644 --- a/ci/test_cook_profiles.py +++ b/ci/test_cook_profiles.py @@ -36,6 +36,8 @@ def test_build_consumers_declare_the_profile_policy(self): "rust-cross-lint": "--profile dev -- --tests", "rust-cross-lint-release": "--profile dev -- --tests", "rust-tests-macos-build": "--profile dev -- --tests", + "rust-windows-link": "--profile dev -- --tests", + "cmocka-link": None, "rust-tests-windows": "--profile dev -- --tests", # Corrosion-only build, its own target dir: no cook (#3027). "rust-linux-tier2-build": None, diff --git a/ci/test_gate_jobs.py b/ci/test_gate_jobs.py index 3791f11a06..cbece7bc17 100644 --- a/ci/test_gate_jobs.py +++ b/ci/test_gate_jobs.py @@ -102,7 +102,14 @@ def test_complete_pr_requires_proven_gates_and_active_queue_policy(self): plan = pr_attestation.admission(result, files, event="pull_request") windows_link = "Build 🧱 / Windows Link Check 🔗 (x86_64-pc-windows-msvc)" expected = gate_jobs.pr_expected_jobs(selected, files, plan) - self.assertEqual(expected, {gate_jobs.SCOPE_JOB, "Build 🧱 / CI Mode 🛂", windows_link}) + cmocka = {f"Build 🧱 / Tier 2 Link Check 🔗 ({alias})" for alias in ("win-x64", "mac-arm64")} + self.assertEqual(expected, {gate_jobs.SCOPE_JOB, "Build 🧱 / CI Mode 🛂", *cmocka}) + for name in cmocka: + healthy = [job(n, "success") for n in expected if n != name] + for conclusion in ("skipped", "cancelled", "failure"): + self.assertEqual(blocking([*healthy, job(name, conclusion)], expected=expected), [name]) + self.assertEqual(blocking(healthy, expected=expected), [name]) + expected = gate_jobs.pr_expected_jobs(selected, files, {}) healthy = [job(name, "success") for name in expected if name != windows_link] self.assertEqual(blocking(healthy, expected=expected), [windows_link]) self.assertEqual(blocking([*healthy, job(windows_link, "skipped")], expected=expected), [windows_link]) @@ -121,6 +128,8 @@ def test_queue_manifest_requires_each_selected_leg_despite_proofs(self): selected = scope(["libobs/obs.c.h", ".github/workflows/build-project.yaml"], event="merge_group") expected = gate_jobs.expected_jobs(selected) required = { + "Build 🧱 / Tier 2 Link Check 🔗 (win-x64)", + "Build 🧱 / Tier 2 Link Check 🔗 (mac-arm64)", "Build 🧱 / Cross Compile 🧰 (mac-arm64,win-x64)", "Build 🧱 / Rust Tests 🦀 (macos-26)", "Build 🧱 / Rust Tests 🦀 (windows-2025-vs2026)", diff --git a/ci/test_pr_attestation.py b/ci/test_pr_attestation.py index 1e494796d5..4c01623159 100644 --- a/ci/test_pr_attestation.py +++ b/ci/test_pr_attestation.py @@ -390,7 +390,7 @@ def test_planner_outputs_drive_actual_workflow_job_allocation(self): scope_values["cross_lint"] = "true" scope_values["cross_targets"] = "win-x64" for name in ("rust-tests-linux", "rust-cross-lint", "rust-cross-lint-release", - "rust-windows-link", "cross-compile", "rust-linux-tier2-build", + "rust-windows-link", "cmocka-link", "cross-compile", "rust-linux-tier2-build", "linux-qt-frontend", "rust-tests-windows", "rust-tier2-windows"): header = job_block(build, name).split(" steps:", 1)[0] condition = re.search(r"^ if: (.+)$", header, re.M)[1] @@ -408,7 +408,7 @@ def test_planner_outputs_drive_actual_workflow_job_allocation(self): expression = re.sub(r"!(?!=)", " not ", expression) allocated = eval(expression, {"__builtins__": {}, "fromJSON": json.loads}) # Category deferral cannot stand down the selected CMake pass. - must_run = case != "complete" or (name == "rust-windows-link" and selected.cmocka_link) + must_run = case != "complete" or (name == "cmocka-link" and selected.cmocka_link) self.assertEqual(bool(allocated), must_run, (case, name, condition, plan)) swift = job_block(formatting, "swift-format") self.assertIn("inputs.swift", swift) diff --git a/ci/test_rust_cache_policy.py b/ci/test_rust_cache_policy.py index 1d3ecd5970..b850615c19 100644 --- a/ci/test_rust_cache_policy.py +++ b/ci/test_rust_cache_policy.py @@ -22,7 +22,7 @@ def test_bypassed_compiler_store_is_not_transferred(self): "Do not transfer an embedded store while its Rust consumer is bypassed") self.assertNotRegex(step, r"(?m)^ cache: false$", "Preserve the other cache layers") - if any(issue in step for issue in ("(#3027)", "(#3034)", "(#3767)")): + if any(issue in step for issue in ("(#3027)", "(#3034)", "(#3767)", "(#5224)")): # Tier 2 uses separate target trees; Cross Compile # has no host Rust consumer. Neither reuses this cook. cook_free += 1 @@ -30,8 +30,8 @@ def test_bypassed_compiler_store_is_not_transferred(self): continue self.assertIn("prebuild-deps-flags:", step) self.assertNotIn("prebuild-deps: none", step) - self.assertEqual(found, 13, "Audit new setup-soldr consumers explicitly") - self.assertEqual(cook_free, 4, "Audit each consumer that skips cook explicitly") + self.assertEqual(found, 14, "Audit new setup-soldr consumers explicitly") + self.assertEqual(cook_free, 5, "Audit each consumer that skips cook explicitly") def test_all_consumers_inherit_the_rust_wrapper_bypass(self): for name in WORKFLOWS: diff --git a/ci/test_windows_link_check.py b/ci/test_windows_link_check.py index f78d7333bb..b64fcfb230 100644 --- a/ci/test_windows_link_check.py +++ b/ci/test_windows_link_check.py @@ -44,10 +44,19 @@ def test_main_adds_target_then_links_through_soldr(self): calls = [] with mock.patch.object(windows_link_check.local_gate, "add_target", lambda t: calls.append(("add", t))), \ mock.patch.object(windows_link_check.local_gate, "soldr_cargo", lambda a: calls.append(("cargo", a))), \ - mock.patch.dict(windows_link_check.os.environ, {"OBS_CMOCKA_LINK": "false"}): + mock.patch.dict("os.environ", {"OBS_CMOCKA_LINK": "false"}): self.assertEqual(windows_link_check.main(), 0) self.assertEqual(calls, [("add", "x86_64-pc-windows-msvc"), ("cargo", windows_link_check.link_args())]) + def test_categories_do_not_serialize_cmocka_passes(self): + with mock.patch.object(windows_link_check.local_gate, "add_target"), \ + mock.patch.object(windows_link_check.local_gate, "soldr_cargo") as cargo, \ + mock.patch("cmocka_link_check.link") as link, \ + mock.patch.dict("os.environ", {"OBS_CMOCKA_LINK": "false"}): + self.assertEqual(windows_link_check.main(), 0) + cargo.assert_called_once_with(windows_link_check.link_args()) + link.assert_not_called() + def test_selected_tier2_pass_links_after_categories(self): with mock.patch.object(windows_link_check.local_gate, "add_target"), \ mock.patch.object(windows_link_check.local_gate, "soldr_cargo"), \ @@ -90,6 +99,7 @@ def setUp(self): def test_runs_the_script_in_one_line(self): self.assertIn("run: uv run --no-project ci/windows_link_check.py", self.block) + self.assertIn("OBS_CMOCKA_LINK: 'false'", self.block) def test_selected_on_the_deferred_pr_tier(self): self.assertIn("needs.check-event.outputs.deferred == 'true'", self.condition) @@ -101,7 +111,8 @@ def test_never_stands_down_on_proofs_or_attestation(self): for skip in ("cross_hit", "skip_rust-cross-lint", "cross_lint", "outputs.windows =="): self.assertNotIn(skip, self.condition) self.assertIn("needs.check-event.outputs.docs_only != 'true'", self.condition) - self.assertIn("|| needs.check-event.outputs.cmocka_link == 'true'", self.condition) + self.assertNotIn("outputs.cmocka_link", self.condition) + self.assertNotIn("apt-get", self.block) def test_is_linux_hosted_and_bounded(self): self.assertIn("inputs.mq-heavy-labels", self.block) diff --git a/ci/windows_link_check.py b/ci/windows_link_check.py index a997759cb1..6641a7fe61 100644 --- a/ci/windows_link_check.py +++ b/ci/windows_link_check.py @@ -6,6 +6,8 @@ uv run --no-project ci/windows_link_check.py +CI runs categories independently with OBS_CMOCKA_LINK=false; the two required +cmocka-link matrix jobs own Tier 2 coverage. Local default coverage is unchanged. Every non-docs fallback PR and merge group links the eight category binaries, including the C oracle (#3919). For libobs and registration/support changes, LANES["cmocka_link"] also selects Windows and Darwin hybrid libobs and every configured cmocka diff --git a/docs/ci-tooling.md b/docs/ci-tooling.md index 4cb1cf4ebe..e0f5195b07 100644 --- a/docs/ci-tooling.md +++ b/docs/ci-tooling.md @@ -257,19 +257,19 @@ cmake --build build --target cross-win-x64 # cross-mac-arm64, cross-mac-x64 #### Tier 2 pre-queue links (#5189) -The existing Linux-hosted Windows Link Check also links hybrid libobs and every -configured cmocka `*_rust` executable for Windows MSVC x86_64 and Darwin arm64 +The Linux-hosted Tier 2 Link Check matrix links hybrid libobs and every +configured cmocka `*_rust` executable independently for Windows MSVC x86_64 and Darwin arm64 when `LANES["cmocka_link"]` selects the change. This includes libobs, its linked crates, obs-build registration/support, cmocka, Cargo inputs and the check's own implementation. Unrelated changes keep -the eight Rust category links. The same check runs on PRs and merge groups; +the eight Rust category links in the independent Windows Link Check. The same check runs on PRs and merge groups; selected cmocka links also run on fully attested member PRs because existing client proofs do not attest this CMake pass. Category-only work keeps its existing admission policy. ```sh -uv run --no-project ci/cmocka_link_check.py -uv run --no-project ci/cmocka_link_check.py --alias mac-arm64 +uv run --no-project --with cmake==3.31.10 --with ninja==1.13.0 ci/cmocka_link_check.py +uv run --no-project --with cmake==3.31.10 --with ninja==1.13.0 ci/cmocka_link_check.py --alias mac-arm64 ``` The root CMake cross-link mode includes the unchanged cmocka graph and deferred @@ -278,8 +278,19 @@ conditions have been evaluated; an empty Rust inventory fails. The check builds against real target cmocka and SDK libraries, never executes target programs, and saves `link-targets.json` in its build tree. It always refreshes the Rust archive through soldr so source-only edits cannot reuse the cross project's -manifest-only custom-command result. Ninja parallelism defaults to four and the -existing job retains its 30-minute deadline and Linux heavy-pool routing. +manifest-only custom-command result. Ninja uses the process CPU budget, capped at +four workers. Each alias uses a fresh 512M ccache from the checksum-pinned +`ci/tier2_front_cache.py` installer to share identical support-file compiles +within that pass. No cache is uploaded, no relaxed policy is inherited, and +the cache never stores link results. The matrix disables fail-fast so one failing alias cannot +cancel the other. Both aliases are independently required by `ci/gate_jobs.py`, +including attested PRs; CI Gate waits for the entire reusable build workflow. +The jobs retain the 30-minute deadline and existing Linux heavy-pool routing. +The local `ci/windows_link_check.py` default still runs categories and both +cmocka aliases; CI sets `OBS_CMOCKA_LINK=false` only on the category job. +Pinned CMake 3.31.10/Ninja 1.13.0 uv wheels avoid apt setup on this path +(#5224). CMake 3.31 uses clang-cl `/showIncludes`; CMake 4.3 +forwards dependency flags that the pinned ccache rejects as uncacheable. Darwin uses the production hidden-symbol list and the Rust crate's existing SDK framework imports. Library discovery stays in the Apple SDK and target deps; host Linux libraries cannot satisfy Darwin probes. A successful link does not