@@ -823,7 +823,7 @@ def test(context: argparse.Namespace, host: str | None = None) -> None:
823823 + [
824824 "--" ,
825825 "test" ,
826- "--slow-ci" if context .slow else "--fast -ci" ,
826+ f "--{ context .ci_mode } -ci" ,
827827 "--single-process" ,
828828 "--no-randomize" ,
829829 # Timeout handling requires subprocesses; explicitly setting
@@ -836,11 +836,39 @@ def test(context: argparse.Namespace, host: str | None = None) -> None:
836836 )
837837
838838
839+ def apple_sim_host (platform_name : str ) -> str :
840+ """Determine the native simulator target for this platform."""
841+ for _ , slice_parts in HOSTS [platform_name ].items ():
842+ for host_triple in slice_parts :
843+ parts = host_triple .split ('-' )
844+ if parts [0 ] == platform .machine () and parts [- 1 ] == "simulator" :
845+ return host_triple
846+
847+ raise KeyError (platform_name )
848+
849+
839850def ci (context : argparse .Namespace ) -> None :
840- """The implementation of the "ci" command."""
851+ """The implementation of the "ci" command.
852+
853+ In "Fast" mode, this compiles the build python, and the simulator for the
854+ build machine's architecture; and runs the test suite with `--fast-ci`
855+ configuration.
856+
857+ In "Slow" mode, it compiles the build python, plus all candidate
858+ architectures (both device and simulator); then runs the test suite with
859+ `--slow-ci` configuration.
860+ """
841861 clean (context , "all" )
842- build (context , host = "all" )
843- test (context , host = "all" )
862+ if context .ci_mode == "slow" :
863+ # In slow mode, build and test the full XCframework
864+ build (context , host = "all" )
865+ test (context , host = "all" )
866+ else :
867+ # In fast mode, just build the simulator platform.
868+ sim_host = apple_sim_host (context .platform )
869+ build (context , host = "build" )
870+ build (context , host = sim_host )
871+ test (context , host = sim_host )
844872
845873
846874def parse_args () -> argparse .Namespace :
@@ -947,11 +975,13 @@ def parse_args() -> argparse.Namespace:
947975 "an ARM64 iPhone 16 Pro simulator running iOS 26.0."
948976 ),
949977 )
950- cmd .add_argument (
951- "--slow" ,
952- action = "store_true" ,
953- help = "Run tests with --slow-ci options." ,
954- )
978+ group = cmd .add_mutually_exclusive_group ()
979+ group .add_argument (
980+ "--fast-ci" , action = "store_const" , dest = "ci_mode" , const = "fast" ,
981+ help = "Add test arguments for GitHub Actions" )
982+ group .add_argument (
983+ "--slow-ci" , action = "store_const" , dest = "ci_mode" , const = "slow" ,
984+ help = "Add test arguments for buildbots" )
955985
956986 for subcommand in [configure_build , configure_host , build , ci ]:
957987 subcommand .add_argument (
@@ -1012,4 +1042,10 @@ def signal_handler(*args):
10121042
10131043
10141044if __name__ == "__main__" :
1045+ # Under the buildbot, stdout is not a TTY, but we must still flush after
1046+ # every line to make sure our output appears in the correct order relative
1047+ # to the output of our subprocesses.
1048+ for stream in [sys .stdout , sys .stderr ]:
1049+ stream .reconfigure (line_buffering = True )
1050+
10151051 main ()
0 commit comments