diff --git a/scripts/ci/affected.py b/scripts/ci/affected.py index b6d0a082a..bf1ff20bc 100644 --- a/scripts/ci/affected.py +++ b/scripts/ci/affected.py @@ -28,6 +28,8 @@ FULL_FILES = ("Cargo.toml", "Cargo.lock") IGNORED_PREFIXES = ("docs/", "packaging/") # Root files that a crate embeds (include_str!), so they are not ignorable documentation. EMBEDDED = {"ATTRIBUTION.md": "solidcraft-ui-egui"} +# Asset folders that only some packages read: the UI embeds the catalogs, xtask checks them. +EMBEDDED_PREFIXES = {"assets/locales/": ("solidcraft-ui-egui", "xtask")} def load_metadata(path): @@ -76,6 +78,8 @@ def select(meta, paths): hit.add(by_dir[max(owners, key=len)]) elif path in EMBEDDED: hit.add(EMBEDDED[path]) + elif any(path.startswith(p) for p in EMBEDDED_PREFIXES): + hit.update(next(v for p, v in EMBEDDED_PREFIXES.items() if path.startswith(p))) elif path.startswith(IGNORED_PREFIXES) or ("/" not in path and path.endswith(".md")): continue else: diff --git a/scripts/ci/test_affected.py b/scripts/ci/test_affected.py index 5fae56cd9..f31fabc1c 100644 --- a/scripts/ci/test_affected.py +++ b/scripts/ci/test_affected.py @@ -71,6 +71,14 @@ class RealWorkspace(unittest.TestCase): def test_docs_only_selects_nothing(self): self.assertEqual(affected.select(self.meta, ["docs/book/src/dev/testing.md", "CONTRIBUTING.md"]), (False, [])) + def test_translation_selects_the_ui_and_xtask_not_the_kernel(self): + full, pk = affected.select(self.meta, ["assets/locales/ja.json", "assets/locales/it.json"]) + self.assertFalse(full) + self.assertIn("solidcraft-ui-egui", pk) + self.assertIn("xtask", pk) + self.assertNotIn("solidcraft-kernel", pk) + self.assertNotIn("solidcraft-engine", pk) + if __name__ == "__main__": unittest.main()