ci: resolve Python from persistent toolcache, bypass setup-python download
CI / test (3.13) (push) Failing after 17m33s
CI / build (push) Skipped

This commit is contained in:
ahp
2026-09-12 15:04:16 +03:30
parent 8206b7e96d
commit a06b8790c5
+24 -16
View File
@@ -32,21 +32,25 @@ jobs:
echo "uv not found in toolcache"
fi
- name: Enable Python from toolcache
id: py
run: |
py_bin="$(find /opt/hostedtoolcache/Python -maxdepth 4 -type f -name 'python3*' -perm -111 2>/dev/null | grep -v -- '-config$' | head -1)"
if [ -n "$py_bin" ]; then
dirname "$py_bin" >> "$GITHUB_PATH"
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "python not found in toolcache"
fi
- name: Install uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Cache Python toolchain
uses: actions/cache@v4
with:
path: /opt/hostedtoolcache/Python
key: python-${{ matrix.python-version }}-${{ runner.os }}
restore-keys: |
python-${{ matrix.python-version }}-
- name: Set up Python ${{ matrix.python-version }}
if: steps.py.outputs.found != 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
@@ -95,21 +99,25 @@ jobs:
echo "uv not found in toolcache"
fi
- name: Enable Python from toolcache
id: py
run: |
py_bin="$(find /opt/hostedtoolcache/Python -maxdepth 4 -type f -name 'python3*' -perm -111 2>/dev/null | grep -v -- '-config$' | head -1)"
if [ -n "$py_bin" ]; then
dirname "$py_bin" >> "$GITHUB_PATH"
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "python not found in toolcache"
fi
- name: Install uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Cache Python toolchain
uses: actions/cache@v4
with:
path: /opt/hostedtoolcache/Python
key: python-3.13-${{ runner.os }}
restore-keys: |
python-3.13-
- name: Set up Python
if: steps.py.outputs.found != 'true'
uses: actions/setup-python@v5
with:
python-version: "3.13"