44from functools import cached_property
55
66from custom import factories
7+ from custom .branches import BRANCHES , MAIN_BRANCH , PR_BRANCH
78from custom .factories import (
89 UnixBuild ,
910 UnixPerfBuild ,
@@ -90,11 +91,18 @@ class BuilderDef:
9091 tags : frozenset [str ]
9192 worker_name : str
9293
93- def __init__ (self , name , factory , * , tags , worker_name ):
94+ def __init__ (
95+ self , name , factory ,
96+ * ,
97+ tags ,
98+ worker_name ,
99+ branches = BRANCHES ,
100+ ):
94101 self .name = name
95102 self .factory = factory
96103 self .worker_name = worker_name
97104 self .tags = frozenset (tags )
105+ self .branches = branches
98106
99107 @cached_property
100108 def tier (self ):
@@ -146,13 +154,23 @@ def get_tier_from_tags(tags):
146154 factories .Windows64PGOBuild ,
147155 tags = {STABLE , TIER_1 },
148156 worker_name = "bolen-windows10" ,
157+ branches = {MAIN_BRANCH , PR_BRANCH },
149158 ),
150159]
151160
152- def generate_builderdefs (tags , tuples ):
161+ def generate_builderdefs (tags , entries ):
153162 tags = frozenset (tags )
154- for name , worker_name , factory in tuples :
155- yield BuilderDef (name , factory , tags = tags , worker_name = worker_name )
163+ for entry in entries :
164+ if isinstance (entry , BuilderDef ):
165+ if not (entry .tags <= tags ):
166+ raise ValueError (
167+ f'{ entry } is in the wrong generate_builderdefs call; '
168+ + 'move it to the main BUILDER_DEFS list above' ,
169+ )
170+ yield entry
171+ else :
172+ name , worker_name , factory = entry
173+ yield BuilderDef (name , factory , tags = tags , worker_name = worker_name )
156174
157175
158176# -- Stable Tier-1 builder ----------------------------------------------
@@ -181,9 +199,27 @@ def generate_builderdefs(tags, tuples):
181199 ("AMD64 Windows11 Non-Debug" , "ware-win11" , Windows64ReleaseBuild ),
182200 ("AMD64 Windows11 Refleaks" , "ware-win11" , Windows64RefleakBuild ),
183201 ("AMD64 Windows Server 2022 NoGIL" , "itamaro-win64-srv-22-aws" , Windows64NoGilBuild ),
184- ("AMD64 Windows PGO Tailcall" , "itamaro-win64-srv-22-aws" , Windows64PGOTailcallBuild ),
185- ("AMD64 Windows PGO NoGIL" , "itamaro-win64-srv-22-aws" , Windows64PGONoGilBuild ),
186- ("AMD64 Windows PGO NoGIL Tailcall" , "itamaro-win64-srv-22-aws" , Windows64PGONoGilTailcallBuild ),
202+ BuilderDef (
203+ "AMD64 Windows PGO Tailcall" ,
204+ Windows64PGOTailcallBuild ,
205+ tags = {STABLE , TIER_1 },
206+ worker_name = "itamaro-win64-srv-22-aws" ,
207+ branches = {MAIN_BRANCH , PR_BRANCH },
208+ ),
209+ BuilderDef (
210+ "AMD64 Windows PGO NoGIL" ,
211+ Windows64PGONoGilBuild ,
212+ tags = {STABLE , TIER_1 },
213+ worker_name = "itamaro-win64-srv-22-aws" ,
214+ branches = {MAIN_BRANCH , PR_BRANCH },
215+ ),
216+ BuilderDef (
217+ "AMD64 Windows PGO NoGIL Tailcall" ,
218+ Windows64PGONoGilTailcallBuild ,
219+ tags = {STABLE , TIER_1 },
220+ worker_name = "itamaro-win64-srv-22-aws" ,
221+ branches = {MAIN_BRANCH , PR_BRANCH },
222+ ),
187223]))
188224
189225
@@ -310,7 +346,13 @@ def generate_builderdefs(tags, tuples):
310346 ("AMD64 Arch Linux Asan" , "pablogsal-arch-x86_64" , UnixAsanBuild ),
311347 ("AMD64 Arch Linux Asan Debug" , "pablogsal-arch-x86_64" , UnixAsanDebugBuild ),
312348 ("AMD64 Arch Linux TraceRefs" , "pablogsal-arch-x86_64" , UnixTraceRefsBuild ),
313- ("AMD64 Arch Linux Perf" , "pablogsal-arch-x86_64" , UnixPerfBuild ),
349+ BuilderDef (
350+ "AMD64 Arch Linux Perf" ,
351+ UnixPerfBuild ,
352+ tags = {STABLE },
353+ worker_name = "pablogsal-arch-x86_64" ,
354+ branches = {MAIN_BRANCH , PR_BRANCH },
355+ ),
314356 # UBSAN with -fno-sanitize=function, without which we currently fail (as
315357 # tracked in gh-111178). The full "AMD64 Arch Linux Usan" is unstable, below
316358 ("AMD64 Arch Linux Usan Function" , "pablogsal-arch-x86_64" , ClangUbsanFunctionLinuxBuild ),
@@ -345,7 +387,13 @@ def generate_builderdefs(tags, tuples):
345387 ("AMD64 CentOS9 FIPS Only Blake2 Builtin Hash" , "cstratak-CentOS9-fips-x86_64" , CentOS9NoBuiltinHashesUnixBuildExceptBlake2 ),
346388 ("AMD64 CentOS9 FIPS No Builtin Hashes" , "cstratak-CentOS9-fips-x86_64" , CentOS9NoBuiltinHashesUnixBuild ),
347389
348- ("AMD64 Arch Linux Valgrind" , "pablogsal-arch-x86_64" , ValgrindBuild ),
390+ BuilderDef (
391+ "AMD64 Arch Linux Valgrind" ,
392+ ValgrindBuild ,
393+ tags = {UNSTABLE , TIER_1 },
394+ worker_name = "pablogsal-arch-x86_64" ,
395+ branches = {MAIN_BRANCH , PR_BRANCH },
396+ ),
349397]))
350398
351399
@@ -467,15 +515,6 @@ def get_builder_defs(settings):
467515 return BUILDER_DEFS
468516
469517
470- # Match builder name (excluding the branch name) of builders that should only
471- # run on the main and PR branches.
472- ONLY_MAIN_BRANCH = (
473- "Windows PGO" ,
474- "AMD64 Arch Linux Perf" ,
475- "AMD64 Arch Linux Valgrind" ,
476- )
477-
478-
479518if __name__ == "__main__" :
480519 # Print a list to the terminal
481520 import itertools
@@ -499,3 +538,6 @@ def key(builder_def):
499538 print (f'{ NAME } { d .name } { END } ' )
500539 print (f' { d .factory .__name__ } on { d .worker_name } ' )
501540 print (f' [{ ' ' .join (sorted (d .tags ))} ]' )
541+ if d .branches != BRANCHES :
542+ branchnames = ', ' .join (b .name for b in sorted (d .branches ))
543+ print (f' branches: { branchnames } ' )
0 commit comments