mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-02-21 16:21:44 +00:00
Add Python install cache restore test
This commit is contained in:
parent
a61896fc1e
commit
08df9dc1e9
1 changed files with 23 additions and 3 deletions
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
|
|
@ -847,6 +847,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-python: true
|
cache-python: true
|
||||||
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-cache-python-installs
|
||||||
- run: uv sync --verbose
|
- run: uv sync --verbose
|
||||||
working-directory: __tests__/fixtures/uv-project-pinned-python
|
working-directory: __tests__/fixtures/uv-project-pinned-python
|
||||||
- name: Verify the correct Python version is installed
|
- name: Verify the correct Python version is installed
|
||||||
|
|
@ -864,12 +865,29 @@ jobs:
|
||||||
echo "Python install dir should exist"
|
echo "Python install dir should exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Verify Python is installed in install dir
|
test-restore-python-installs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test-cache-python-installs
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Restore with cache
|
||||||
|
id: restore
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
cache-python: true
|
||||||
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-cache-python-installs
|
||||||
|
- name: Cache was hit
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f ~/.local/share/uv/python/cpython-3.13.3-linux-x86_64-gnu/bin/python3.13 ]; then
|
if [ "$CACHE_HIT" != "true" ]; then
|
||||||
echo "Python binary does not exist"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
env:
|
||||||
|
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||||
|
- run: uv sync
|
||||||
|
working-directory: __tests__/fixtures/uv-project-pinned-python
|
||||||
|
|
||||||
all-tests-passed:
|
all-tests-passed:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -913,6 +931,8 @@ jobs:
|
||||||
- test-relative-path
|
- test-relative-path
|
||||||
- test-cache-prune-force
|
- test-cache-prune-force
|
||||||
- test-cache-dir-from-file
|
- test-cache-dir-from-file
|
||||||
|
- test-cache-python-installs
|
||||||
|
- test-restore-python-installs
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: All tests passed
|
- name: All tests passed
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue