Skip to content

Commit 464b32f

Browse files
alexreinkingclaude
andauthored
Skip CI builds for PRs that only touch build/test-irrelevant files (#369)
Docs, GitHub Actions config, the legacy Makefile build, unreachable demo apps, and dev-only tooling scripts can't affect the outcome of this buildbot's CMake configure/build/ctest pipeline, so PRs touching only those paths no longer schedule a build. Also authenticates the GitHub PR-files API lookup (via the existing GITHUB_TOKEN) to reduce the chance of a rate-limited/truncated file list; the filter fails open (never skips) when the file list is empty. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 849be49 commit 464b32f

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

master/master.cfg

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# ex: set syntax=python:
33
# vim: set syntax=python:
44
# comment
5+
import fnmatch
56
import logging
67
import operator
78
import os
@@ -1078,13 +1079,86 @@ def create_builders():
10781079

10791080
c["builders"] = list(create_builders())
10801081

1082+
1083+
# Paths that cannot affect the outcome of this buildbot's CMake configure/build/ctest
1084+
# pipeline (it never invokes the legacy Makefile, builds docs, runs pip packaging, or
1085+
# runs clang-tidy/pre-commit). fnmatch's `*` already matches across `/`, so these behave
1086+
# like `**` globs without needing separate syntax.
1087+
_IGNORABLE_PATH_GLOBS = [
1088+
# GitHub Actions / GitHub metadata -- this buildbot doesn't use GH Actions at all
1089+
".github/*",
1090+
# Root-level and nested docs
1091+
"*.md",
1092+
"doc/*", # Doxygen docs; WITH_DOCS is OFF by default
1093+
"LICENSE.txt",
1094+
# Repo/editor/tooling metadata that never reaches CMake or ctest
1095+
".gitignore",
1096+
".gitattributes",
1097+
".gitmodules",
1098+
".gdbinit",
1099+
".lldbinit",
1100+
".clang-format",
1101+
".clang-format-ignore",
1102+
".clang-tidy",
1103+
".git-blame-ignore-revs",
1104+
".devcontainer/*",
1105+
".claude/*",
1106+
".idea/*",
1107+
# Coverage / pre-commit / lint configs and scripts (not run by this buildbot)
1108+
"codecov.yml",
1109+
".pre-commit-config.yaml",
1110+
"run-clang-format.sh",
1111+
"run-clang-tidy.sh",
1112+
# pip packaging -- buildbot builds python bindings via CMake+uv directly,
1113+
# never via packaging/pip's sdist/wheel path
1114+
"packaging/*",
1115+
# Legacy `make`-based build -- this buildbot only builds via CMake
1116+
"Makefile",
1117+
"Makefile.inc",
1118+
"*/Makefile",
1119+
"*/Makefile.inc",
1120+
"apps/support/*", # legacy-make helpers only (Makefile.inc, viz_auto.sh)
1121+
# Apps that apps/CMakeLists.txt never builds
1122+
"apps/HelloAndroid/*",
1123+
"apps/HelloAndroidCamera2/*",
1124+
"apps/HelloiOS/*",
1125+
"apps/HelloWasm/*",
1126+
# Dev-only tools/ scripts not wired into tools/CMakeLists.txt or any test target
1127+
"tools/find_inverse.cpp",
1128+
"tools/check_cmake_file_lists.py",
1129+
"tools/check_cmake_style.py",
1130+
"tools/clang-tidy-filter.sh",
1131+
"tools/gdbhalide.py",
1132+
"tools/lldbhalide.py",
1133+
"tools/Halide.natvis",
1134+
"tools/halide_config.make.tpl",
1135+
"tools/makelib.sh",
1136+
"tools/run-coverage.sh",
1137+
]
1138+
1139+
1140+
def _is_ignorable_path(path):
1141+
return any(fnmatch.fnmatchcase(path, pattern) for pattern in _IGNORABLE_PATH_GLOBS)
1142+
1143+
1144+
def is_change_important(change):
1145+
files = change.files
1146+
if not files:
1147+
# Fail open: an empty/missing file list (e.g. a rate-limited or
1148+
# unauthenticated GitHub API call) must never cause a build to be skipped.
1149+
return True
1150+
return any(not _is_ignorable_path(f) for f in files)
1151+
1152+
10811153
c["schedulers"] = [
10821154
AnyBranchScheduler(
10831155
name="halide-main",
10841156
change_filter=ChangeFilter(
10851157
category="pull",
10861158
branch_fn=lambda br: br != "main",
10871159
),
1160+
fileIsImportant=is_change_important,
1161+
onlyImportant=True,
10881162
builderNames=[b1.name for b1 in c["builders"]],
10891163
),
10901164
ForceScheduler(
@@ -1247,6 +1321,7 @@ c["www"] = {
12471321
"secret": WEBHOOK_TOKEN,
12481322
"skips": [],
12491323
"class": SafeGitHubEventHandler,
1324+
"token": GITHUB_TOKEN,
12501325
},
12511326
},
12521327
}

0 commit comments

Comments
 (0)