Skip to content

Commit 21eeca3

Browse files
[CI] Exclude docs directories from triggering rebuilds
Currently when someone touches a docs directory in a subproject, it is treated as if the source code of that project got touched, so the project is built, it is tested, and the same for all of its enumerated dependents. This is wasteful, particularly for patches just touching docs in places like LLVM where we might spend an hour of node time to do nothing useful given changes in the docs shouldn't cause test failures and there is already another workflow that tests the documentation build completes successfully. Reviewers: Keenuts, tstellar, lnihlen Reviewed By: tstellar Pull Request: #133185
1 parent 34d8586 commit 21eeca3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.ci/compute_projects.py

+6
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ def _compute_runtime_check_targets(runtimes_to_test: Set[str]) -> Set[str]:
194194
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
195195
modified_projects = set()
196196
for modified_file in modified_files:
197+
path_parts = pathlib.Path(modified_file).parts
198+
# Exclude files in the docs directory. They do not impact an test
199+
# targets and there is a separate workflow used for ensuring the
200+
# documentation builds.
201+
if len(path_parts) > 2 and path_parts[1] == "docs":
202+
continue
197203
modified_projects.add(pathlib.Path(modified_file).parts[0])
198204
return modified_projects
199205

.ci/compute_projects_test.py

+9
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ def test_exclude_runtiems_in_projects(self):
170170
self.assertEqual(env_variables["runtimes_to_build"], "")
171171
self.assertEqual(env_variables["runtimes_check_targets"], "")
172172

173+
def test_exclude_docs(self):
174+
env_variables = compute_projects.get_env_variables(
175+
["llvm/docs/CIBestPractices.rst"], "Linux"
176+
)
177+
self.assertEqual(env_variables["projects_to_build"], "")
178+
self.assertEqual(env_variables["project_check_targets"], "")
179+
self.assertEqual(env_variables["runtimes_to_build"], "")
180+
self.assertEqual(env_variables["runtimes_check_targets"], "")
181+
173182

174183
if __name__ == "__main__":
175184
unittest.main()

0 commit comments

Comments
 (0)