From 03d06d5176752e78133afb1b43271e8e3c8ece58 Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Thu, 12 Nov 2026 16:26:23 +0100 Subject: [PATCH] ci: fall back to the image's python3 when setup-python's build cannot run Co-Authored-By: Claude Opus 5.5 --- .../setup-build-environment/action.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/actions/setup-build-environment/action.yml b/.github/actions/setup-build-environment/action.yml index cba2d2e5..fc640f3d 100644 --- a/.github/actions/setup-build-environment/action.yml +++ b/.github/actions/setup-build-environment/action.yml @@ -12,10 +12,29 @@ runs: key: ${{ runner.os }}-pio - 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 + venv="$RUNNER_TEMP/pyenv" + if ! python3 -m venv "$venv"; then + apt-get update -qq + apt-get install -y -qq python3 python3-venv + python3 -m venv --clear "$venv" + fi + echo "$venv/bin" >>"$GITHUB_PATH" + "$venv/bin/python" --version + - name: Install PlatformIO shell: bash run: |