Repository navigation
ci: Scope macOS and Windows jobs by hunk content (Refs #698, #700) - #898
Merged
Merged
Conversation
…efs #698, #700) Local-Gate: v1 tree=1b5cdebd6a812e60effb482d9b884f8e4e3e0276 secs=1315 lanes=lint:reused@9033feaf1063,rust-test:reused@ee29c75b7e89,cross:reused@482ec24d598e,tier2-linux:run Ci-Attestation: {"at":1792098828,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9033feaf106317cc0d081be1860f2e01bae0a703638a87a59532d0b3c96561a4","lane":"lint","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"a155fd03fa3b0e3b5bb7ac88881ee96b","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9033feaf106317cc0d081be1860f2e01bae0a703638a87a59532d0b3c96561a4","lane":"lint","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"817b747dc45ad33f80e660a15fbf1fc3","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"ee29c75b7e89d02ff106fb39322b380c76147e8cbc736858fc9295a4dc68d3c1","lane":"rust-test","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"597a34920978ceee70d1249eeb8b47e7","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"493fb3ce4e65bc97cb8386afd100b0a2","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"7c64c3c9cfdb1984f34e778e407302e9","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"6155e8870a2a09cabfc149cf29b00d43","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"464efca235570ff26189da66d0ff023a","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"5df0901864e4d47931d2bed1a1e203a7","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792098828,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"482ec24d598e324e115a31ff0350174380cd4ad3ce772ac39856a8142f74f2c2","lane":"cross","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":null,"stamp":"9f6f9dee3f5eb143fd6235b7e8e0232e","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"reused"} Ci-Attestation: {"at":1792100148,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"73ed9a2a211c929930364aa4a706d4fae6cc47355b6b5e30682e11f0cda2a6f6","lane":"tier2-linux","parents":["2a6197562f7059b5da6704e06576e29fbf0bf923"],"secs":1314,"stamp":"33e54448cf627348d932631e5d37a1ad","tree":"1b5cdebd6a812e60effb482d9b884f8e4e3e0276","v":1,"via":"run"}
Member
Author
zackees
enabled auto-merge
October 15, 2026 21:36
Member
Author
|
Review from #897 (keystone meta). This PR also covers #896, so I filed no competing PR. Bug:
|
| block before the hunk | now | should be |
|---|---|---|
#ifdef __linux__ … #else |
{} | macos, windows |
#ifndef __linux__ |
{} | macos, windows |
CMake if(OS_LINUX) … else() |
{} | macos, windows |
#ifdef _WIN32 / #elif defined(__APPLE__) / #else |
{} | {} (unchanged) |
#if FOO … #else |
{} | {} (unchanged) |
There are 90 Linux/BSD-keyed conditionals in libobs/frontend/shared/plugins. Real example: frontend/components/ColorSourceToolbar.cpp:63. A fix that adds a third "nix" member to the universe and filters it out of the result (all 16 existing tests still pass):
patch
diff --git a/ci/scope_content.py b/ci/scope_content.py
index 19774f4c5..f2863c300 100644
--- a/ci/scope_content.py
+++ b/ci/scope_content.py
@@ -23,6 +23,12 @@ C_MAC = re.compile(r"\b(?:__APPLE__|TARGET_OS_\w+|OS_MACOS)\b")
C_WIN = re.compile(r"\b(?:_WIN32|_WIN64|WIN32|_MSC_VER|OS_WINDOWS)\b")
CMAKE_MAC = re.compile(r"\b(?:OS_MACOS|APPLE)\b|PLATFORM_ID:[^>]*\bDarwin\b")
CMAKE_WIN = re.compile(r"\b(?:OS_WINDOWS|WIN32|MSVC)\b|PLATFORM_ID:[^>]*\bWindows\b")
+# Neither macOS nor Windows: only matters for the branches that exclude it
+# (`#else` of `#ifdef __linux__`, `#ifndef __linux__`), which are theirs.
+NIX = "nix"
+C_NIX = re.compile(r"\b(?:__linux__|__linux|__unix__|__FreeBSD__|__DragonFly__|__OpenBSD__|__NetBSD__|OS_LINUX|OS_FREEBSD|OS_POSIX)\b")
+CMAKE_NIX = re.compile(r"\b(?:OS_LINUX|OS_FREEBSD|OS_OPENBSD|OS_POSIX)\b|PLATFORM_ID:[^>]*\b(?:Linux|FreeBSD)\b")
+ALL = frozenset((MAC, WIN, NIX))
C_SUFFIXES = (".c", ".h", ".cpp", ".hpp", ".cc", ".cxx", ".hh", ".m", ".mm")
C_DIRECTIVE = re.compile(r"^\s*#\s*(ifdef|ifndef|if|elif|else|endif)\b(.*)")
@@ -39,11 +45,11 @@ def kind_of(path: str) -> str | None:
def _patterns(kind: str):
- return (C_MAC, C_WIN) if kind == "c" else (CMAKE_MAC, CMAKE_WIN)
+ return (C_MAC, C_WIN, C_NIX) if kind == "c" else (CMAKE_MAC, CMAKE_WIN, CMAKE_NIX)
def mentions(text: str, kind: str) -> set[str]:
- mac, win = _patterns(kind)
+ mac, win, _ = _patterns(kind)
found = set()
if mac.search(text):
found.add(MAC)
@@ -55,20 +61,16 @@ def mentions(text: str, kind: str) -> set[str]:
def selected(cond: str, kind: str, negated: bool = False) -> set[str]:
"""Platforms a branch with this condition can select."""
out: set[str] = set()
- for platform, pattern in zip((MAC, WIN), _patterns(kind)):
- other = WIN if platform == MAC else MAC
+ for platform, pattern in zip((MAC, WIN, NIX), _patterns(kind)):
for m in pattern.finditer(cond):
neg = negated or bool(NEG_BEFORE.search(cond[: m.start()]))
- out.add(other if neg else platform)
+ out |= ALL - {platform} if neg else {platform}
return out
def _complement(platforms: set[str]) -> set[str]:
- if platforms == {MAC}:
- return {WIN}
- if platforms == {WIN}:
- return {MAC}
- return set()
+ """What an `#else` selects after branches that named `platforms`."""
+ return set(ALL - platforms) if platforms else set()
@dataclass
@@ -99,7 +101,7 @@ def enclosing(lines: list[str], kind: str) -> set[str]:
out: set[str] = set()
for block in stack:
out |= block.current
- return out
+ return out - {NIX}
@dataclassPlease add RED tests for the first three rows.
Measured effect (proof for #897)
I replayed this branch's scope() over the last 120 successful Pull runs (each PR's diff, with files read at the PR head):
| before | with #898 | |
|---|---|---|
| runs that start macOS+Windows | 92 / 120 | 58 / 120 |
| native runner-minutes over the 34 runs dropped | 865 | 0 (median 25 per PR) |
- Most of the drop comes from
test/cmocka/tests.d/*.cmakeregistrations: 77 of the PRs that triggered native jobs did so only because of them. - Wall time: since ci: Run Tier 2 Linux ctest with -j4 #837, Linux Tier 2 (~13 min) is the critical path, so a PR that skips native finishes about 0–3 min sooner. The real win is runner-minutes and less macOS queue pressure when many agents share runners. The patch above doesn't change these numbers.
- Single-platform routing works in the replay:
fix/pipe-shell-argv0(rust/obs-util/src/platform/unix/) → macOS only, andfix/obs-enum-outputs-removalandfix/slideshow-manual-empty-clear→ Windows only. Port PRs such asport/platform-cocoastill start both, because they also touchlibobs/cmake/(a shared prefix), which is now the largest remaining trigger after.cppcmocka tests.
This was referenced Oct 15, 2026
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #698, #700. Wine for Windows is not used (#696).
What changes
ci/ci_scope.pynow also readsgit diff -U0(newci/scope_content.py):test/cmocka/tests.d/*.cmakeregistration reaches macOS/Windows only if it mentions that platform (OS_MACOS,APPLE,WIN32,MSVC,PLATFORM_ID,.m/.mm) and reaches both if it adds a.cpp/.hpptest (ci: A new C++ cmocka test skips the macOS and Windows Tier 2 jobs that compile it #610 kept). Plain.ctests stay Linux-only.test/cmocka/CMakeLists.txtand.cpp/.hpptests stay shared.rust/*/src/platform/{macos,windows,unix}*already mapped exactly via the path tokens; now pinned by tests.platform/mod.rsstays shared.#if/if()block selecting a platform (negations and#elsebranches included), turns that platform on. Undecidable means off (Linux covers it, release gate covers the rest).Unchanged:
ci-fulllabel, pushes, merge queue, release gate, and the shared prefixes (.github/,cmake/common/,cmake/finders/,libobs/cmake/, root CMake files). I did not narrow those: every platform consumes them and I found no testable Linux-only subset. Docs:docs/ci-tooling.mdand theci_scope.pydocstring.RED / GREEN
scope()(no hunk input); log at obs-studio-extern/ciscope-red.log.cd ci && uv run python -m unittest test_ci_scope.py->Ran 16 tests ... OK../lintok.ci-lint local-gate runpassed and stamped (the first run hittest_v4l2_busy_signalfailing in Tier 2, unrelated to this Python-only change; it passed on re-run).Before / after: last 40 first-parent commits on master (1627828 and back)
Remaining runs are mostly real:
.github/,libobs/CMakeLists.txt,.cppcmocka tests (frontend), or hunks naming_WIN32and similar.