ci: resolve Python from persistent toolcache, bypass setup-python download
This commit is contained in:
+24
-16
@@ -32,21 +32,25 @@ jobs:
|
|||||||
echo "uv not found in toolcache"
|
echo "uv not found in toolcache"
|
||||||
fi
|
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
|
- name: Install uv
|
||||||
if: steps.uv.outputs.found != 'true'
|
if: steps.uv.outputs.found != 'true'
|
||||||
uses: astral-sh/setup-uv@v3
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
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 }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
if: steps.py.outputs.found != 'true'
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
@@ -95,21 +99,25 @@ jobs:
|
|||||||
echo "uv not found in toolcache"
|
echo "uv not found in toolcache"
|
||||||
fi
|
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
|
- name: Install uv
|
||||||
if: steps.uv.outputs.found != 'true'
|
if: steps.uv.outputs.found != 'true'
|
||||||
uses: astral-sh/setup-uv@v3
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
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
|
- name: Set up Python
|
||||||
|
if: steps.py.outputs.found != 'true'
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.13"
|
python-version: "3.13"
|
||||||
|
|||||||
Reference in New Issue
Block a user