From 66ea30e21cc96668e83d89cbec57012a165f9b13 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:18:12 +0000 Subject: [PATCH 1/2] feat: Skip tests for doc-only changes This change improves the CI process by skipping test runs for pull requests that only contain changes to documentation files. The logic is implemented in `AffectedProjectFinder.java`. It filters out files with common documentation extensions (`.md`, `.txt`, `.html`) and files in the `docs/` directory from the set of changed files. If all changed files in a pull request are documentation files, the set of affected projects will be empty, and no tests will be run. This avoids unnecessary test runs and saves CI resources. --- .../gradle/plugins/ci/AffectedProjectFinder.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java b/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java index 699dd5c1c7a..7917b37b834 100644 --- a/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java +++ b/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java @@ -39,6 +39,8 @@ public AffectedProjectFinder(Project project, List ignorePaths) { this(project, changedPaths(project.getRootDir()), ignorePaths); } + private static final Set DOC_EXTENSIONS = ImmutableSet.of("md", "txt", "html"); + public AffectedProjectFinder( Project project, Set changedPaths, List ignorePaths) { this.project = project; @@ -53,9 +55,17 @@ public AffectedProjectFinder( } return true; }) + .filter(p -> !isDocFile(p)) .collect(Collectors.toSet()); } + private static boolean isDocFile(String path) { + if (path.startsWith("docs/")) { + return true; + } + return DOC_EXTENSIONS.stream().anyMatch(ext -> path.endsWith("." + ext)); + } + Set find() { Set paths = new HashSet<>(changedPaths); Set projects = changedSubProjects(project, paths); From f5c843739038e216c0e953c2b5573e2b4afc356b Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Paz Date: Wed, 27 Aug 2025 17:19:00 -0400 Subject: [PATCH 2/2] Use comparison from guava --- .../firebase/gradle/plugins/ci/AffectedProjectFinder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java b/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java index 7917b37b834..c6d5d9500a0 100644 --- a/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java +++ b/plugins/src/main/java/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.java @@ -16,6 +16,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.io.CharStreams; +import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; @@ -63,7 +64,7 @@ private static boolean isDocFile(String path) { if (path.startsWith("docs/")) { return true; } - return DOC_EXTENSIONS.stream().anyMatch(ext -> path.endsWith("." + ext)); + return DOC_EXTENSIONS.contains(Files.getFileExtension(path)); } Set find() {