Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
PYTHONOS_QEMU_ACCEL: tcg
PYTHONOS_GUI_BOOT_TIMEOUT: "90"
PYTHONOS_AUDIO_BOOT_TIMEOUT: "90"
# Both empty except on the macOS Intel runner, where the readers fall
# back to their defaults.
PYTHONOS_BUILD_JOBS: ${{ matrix.build_jobs }}
PYTHONOS_GUI_COMMAND_TIMEOUT: ${{ matrix.gui_command_timeout }}
strategy:
fail-fast: false
matrix:
Expand All @@ -41,6 +45,12 @@ jobs:
# replace with macos-latest (Apple Silicon) without validating Docker.
- name: macos-x86_64
runner: macos-15-intel
# One compiler at a time, and a longer GUI command budget: this
# runner builds and boots inside a QEMU-backed colima VM, so both
# the cross compiler and the guest are markedly slower than the
# Linux hosts.
build_jobs: "1"
gui_command_timeout: "240"
qemu_bin: qemu-system-x86_64
artifact: pythonos-macos-x86_64
artifact_path: build/pythonos.iso
Expand Down
3 changes: 2 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ docker-build:
# ── CPython library (slow, cached — only rebuild if missing) ─────────────────

$(LIBPYTHON): tools/setup_cpython.sh .docker-image
$(DOCKER_RUN) -e PYTHONOS_FREE_THREADING=$(PYTHONOS_FREE_THREADING) $(DOCKER_IMG) \
$(DOCKER_RUN) -e PYTHONOS_FREE_THREADING=$(PYTHONOS_FREE_THREADING) \
-e PYTHONOS_BUILD_JOBS=$(PYTHONOS_BUILD_JOBS) $(DOCKER_IMG) \
./tools/setup_cpython.sh --build

# ── Source file sets ($(wildcard) is evaluated by Make, not a subshell) ──────
Expand Down
21 changes: 19 additions & 2 deletions tests/gui_smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,26 @@
QemuMonitor, parse_ppm, sample_pixel, color_close,
)

def _env_seconds(name: str, default: float) -> float:
"""Read a timeout from the environment, falling back on anything unusable.

A workflow that sets this from an unset matrix key passes an empty string
rather than leaving the variable out, and bare float("") raises. Treat
empty, non-numeric and non-positive values as "not configured" so a typo
cannot turn a timeout into a crash -- or into zero.
"""
raw = os.environ.get(name, "")
try:
value = float(raw)
except ValueError:
return default
return value if value > 0 else default


ISO = sys.argv[1] if len(sys.argv) > 1 else "build/pythonos.iso"
PORT = int(os.environ.get("PYTHONOS_GUI_HOST_PORT", "5559"))
BOOT_TIMEOUT = float(os.environ.get("PYTHONOS_GUI_BOOT_TIMEOUT", "30"))
BOOT_TIMEOUT = _env_seconds("PYTHONOS_GUI_BOOT_TIMEOUT", 30.0)
COMMAND_TIMEOUT = _env_seconds("PYTHONOS_GUI_COMMAND_TIMEOUT", 15.0)

SERIAL_LOG = "/tmp/pythonos-gui-smoke.log"
MONITOR_SOCK = "/tmp/pythonos-gui-smoke.mon.sock"
Expand Down Expand Up @@ -84,7 +101,7 @@ def _send(s: socket.socket, line: str, wait: float = 2.5) -> str:
chunks = []
# Cross-architecture TCG can exceed the old 1-2.5 second budgets. This is
# a deadline, not a sleep: successful commands still return immediately.
deadline = time.time() + max(wait, float(os.environ.get("PYTHONOS_GUI_COMMAND_TIMEOUT", "15")))
deadline = time.time() + max(wait, COMMAND_TIMEOUT)
marker_seen = False
complete = False
while time.time() < deadline:
Expand Down
11 changes: 10 additions & 1 deletion tools/setup_cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,16 @@ if [[ "$BUILD_REQUESTED" == "1" ]]; then
# PYTHON_FOR_FREEZE — use python3.14 for non-bootstrap freeze
# -W Makefile -W Modules/config.c: additionally tell make both are up-to-date
# so the self-regen recipe is skipped if possible.
make -j"$(nproc)" "$LIBPYTHON_ARCHIVE" \
# PYTHONOS_BUILD_JOBS caps parallelism for hosts that cannot feed nproc
# compilers at once. The macOS Intel runner builds inside a 6 GB colima VM,
# where three concurrent cc1 processes on CPython's larger generated
# translation units crash the compiler -- a different file each time.
jobs="${PYTHONOS_BUILD_JOBS:-$(nproc)}"
case "$jobs" in
''|*[!0-9]*|0) jobs="$(nproc)" ;;
esac
echo "[setup_cpython] building libpython with -j$jobs"
make -j"$jobs" "$LIBPYTHON_ARCHIVE" \
-W Makefile \
-W Modules/config.c \
'FREEZE_MODULE_BOOTSTRAP=python3.14 ./Programs/_freeze_module.py' \
Expand Down
Loading