diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c0c21bd0..ed3aa130 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -211,12 +211,23 @@ jobs: name: pythonbuild path: build - - name: Download images - uses: actions/download-artifact@v4 - with: - pattern: image-* - path: build - merge-multiple: true + # - name: Download images + # uses: actions/download-artifact@v4 + # with: + # pattern: image-* + # path: build + # merge-multiple: true + + # - name: Load Docker Images + # run: | + # for f in build/image-*.tar.zst; do + # echo "decompressing $f" + # zstd -d --rm ${f} + # done + # for f in build/image-*.tar; do + # echo "loading $f" + # docker load --input $f + # done - name: Cache downloads uses: actions/cache@v4 @@ -227,18 +238,6 @@ jobs: ${{ matrix.target_triple }}-${{ hashFiles('pythonbuild/downloads.py')}} ${{ matrix.target_triple }}- - - name: Load Docker Images - run: | - for f in build/image-*.tar.zst; do - echo "decompressing $f" - zstd -d --rm ${f} - done - - for f in build/image-*.tar; do - echo "loading $f" - docker load --input $f - done - - name: Build if: ${{ ! matrix.dry-run }} run: | diff --git a/ci-runners.yaml b/ci-runners.yaml index aeb0e5ca..e5598fb1 100644 --- a/ci-runners.yaml +++ b/ci-runners.yaml @@ -5,11 +5,10 @@ depot-ubuntu-22.04: platform: linux free: false -# TODO: Enable this runner to perform native builds for aarch64 -# depot-ubuntu-22.04-arm: -# arch: aarch64 -# platform: linux -# free: false +depot-ubuntu-22.04-arm: + arch: aarch64 + platform: linux + free: false depot-macos-latest: arch: x86_64 diff --git a/ci-targets.yaml b/ci-targets.yaml index cd892ac9..eccdf565 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -50,13 +50,11 @@ linux: - "3.14" build_options: - debug - - noopt - - lto + - pgo+lto build_options_conditional: - options: - freethreaded+debug - - freethreaded+noopt - - freethreaded+lto + - freethreaded+pgo+lto minimum-python-version: "3.13" armv7-unknown-linux-gnueabi: diff --git a/cpython-unix/targets.yml b/cpython-unix/targets.yml index 1b179768..1391a078 100644 --- a/cpython-unix/targets.yml +++ b/cpython-unix/targets.yml @@ -161,11 +161,11 @@ aarch64-unknown-linux-gnu: - '3.12' - '3.13' - '3.14' - docker_image_suffix: .cross - host_cc: /usr/bin/x86_64-linux-gnu-gcc - host_cxx: /usr/bin/x86_64-linux-gnu-g++ - target_cc: /usr/bin/aarch64-linux-gnu-gcc - target_cxx: /usr/bin/aarch64-linux-gnu-g++ + # docker_image_suffix: .aarch64 + host_cc: clang + host_cxx: clang++ + target_cc: clang + target_cxx: clang++ needs: - autoconf - bdb diff --git a/pythonbuild/docker.py b/pythonbuild/docker.py index 4269b2bd..2f850d1f 100644 --- a/pythonbuild/docker.py +++ b/pythonbuild/docker.py @@ -8,6 +8,7 @@ import os import pathlib import tarfile +import time import docker # type: ignore import jinja2 @@ -109,6 +110,25 @@ def run_container(client, image): container = client.containers.run( image, command=["/bin/sleep", "86400"], detach=True ) + + # Check if container is actually running + for _ in range(10): + container.reload() + + if container.status in ("created", "starting"): + time.sleep(1) + continue + + if container.status == "running": + break + + state = container.attrs.get("State", {}) + exit_code = state.get("ExitCode") + error = state.get("Error", "") + raise RuntimeError( + f"Container failed to start (status {container.status}) with exit code {exit_code}: {error}" + ) + try: yield container finally: @@ -119,10 +139,21 @@ def run_container(client, image): def container_exec(container, command, user="build", environment=None): # docker-py's exec_run() won't return the exit code. So we reinvent the # wheel. - create_res = container.client.api.exec_create( - container.id, command, user=user, environment=environment - ) - + try: + create_res = container.client.api.exec_create( + container.id, command, user=user, environment=environment + ) + except Exception as exc: + if container.status != "running": + state = container.attrs.get("State", {}) + exit_code = state.get("ExitCode") + error = state.get("Error", "") + raise RuntimeError( + f"Container is not running (status {container.status}) with exit code {exit_code}: {error}" + ) from exc + else: + raise + exec_output = container.client.api.exec_start(create_res["Id"], stream=True) for chunk in exec_output: