aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden Grossman <aidengrossman@google.com>2025-03-28 22:30:41 -0700
committerGitHub <noreply@github.com>2025-03-28 22:30:41 -0700
commit21eeca3db0341fef4ab4a6464ffe38b2eba5810c (patch)
tree59a2c2665414c4119c6327c56799f956a983f658
parent34d858635f0887cc083ccbe3ac69fd34f107b4f6 (diff)
downloadllvm-21eeca3db0341fef4ab4a6464ffe38b2eba5810c.zip
llvm-21eeca3db0341fef4ab4a6464ffe38b2eba5810c.tar.gz
llvm-21eeca3db0341fef4ab4a6464ffe38b2eba5810c.tar.bz2
[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: https://github.com/llvm/llvm-project/pull/133185
-rw-r--r--.ci/compute_projects.py6
-rw-r--r--.ci/compute_projects_test.py9
2 files changed, 15 insertions, 0 deletions
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index e9c43a4..7445e92 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -194,6 +194,12 @@ def _compute_runtime_check_targets(runtimes_to_test: Set[str]) -> Set[str]:
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
modified_projects = set()
for modified_file in modified_files:
+ path_parts = pathlib.Path(modified_file).parts
+ # Exclude files in the docs directory. They do not impact an test
+ # targets and there is a separate workflow used for ensuring the
+ # documentation builds.
+ if len(path_parts) > 2 and path_parts[1] == "docs":
+ continue
modified_projects.add(pathlib.Path(modified_file).parts[0])
return modified_projects
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index 3f6f1ab..1807337 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -170,6 +170,15 @@ class TestComputeProjects(unittest.TestCase):
self.assertEqual(env_variables["runtimes_to_build"], "")
self.assertEqual(env_variables["runtimes_check_targets"], "")
+ def test_exclude_docs(self):
+ env_variables = compute_projects.get_env_variables(
+ ["llvm/docs/CIBestPractices.rst"], "Linux"
+ )
+ self.assertEqual(env_variables["projects_to_build"], "")
+ self.assertEqual(env_variables["project_check_targets"], "")
+ self.assertEqual(env_variables["runtimes_to_build"], "")
+ self.assertEqual(env_variables["runtimes_check_targets"], "")
+
if __name__ == "__main__":
unittest.main()