Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 51 additions & 12 deletions master/custom/branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""

import collections.abc
import dataclasses
from functools import total_ordering
from typing import Any
Expand Down Expand Up @@ -64,13 +65,6 @@ def _maintenance_branch(major, minor, **kwargs):
# need more time.
result.monolithic_test_asyncio = True

if version_tuple < (3, 11):
# WASM wasn't a supported platform until 3.11.
result.wasm_tier = None
elif version_tuple < (3, 13):
# Tier 3 support is 3.11 & 3.12.
result.wasm_tier = 3

if version_tuple < (3, 13):
# Free-threaded builds are available since 3.13
result.gil_only = True
Expand All @@ -96,7 +90,6 @@ class BranchInfo:
# Defaults are for main (and PR), overrides are in _maintenance_branch.
gil_only: bool = False
monolithic_test_asyncio: bool = False
wasm_tier: int | None = 2

def __str__(self):
return self.name
Expand All @@ -108,6 +101,9 @@ def __eq__(self, other):
return NotImplemented
return self.sort_key == other.sort_key

def __hash__(self):
return hash(self.sort_key)

def __lt__(self, other):
try:
other_key = other.sort_key
Expand All @@ -116,15 +112,58 @@ def __lt__(self, other):
return self.sort_key < other.sort_key


BRANCHES = list(generate_branches())
class BranchSet(collections.abc.Set):
"""An immutable set of BranchInfo objects, with some convenience API"""

def __init__(self, branches):
self._branches = tuple(branches)

def __iter__(self):
return iter(self._branches)

def __len__(self):
return len(self._branches)

def __contains__(self, element):
return element in self._branches

def __getitem__(self, version_tuple):
"""branchset[3, x] -> BranchInfo for 3.x"""
for branch in self._branches:
if branch.version_tuple == version_tuple:
return branch
raise LookupError(f'version {version_tuple} not found')

def only_since(self, major, minor, include_pr=True):
"""only_since(3, x) -> BranchSet with 3.x and later"""
return BranchSet(
b for b in self._branches if (
include_pr if b.is_pr
else b.version_tuple >= (major, minor)
)
)

def only_until(self, major, minor, include_pr=False):
"""only_since(3, x) -> BranchSet with up to (and including) 3.x"""
return BranchSet(
b for b in self._branches if (
include_pr if b.is_pr
else b.version_tuple <= (major, minor)
)
)


BRANCHES = BranchSet(generate_branches())
[MAIN_BRANCH] = [b for b in BRANCHES if b.is_main]
[PR_BRANCH] = [b for b in BRANCHES if b.is_pr]

# Verify that we've defined these in sort order
assert BRANCHES == sorted(BRANCHES)
# Verify that the (sort) keys are distinct
assert len(set(BRANCHES)) == len(list(BRANCHES))

if __name__ == "__main__":
# Print a table to the terminal
cols = [[f.name + ':' for f in dataclasses.fields(BranchInfo)]]
for branch in BRANCHES:
for branch in sorted(BRANCHES):
cols.append([repr(val) for val in dataclasses.astuple(branch)])
column_sizes = [max(len(val) for val in col) for col in cols]
column_sizes[-2] += 2 # PR is special, offset it a bit
Expand Down
86 changes: 66 additions & 20 deletions master/custom/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from functools import cached_property

from custom import factories
from custom.branches import BRANCHES, MAIN_BRANCH, PR_BRANCH
from custom.factories import (
UnixBuild,
UnixPerfBuild,
Expand Down Expand Up @@ -89,11 +90,18 @@ class BuilderDef:
tags: frozenset[str]
worker_name: str

def __init__(self, name, factory, *, tags, worker_name):
def __init__(
self, name, factory,
*,
tags,
worker_name,
branches=BRANCHES,
):
self.name = name
self.factory = factory
self.worker_name = worker_name
self.tags = frozenset(tags)
self.branches = branches

@cached_property
def tier(self):
Expand Down Expand Up @@ -131,10 +139,19 @@ def get_tier_from_tags(tags):
),
]

def generate_builderdefs(tags, tuples):
def generate_builderdefs(tags, entries):
tags = frozenset(tags)
for name, worker_name, factory in tuples:
yield BuilderDef(name, factory, tags=tags, worker_name=worker_name)
for entry in entries:
if isinstance(entry, BuilderDef):
if not (entry.tags <= tags):
raise ValueError(
f'{entry} is in the wrong generate_builderdefs call; '
+ 'move it to the main BUILDER_DEFS list above',
)
yield entry
else:
name, worker_name, factory = entry
yield BuilderDef(name, factory, tags=tags, worker_name=worker_name)


# -- Stable Tier-1 builder ----------------------------------------------
Expand Down Expand Up @@ -163,9 +180,27 @@ def generate_builderdefs(tags, tuples):
("AMD64 Windows11 Non-Debug", "ware-win11", Windows64ReleaseBuild),
("AMD64 Windows11 Refleaks", "ware-win11", Windows64RefleakBuild),
("AMD64 Windows Server 2022 NoGIL", "itamaro-win64-srv-22-aws", Windows64NoGilBuild),
("AMD64 Windows PGO Tailcall", "itamaro-win64-srv-22-aws", Windows64PGOTailcallBuild),
("AMD64 Windows PGO NoGIL", "itamaro-win64-srv-22-aws", Windows64PGONoGilBuild),
("AMD64 Windows PGO NoGIL Tailcall", "itamaro-win64-srv-22-aws", Windows64PGONoGilTailcallBuild),
BuilderDef(
"AMD64 Windows PGO Tailcall",
Windows64PGOTailcallBuild,
tags={STABLE, TIER_1},
worker_name="itamaro-win64-srv-22-aws",
branches={MAIN_BRANCH, PR_BRANCH},
),
BuilderDef(
"AMD64 Windows PGO NoGIL",
Windows64PGONoGilBuild,
tags={STABLE, TIER_1},
worker_name="itamaro-win64-srv-22-aws",
branches={MAIN_BRANCH, PR_BRANCH},
),
BuilderDef(
"AMD64 Windows PGO NoGIL Tailcall",
Windows64PGONoGilTailcallBuild,
tags={STABLE, TIER_1},
worker_name="itamaro-win64-srv-22-aws",
branches={MAIN_BRANCH, PR_BRANCH},
),
]))


Expand Down Expand Up @@ -290,7 +325,13 @@ def generate_builderdefs(tags, tuples):
("AMD64 Arch Linux Asan", "pablogsal-arch-x86_64", UnixAsanBuild),
("AMD64 Arch Linux Asan Debug", "pablogsal-arch-x86_64", UnixAsanDebugBuild),
("AMD64 Arch Linux TraceRefs", "pablogsal-arch-x86_64", UnixTraceRefsBuild),
("AMD64 Arch Linux Perf", "pablogsal-arch-x86_64", UnixPerfBuild),
BuilderDef(
"AMD64 Arch Linux Perf",
UnixPerfBuild,
tags={STABLE},
worker_name="pablogsal-arch-x86_64",
branches={MAIN_BRANCH, PR_BRANCH},
),
# UBSAN with -fno-sanitize=function, without which we currently fail (as
# tracked in gh-111178). The full "AMD64 Arch Linux Usan" is unstable, below
("AMD64 Arch Linux Usan Function", "pablogsal-arch-x86_64", ClangUbsanFunctionLinuxBuild),
Expand Down Expand Up @@ -319,11 +360,22 @@ def generate_builderdefs(tags, tuples):

("AMD64 CentOS9 FIPS Only Blake2 Builtin Hash", "cstratak-CentOS9-fips-x86_64", CentOS9NoBuiltinHashesUnixBuildExceptBlake2),
("AMD64 CentOS9 FIPS No Builtin Hashes", "cstratak-CentOS9-fips-x86_64", CentOS9NoBuiltinHashesUnixBuild),

("AMD64 Arch Linux Valgrind", "pablogsal-arch-x86_64", ValgrindBuild),
BuilderDef(
"AMD64 Arch Linux Valgrind",
ValgrindBuild,
tags={UNSTABLE, TIER_1},
worker_name="pablogsal-arch-x86_64",
branches={MAIN_BRANCH, PR_BRANCH},
),

# Windows MSVC
("AMD64 Windows PGO", "bolen-windows10", Windows64PGOBuild),
BuilderDef(
"AMD64 Windows PGO",
Windows64PGOBuild,
tags={UNSTABLE, TIER_1},
worker_name="bolen-windows10",
branches={MAIN_BRANCH, PR_BRANCH},
),
]))


Expand Down Expand Up @@ -439,15 +491,6 @@ def get_builder_defs(settings):
return BUILDER_DEFS


# Match builder name (excluding the branch name) of builders that should only
# run on the main and PR branches.
ONLY_MAIN_BRANCH = (
"Windows PGO",
"AMD64 Arch Linux Perf",
"AMD64 Arch Linux Valgrind",
)


if __name__ == "__main__":
# Print a list to the terminal
import itertools
Expand All @@ -471,3 +514,6 @@ def key(builder_def):
print(f'{NAME}{d.name}{END}')
print(f' {d.factory.__name__} on {d.worker_name}')
print(f' [{' '.join(sorted(d.tags))}]')
if d.branches != BRANCHES:
branchnames = ', '.join(b.name for b in sorted(d.branches))
print(f' branches: {branchnames}')
13 changes: 13 additions & 0 deletions master/custom/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from buildbot.plugins import util

from . import JUNIT_FILENAME
from .branches import BRANCHES
from .steps import (
Test,
Clean,
Expand Down Expand Up @@ -57,6 +58,7 @@ class BaseBuild(factory.BuildFactory):
test_timeout = TEST_TIMEOUT
buildersuffix = ""
tags = ()
branches = BRANCHES

def __init__(self, source, *, extra_tags=[], **kwargs):
super().__init__([source])
Expand Down Expand Up @@ -899,6 +901,9 @@ class Wasm32WasiCrossBuild(UnixCrossBuild):
host = "wasm32-unknown-wasi"
host_configure_cmd = ["../../Tools/wasm/wasi-env", "../../configure"]

# See comment in _Wasm32WasiPreview1Build.__init__
branches = {BRANCHES[3, 11], BRANCHES[3, 12]}
Comment thread
zware marked this conversation as resolved.

def setup(self, branch, worker, test_with_PTY=False, **kwargs):
self.addStep(
SetPropertyFromCommand(
Expand Down Expand Up @@ -935,6 +940,14 @@ def __init__(self, source, *, extra_tags=[], **kwargs):
if not self.pydebug:
extra_tags.append("nondebug")
self.buildersuffix += self.append_suffix
if self.pydebug:
# The debug WASI buildbot is meant for 3.11 and 3.12 only.
# Don't use it on PRs; it's tier 3 only and getting it to
# work on PRs against `main` is too much work.
self.branches = {BRANCHES[3, 11], BRANCHES[3, 12]}
else:
# The non-debug buildbot is meant for 3.13+, where WASM is tier 2
self.branches = BRANCHES.only_since(3, 13)
super().__init__(source, extra_tags=extra_tags, **kwargs)

def setup(self, branch, worker, test_with_PTY=False, **kwargs):
Expand Down
Loading