4545SUFFIXES_C_OR_CPP = frozenset ({".c" , ".h" , ".cpp" })
4646SUFFIXES_DOCUMENTATION = frozenset ({".rst" , ".md" })
4747
48- MACOS_DIRS = frozenset ({"Mac" })
49- IOS_DIRS = frozenset ({"Apple" , "iOS" })
5048ANDROID_DIRS = frozenset ({"Android" })
49+ IOS_DIRS = frozenset ({"Apple" , "iOS" })
50+ MACOS_DIRS = frozenset ({"Mac" })
5151WASI_DIRS = frozenset ({Path ("Tools" , "wasm" )})
5252
5353
5454@dataclass (kw_only = True , slots = True )
5555class Outputs :
56+ run_android : bool = False
5657 run_ci_fuzz : bool = False
5758 run_docs : bool = False
58- run_tests : bool = False
59- run_windows_msi : bool = False
60- run_windows_tests : bool = False
59+ run_ios : bool = False
6160 run_macos : bool = False
61+ run_tests : bool = False
6262 run_ubuntu : bool = False
63- run_android : bool = False
64- run_ios : bool = False
6563 run_wasi : bool = False
64+ run_windows_msi : bool = False
65+ run_windows_tests : bool = False
6666
6767
6868def compute_changes () -> None :
@@ -74,13 +74,13 @@ def compute_changes() -> None:
7474 else :
7575 # Otherwise, just run the tests
7676 outputs = Outputs (
77- run_tests = True ,
78- run_windows_tests = True ,
79- run_macos = True ,
80- run_ubuntu = True ,
8177 run_android = True ,
8278 run_ios = True ,
79+ run_macos = True ,
80+ run_tests = True ,
81+ run_ubuntu = True ,
8382 run_wasi = True ,
83+ run_windows_tests = True ,
8484 )
8585 outputs = process_target_branch (outputs , target_branch )
8686
@@ -129,7 +129,7 @@ def get_changed_files(
129129 return frozenset (map (Path , filter (None , map (str .strip , changed_files ))))
130130
131131
132- def is_platform_specific (file : Path ) -> str | None :
132+ def get_file_platform (file : Path ) -> str | None :
133133 if not file .parts :
134134 return None
135135 first_part = file .parts [0 ]
@@ -152,7 +152,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
152152 run_windows_msi = False
153153
154154 platforms_changed = set ()
155- has_non_plat_specific_change = False
155+ has_platform_specific_change = True
156156
157157 for file in changed_files :
158158 # Documentation files
@@ -161,7 +161,8 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
161161
162162 if file .parent == GITHUB_WORKFLOWS_PATH :
163163 if file .name == "build.yml" :
164- run_tests = run_ci_fuzz = has_non_plat_specific_change = True
164+ run_tests = run_ci_fuzz = True
165+ has_platform_specific_change = False
165166 if file .name == "reusable-docs.yml" :
166167 run_docs = True
167168 if file .name == "reusable-windows-msi.yml" :
@@ -178,11 +179,11 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
178179 ):
179180 run_tests = True
180181
181- platform = is_platform_specific (file )
182+ platform = get_file_platform (file )
182183 if platform is not None :
183184 platforms_changed .add (platform )
184185 else :
185- has_non_plat_specific_change = True
186+ has_platform_specific_change = False
186187 if file not in UNIX_BUILD_SYSTEM_FILE_NAMES :
187188 run_windows_tests = True
188189
@@ -206,7 +207,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
206207
207208 # Check which platform specific tests to run
208209 if run_tests :
209- if has_non_plat_specific_change or not platforms_changed :
210+ if not has_platform_specific_change or not platforms_changed :
210211 run_macos = True
211212 run_ubuntu = True
212213 run_android = True
@@ -226,16 +227,16 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
226227 run_wasi = False
227228
228229 return Outputs (
230+ run_android = run_android ,
229231 run_ci_fuzz = run_ci_fuzz ,
230232 run_docs = run_docs ,
231- run_tests = run_tests ,
232- run_windows_tests = run_windows_tests ,
233- run_windows_msi = run_windows_msi ,
233+ run_ios = run_ios ,
234234 run_macos = run_macos ,
235+ run_tests = run_tests ,
235236 run_ubuntu = run_ubuntu ,
236- run_android = run_android ,
237- run_ios = run_ios ,
238237 run_wasi = run_wasi ,
238+ run_windows_msi = run_windows_msi ,
239+ run_windows_tests = run_windows_tests ,
239240 )
240241
241242
@@ -262,16 +263,16 @@ def write_github_output(outputs: Outputs) -> None:
262263 return
263264
264265 with open (os .environ ["GITHUB_OUTPUT" ], "a" , encoding = "utf-8" ) as f :
266+ f .write (f"run-android={ bool_lower (outputs .run_android )} \n " )
265267 f .write (f"run-ci-fuzz={ bool_lower (outputs .run_ci_fuzz )} \n " )
266268 f .write (f"run-docs={ bool_lower (outputs .run_docs )} \n " )
267- f .write (f"run-tests={ bool_lower (outputs .run_tests )} \n " )
268- f .write (f"run-windows-tests={ bool_lower (outputs .run_windows_tests )} \n " )
269- f .write (f"run-windows-msi={ bool_lower (outputs .run_windows_msi )} \n " )
269+ f .write (f"run-ios={ bool_lower (outputs .run_ios )} \n " )
270270 f .write (f"run-macos={ bool_lower (outputs .run_macos )} \n " )
271+ f .write (f"run-tests={ bool_lower (outputs .run_tests )} \n " )
271272 f .write (f"run-ubuntu={ bool_lower (outputs .run_ubuntu )} \n " )
272- f .write (f"run-android={ bool_lower (outputs .run_android )} \n " )
273- f .write (f"run-ios={ bool_lower (outputs .run_ios )} \n " )
274273 f .write (f"run-wasi={ bool_lower (outputs .run_wasi )} \n " )
274+ f .write (f"run-windows-msi={ bool_lower (outputs .run_windows_msi )} \n " )
275+ f .write (f"run-windows-tests={ bool_lower (outputs .run_windows_tests )} \n " )
275276
276277
277278def bool_lower (value : bool , / ) -> str :
0 commit comments