diff --git a/.github/actions/setup-build-environment/action.yml b/.github/actions/setup-build-environment/action.yml index dbacae21..6a8087a1 100644 --- a/.github/actions/setup-build-environment/action.yml +++ b/.github/actions/setup-build-environment/action.yml @@ -11,25 +11,20 @@ runs: ~/.platformio/.cache key: ${{ runner.os }}-pio + # CUSTOM (TeTeHacko): no actions/setup-python (upstream: '3.13'). Its + # Python for Ubuntu 26.04, the runner image, is built for x86-64-v3 and + # grg-runner (Xeon E5-2630L v2) has only v2: "CPU ISA level is lower than + # required" on every run. The image's own python3 runs anywhere and the + # build needs no particular 3.x, so the build runs in a venv of it. - name: Install Python - id: python - continue-on-error: true - uses: actions/setup-python@v6 - with: - python-version: '3.13' - - # CUSTOM (TeTeHacko): setup-python's build for the runner OS can need a - # newer CPU than the runner host has ("CPU ISA level is lower than - # required"); fall back to the image's own python3 in a venv - - name: Python fallback - if: steps.python.outcome == 'failure' shell: bash run: | set -euo pipefail + SUDO="$(command -v sudo || true)" venv="$RUNNER_TEMP/pyenv" if ! python3 -m venv "$venv"; then - apt-get update -qq - apt-get install -y -qq python3 python3-venv + $SUDO apt-get update -qq + $SUDO apt-get install -y -qq python3 python3-venv python3 -m venv --clear "$venv" fi # The image's python is often newer than the wheels on PyPI (detools @@ -37,8 +32,8 @@ runs: # headers, which the image does not ship. inc="$("$venv/bin/python" -c 'import sysconfig; print(sysconfig.get_paths()["include"])')" if [ ! -e "$inc/Python.h" ]; then - apt-get update -qq - apt-get install -y -qq python3-dev + $SUDO apt-get update -qq + $SUDO apt-get install -y -qq python3-dev fi echo "$venv/bin" >>"$GITHUB_PATH" "$venv/bin/python" --version