@@ -1007,7 +1007,10 @@ def get_run_on(self, args):
1007
1007
if args .run_on_all_branches :
1008
1008
return self .RUN_ON_ALL
1009
1009
if args .cron :
1010
- return f"""
1010
+ if args .cron == "never" :
1011
+ return " {}"
1012
+ else :
1013
+ return f"""
1011
1014
schedule:
1012
1015
- cron: '{ args .cron } '"""
1013
1016
@@ -1062,18 +1065,27 @@ def write_job_for_platform(self, platform, args): # noqa: C901
1062
1065
1063
1066
if build_opts .is_linux ():
1064
1067
artifacts = "linux"
1065
- runs_on = f"ubuntu-{ args .ubuntu_version } "
1066
- if args .cpu_cores :
1067
- runs_on = f"{ args .cpu_cores } -core-ubuntu-{ args .ubuntu_version } "
1068
+ if args .runs_on :
1069
+ runs_on = args .runs_on
1070
+ else :
1071
+ runs_on = f"ubuntu-{ args .ubuntu_version } "
1072
+ if args .cpu_cores :
1073
+ runs_on = f"{ args .cpu_cores } -core-ubuntu-{ args .ubuntu_version } "
1068
1074
elif build_opts .is_windows ():
1069
1075
artifacts = "windows"
1070
- runs_on = "windows-2019"
1076
+ if args .runs_on :
1077
+ runs_on = args .runs_on
1078
+ else :
1079
+ runs_on = "windows-2019"
1071
1080
# The windows runners are python 3 by default; python2.exe
1072
1081
# is available if needed.
1073
1082
py3 = "python"
1074
1083
else :
1075
1084
artifacts = "mac"
1076
- runs_on = "macOS-latest"
1085
+ if args .runs_on :
1086
+ runs_on = args .runs_on
1087
+ else :
1088
+ runs_on = "macOS-latest"
1077
1089
1078
1090
os .makedirs (args .output_dir , exist_ok = True )
1079
1091
@@ -1366,9 +1378,13 @@ def setup_project_cmd_parser(self, parser):
1366
1378
"--cpu-cores" ,
1367
1379
help = "Number of CPU cores to use (applicable for Linux OS)" ,
1368
1380
)
1381
+ parser .add_argument (
1382
+ "--runs-on" ,
1383
+ help = "Allow specifying explicit runs-on: for github actions" ,
1384
+ )
1369
1385
parser .add_argument (
1370
1386
"--cron" ,
1371
- help = "Specify that the job runs on a cron schedule instead of on pushes" ,
1387
+ help = "Specify that the job runs on a cron schedule instead of on pushes. Pass never to disable the action. " ,
1372
1388
)
1373
1389
parser .add_argument (
1374
1390
"--main-branch" ,
0 commit comments