diff --git a/master/custom/builders.py b/master/custom/builders.py index 85058082..b85d695c 100644 --- a/master/custom/builders.py +++ b/master/custom/builders.py @@ -54,7 +54,7 @@ MacOSArmWithBrewNoGilRefleakBuild, Wasm32WasiCrossBuild, Wasm32WasiPreview1DebugBuild, - Wasm32WasiPlatformDebugBuild, + Wasm32WasiPlatformReleaseBuild, IOSARM64SimulatorBuild, AndroidBuild, EmscriptenBuild, @@ -281,7 +281,7 @@ def generate_builderdefs(tags, entries): # WASI ("wasm32-wasip1", "bcannon-wasi", Wasm32WasiPreview1DebugBuild), - ("wasm32-wasi", "bcannon-wasi", Wasm32WasiPlatformDebugBuild), + ("wasm32-wasi", "bcannon-wasi", Wasm32WasiPlatformReleaseBuild), # Windows aarch64 MSVC ("ARM64 Windows", "ware-win11-arm64", factories.WindowsARM64Build), diff --git a/master/custom/factories.py b/master/custom/factories.py index 7c2466bd..ae116b2e 100644 --- a/master/custom/factories.py +++ b/master/custom/factories.py @@ -1103,16 +1103,16 @@ class Wasm32WasiPreview1DebugBuild(_Wasm32WasiPreview1Build): testFlags = ["-u-cpu"] -class Wasm32WasiPlatformDebugBuild(UnixBuild): +class _Wasm32WasiPlatformBuild(UnixBuild): factory_tags = ["wasm", "wasi"] buildersuffix = ".wasi" - pydebug = True - append_suffix = ".debug" + kind = None # "pydebug", "release" + append_suffix = None testFlags = ["-u-cpu"] def __init__(self, source, *, extra_tags=[], **kwargs): - if self.pydebug: + if self.append_suffix: self.buildersuffix += self.append_suffix # `Platforms/WASI` was introduced in Python 3.15. # `Platforms/WASI path` was introduced in Python 3.16. @@ -1132,8 +1132,11 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs): # Build Python build_configure = ["python3", wasi_py, "configure-build-python"] - if self.pydebug: - build_configure.extend(["--", "--with-pydebug"]) + match self.kind: + case "pydebug": + build_configure.extend(["--", "--with-pydebug"]) + case "release": + build_configure.append("--release") self.addStep( Configure( name="Configure build Python", @@ -1154,11 +1157,14 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs): ) # Host/WASI Python + host_configure = ["python3", wasi_py, "configure-host"] + # Pydebug build automatically inferred from build Python. + if self.kind == "release": + host_configure.append("--release") self.addStep( - # Pydebug build automatically inferred from build Python. Configure( name="Configure host Python", - command=["python3", wasi_py, "configure-host"], + command=host_configure, ) ) self.addStep( @@ -1167,7 +1173,6 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs): command=["python3", wasi_py, "make-host"], ) ) - self.addStep( PythonInfo( name="Display build info of the host/WASI Python", @@ -1175,22 +1180,32 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs): ) ) - # Copied from UnixBuild. + if self.kind == "release": + self.addStep( + Install( + name="Create release archive", + description=["archiving"], + descriptionDone = ["Archived"], + command=["python3", wasi_py, "package"], + ) + ) + + test = ["python3", wasi_py, "test", "--slow-ci"] + if self.kind == "release": + test.extend(["--target", "archive"]) testopts = self.create_test_opts(branch, worker) - test = [ - "make", - "buildbottest", - "TESTOPTS=" + " ".join(testopts) + " ${BUILDBOT_TESTOPTS}", - f"TESTPYTHONOPTS={self.interpreterFlags}", - f"TESTTIMEOUT={self.test_timeout}", - ] + testopts.append(f"--timeout={self.test_timeout}") + test_env = { + **self.test_environ, + "EXTRATESTOPTS": " ".join(testopts) + " ${BUILDBOT_TESTOPTS}", + "TESTPYTHONOPTS": self.interpreterFlags, + } self.addStep( Test( command=test, timeout=step_timeout(self.test_timeout), usePTY=test_with_PTY, - env=self.test_environ, - workdir=util.Property("wasi_host_path"), + env=test_env, ) ) if not branch.is_pr and not has_option("-R", self.testFlags): @@ -1207,6 +1222,16 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs): ) +class Wasm32WasiPlatformDebugBuild(_Wasm32WasiPlatformBuild): + kind = "pydebug" + append_suffix = ".debug" + + +class Wasm32WasiPlatformReleaseBuild(_Wasm32WasiPlatformBuild): + kind = "release" + append_suffix = ".release" + + ############################################################################## ################################ IOS BUILDS ################################ ##############################################################################