mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-12-15 11:07:14 +00:00
Compare commits
4 Commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
681c641aba | ||
|
|
2e85713bb0 | ||
|
|
58b6d7b303 | ||
|
|
e8b52af86e |
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
139
.github/workflows/test.yml
vendored
139
.github/workflows/test.yml
vendored
@@ -21,14 +21,14 @@ jobs:
|
||||
permissions:
|
||||
security-events: write # for zizmor
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Actionlint
|
||||
uses: eifinger/actionlint-action@213860089b7cf97d640aa67567898fabeb132746 # v1.9.3
|
||||
- name: Run zizmor
|
||||
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
test-uv-no-modify-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install with UV_NO_MODIFY_PATH set
|
||||
@@ -125,7 +125,7 @@ jobs:
|
||||
expected-version: "0.1.0"
|
||||
resolution-strategy: "lowest"
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install version ${{ matrix.input.version-input }} with strategy ${{ matrix.input.resolution-strategy || 'highest' }}
|
||||
@@ -154,7 +154,7 @@ jobs:
|
||||
matrix:
|
||||
version-input: ["latest", ">=0.8"]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install version ${{ matrix.version-input }}
|
||||
@@ -182,7 +182,7 @@ jobs:
|
||||
- working-directory: "__tests__/fixtures/uv-toml-project"
|
||||
expected-version: "0.5.15"
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install version from ${{ matrix.input.working-directory }}
|
||||
@@ -208,7 +208,7 @@ jobs:
|
||||
- version-file: "__tests__/fixtures/.tool-versions"
|
||||
expected-version: "0.5.15"
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install version from ${{ matrix.input.version-file }}
|
||||
@@ -225,7 +225,7 @@ jobs:
|
||||
test-malformed-pyproject-file-fallback:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install using malformed pyproject.toml
|
||||
@@ -245,7 +245,7 @@ jobs:
|
||||
- os: macos-latest
|
||||
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Checksum matches expected
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
test-with-explicit-token:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install default version
|
||||
@@ -272,7 +272,7 @@ jobs:
|
||||
test-uvx:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install default version
|
||||
@@ -285,7 +285,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install default version
|
||||
@@ -296,7 +296,7 @@ jobs:
|
||||
test-tilde-expansion-tool-dirs:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -321,7 +321,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
@@ -344,7 +344,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
@@ -381,14 +381,64 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container: alpine
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
id: setup-uv
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Verify cache key contains alpine
|
||||
run: |
|
||||
echo "Cache key: $CACHE_KEY"
|
||||
if echo "$CACHE_KEY" | grep -qv "alpine"; then
|
||||
echo "Cache key does not contain 'alpine'"
|
||||
exit 1
|
||||
fi
|
||||
shell: sh
|
||||
env:
|
||||
CACHE_KEY: ${{ steps.setup-uv.outputs.cache-key }}
|
||||
- run: uv sync
|
||||
working-directory: __tests__/fixtures/uv-project
|
||||
|
||||
test-cache-key-os-version:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
expected-os: "ubuntu-22.04"
|
||||
- os: ubuntu-24.04
|
||||
expected-os: "ubuntu-24.04"
|
||||
- os: macos-14
|
||||
expected-os: "macos-14"
|
||||
- os: macos-15
|
||||
expected-os: "macos-15"
|
||||
- os: windows-2022
|
||||
expected-os: "windows-2022"
|
||||
- os: windows-2025
|
||||
expected-os: "windows-2025"
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup uv
|
||||
id: setup-uv
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Verify cache key contains OS version
|
||||
run: |
|
||||
echo "Cache key: $CACHE_KEY"
|
||||
if [[ "$CACHE_KEY" != *"${{ matrix.expected-os }}"* ]]; then
|
||||
echo "Cache key does not contain expected OS version: ${{ matrix.expected-os }}"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
env:
|
||||
CACHE_KEY: ${{ steps.setup-uv.outputs.cache-key }}
|
||||
|
||||
test-setup-cache:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@@ -396,7 +446,7 @@ jobs:
|
||||
enable-cache: ["true", "false", "auto"]
|
||||
os: ["ubuntu-latest", "selfhosted-ubuntu-arm64", "windows-latest"]
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -415,7 +465,7 @@ jobs:
|
||||
os: ["ubuntu-latest", "selfhosted-ubuntu-arm64", "windows-latest"]
|
||||
needs: test-setup-cache
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Restore with cache
|
||||
@@ -449,7 +499,7 @@ jobs:
|
||||
test-setup-cache-requirements-txt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -465,7 +515,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-setup-cache-requirements-txt
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Restore with cache
|
||||
@@ -489,7 +539,7 @@ jobs:
|
||||
test-setup-cache-dependency-glob:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -506,7 +556,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-setup-cache-dependency-glob
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Change pyproject.toml
|
||||
@@ -534,7 +584,7 @@ jobs:
|
||||
test-setup-cache-save-cache-false:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -550,7 +600,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-setup-cache-save-cache-false
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Restore with cache
|
||||
@@ -570,7 +620,7 @@ jobs:
|
||||
test-setup-cache-restore-cache-false:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -585,7 +635,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-setup-cache-restore-cache-false
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Restore with cache
|
||||
@@ -615,7 +665,7 @@ jobs:
|
||||
expected-cache-dir: "/home/ubuntu/.cache/uv"
|
||||
runs-on: ${{ matrix.inputs.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -633,7 +683,7 @@ jobs:
|
||||
test-cache-local-cache-disabled:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup without cache
|
||||
@@ -652,7 +702,7 @@ jobs:
|
||||
test-cache-local-cache-disabled-but-explicit-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup without cache
|
||||
@@ -672,7 +722,7 @@ jobs:
|
||||
test-setup-cache-local:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup with cache
|
||||
@@ -687,7 +737,7 @@ jobs:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
needs: test-setup-cache-local
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Restore with cache
|
||||
@@ -710,7 +760,7 @@ jobs:
|
||||
test-tilde-expansion-cache-local-path:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Create cache directory
|
||||
@@ -726,7 +776,7 @@ jobs:
|
||||
test-tilde-expansion-cache-dependency-glob:
|
||||
runs-on: selfhosted-ubuntu-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Create cache directory
|
||||
@@ -761,7 +811,7 @@ jobs:
|
||||
test-no-python-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Fake pyproject.toml at root
|
||||
@@ -776,7 +826,7 @@ jobs:
|
||||
test-custom-manifest-file:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install from custom manifest file
|
||||
@@ -795,7 +845,7 @@ jobs:
|
||||
test-absolute-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Create requirements.txt
|
||||
@@ -815,7 +865,7 @@ jobs:
|
||||
test-relative-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: mkdir
|
||||
@@ -839,7 +889,7 @@ jobs:
|
||||
test-cache-prune-force:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup uv
|
||||
@@ -856,7 +906,7 @@ jobs:
|
||||
test-cache-dir-from-file:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify uv cache dir is not populated
|
||||
@@ -881,7 +931,7 @@ jobs:
|
||||
test-cache-python-installs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify Python install dir is not populated
|
||||
@@ -908,7 +958,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-cache-python-installs
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify Python install dir does not exist
|
||||
@@ -952,7 +1002,7 @@ jobs:
|
||||
expected-python-dir: "/home/ubuntu/.local/share/uv/python"
|
||||
runs-on: ${{ matrix.inputs.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
@@ -971,7 +1021,7 @@ jobs:
|
||||
test-act:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install act
|
||||
@@ -1002,6 +1052,7 @@ jobs:
|
||||
- test-python-version
|
||||
- test-activate-environment
|
||||
- test-musl
|
||||
- test-cache-key-os-version
|
||||
- test-cache-local
|
||||
- test-cache-local-cache-disabled
|
||||
- test-cache-local-cache-disabled-but-explicit-path
|
||||
|
||||
4
.github/workflows/update-known-versions.yml
vendored
4
.github/workflows/update-known-versions.yml
vendored
@@ -15,10 +15,10 @@ jobs:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: true
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: "20"
|
||||
- name: Update known versions
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: true # needed for git push below
|
||||
- name: Update Major Minor Tags
|
||||
|
||||
@@ -89,6 +89,8 @@ outputs:
|
||||
description: "The path to the installed uvx binary."
|
||||
cache-hit:
|
||||
description: "A boolean value to indicate a cache entry was found"
|
||||
cache-key:
|
||||
description: "The cache key used for storing/restoring the cache"
|
||||
venv:
|
||||
description: "Path to the activated venv if activate-environment is true"
|
||||
runs:
|
||||
|
||||
77
dist/save-cache/index.js
generated
vendored
77
dist/save-cache/index.js
generated
vendored
@@ -90609,10 +90609,11 @@ const inputs_1 = __nccwpck_require__(9612);
|
||||
const platforms_1 = __nccwpck_require__(8361);
|
||||
exports.STATE_CACHE_KEY = "cache-key";
|
||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
const CACHE_VERSION = "1";
|
||||
const CACHE_VERSION = "2";
|
||||
async function restoreCache() {
|
||||
const cacheKey = await computeKeys();
|
||||
core.saveState(exports.STATE_CACHE_KEY, cacheKey);
|
||||
core.setOutput("cache-key", cacheKey);
|
||||
if (!inputs_1.restoreCache) {
|
||||
core.info("restore-cache is false. Skipping restore cache step.");
|
||||
return;
|
||||
@@ -90652,9 +90653,10 @@ async function computeKeys() {
|
||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
||||
const pythonVersion = await getPythonVersion();
|
||||
const platform = await (0, platforms_1.getPlatform)();
|
||||
const osNameVersion = (0, platforms_1.getOSNameVersion)();
|
||||
const pruned = inputs_1.pruneCache ? "-pruned" : "";
|
||||
const python = inputs_1.cachePython ? "-py" : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${osNameVersion}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
async function getPythonVersion() {
|
||||
if (inputs_1.pythonVersion !== "") {
|
||||
@@ -91282,9 +91284,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getArch = getArch;
|
||||
exports.getPlatform = getPlatform;
|
||||
exports.getOSNameVersion = getOSNameVersion;
|
||||
const node_fs_1 = __importDefault(__nccwpck_require__(3024));
|
||||
const node_os_1 = __importDefault(__nccwpck_require__(8161));
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
const exec = __importStar(__nccwpck_require__(5236));
|
||||
function getArch() {
|
||||
@@ -91342,6 +91350,63 @@ async function isMuslOs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns OS name and version for cache key differentiation.
|
||||
* Examples: "ubuntu-22.04", "macos-14", "windows-2022"
|
||||
* Throws if OS detection fails.
|
||||
*/
|
||||
function getOSNameVersion() {
|
||||
const platform = process.platform;
|
||||
if (platform === "linux") {
|
||||
return getLinuxOSNameVersion();
|
||||
}
|
||||
if (platform === "darwin") {
|
||||
return getMacOSNameVersion();
|
||||
}
|
||||
if (platform === "win32") {
|
||||
return getWindowsNameVersion();
|
||||
}
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
function getLinuxOSNameVersion() {
|
||||
const files = ["/etc/os-release", "/usr/lib/os-release"];
|
||||
for (const file of files) {
|
||||
try {
|
||||
const content = node_fs_1.default.readFileSync(file, "utf8");
|
||||
const id = parseOsReleaseValue(content, "ID");
|
||||
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
||||
if (id && versionId) {
|
||||
return `${id}-${versionId}`;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Try next file
|
||||
}
|
||||
}
|
||||
throw new Error("Failed to determine Linux distribution. " +
|
||||
"Could not read /etc/os-release or /usr/lib/os-release");
|
||||
}
|
||||
function parseOsReleaseValue(content, key) {
|
||||
const regex = new RegExp(`^${key}=["']?([^"'\\n]*)["']?$`, "m");
|
||||
const match = content.match(regex);
|
||||
return match?.[1];
|
||||
}
|
||||
function getMacOSNameVersion() {
|
||||
const darwinVersion = Number.parseInt(node_os_1.default.release().split(".")[0], 10);
|
||||
if (Number.isNaN(darwinVersion)) {
|
||||
throw new Error(`Failed to parse macOS version from: ${node_os_1.default.release()}`);
|
||||
}
|
||||
const macosVersion = darwinVersion - 9;
|
||||
return `macos-${macosVersion}`;
|
||||
}
|
||||
function getWindowsNameVersion() {
|
||||
const version = node_os_1.default.version();
|
||||
const match = version.match(/Windows(?: Server)? (\d+)/);
|
||||
if (!match) {
|
||||
throw new Error(`Failed to parse Windows version from: ${version}`);
|
||||
}
|
||||
return `windows-${match[1]}`;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -91482,6 +91547,14 @@ module.exports = require("node:fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8161:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:os");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6760:
|
||||
/***/ ((module) => {
|
||||
|
||||
|
||||
95
dist/setup/index.js
generated
vendored
95
dist/setup/index.js
generated
vendored
@@ -91512,10 +91512,11 @@ const inputs_1 = __nccwpck_require__(9612);
|
||||
const platforms_1 = __nccwpck_require__(8361);
|
||||
exports.STATE_CACHE_KEY = "cache-key";
|
||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
const CACHE_VERSION = "1";
|
||||
const CACHE_VERSION = "2";
|
||||
async function restoreCache() {
|
||||
const cacheKey = await computeKeys();
|
||||
core.saveState(exports.STATE_CACHE_KEY, cacheKey);
|
||||
core.setOutput("cache-key", cacheKey);
|
||||
if (!inputs_1.restoreCache) {
|
||||
core.info("restore-cache is false. Skipping restore cache step.");
|
||||
return;
|
||||
@@ -91555,9 +91556,10 @@ async function computeKeys() {
|
||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
||||
const pythonVersion = await getPythonVersion();
|
||||
const platform = await (0, platforms_1.getPlatform)();
|
||||
const osNameVersion = (0, platforms_1.getOSNameVersion)();
|
||||
const pruned = inputs_1.pruneCache ? "-pruned" : "";
|
||||
const python = inputs_1.cachePython ? "-py" : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${platform}-${osNameVersion}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
async function getPythonVersion() {
|
||||
if (inputs_1.pythonVersion !== "") {
|
||||
@@ -91699,6 +91701,24 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.KNOWN_CHECKSUMS = void 0;
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
exports.KNOWN_CHECKSUMS = {
|
||||
"aarch64-apple-darwin-0.9.17": "a1e1464aa1d04d5e5fa700aa2f2e10397d1114e835dbd56be25ba65c9a31bd99",
|
||||
"aarch64-pc-windows-msvc-0.9.17": "28423a27ad1d82347c00411a6792567119b3c1cfe775d3312c0e08a6b489be5b",
|
||||
"aarch64-unknown-linux-gnu-0.9.17": "e9eba97b7169e47fd3c926e409f0b714820f0befc23b3ae062780586a793e4cc",
|
||||
"aarch64-unknown-linux-musl-0.9.17": "f6f48a301f8e855765af42ef50257af0cebc9c5439dfdcbc188142941aea45ca",
|
||||
"arm-unknown-linux-musleabihf-0.9.17": "4d80f3509b6351882a64c1dd08f72a80e2b27f055a996295ef1f935bc3efcdde",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.17": "30a6c041429e2176062573f33c5c44307cb756264224bcb005723a6e18cff34c",
|
||||
"armv7-unknown-linux-musleabihf-0.9.17": "6b034dc63735c2a4541430cbece688e28bce51a09e2ad1ea2c1646a6b24cf1c3",
|
||||
"i686-pc-windows-msvc-0.9.17": "6e93737710e31bf73fcc3b4b6da616bd341e9c6baf1162ddc1e7f65884063f50",
|
||||
"i686-unknown-linux-gnu-0.9.17": "d2426a6d10bedd83524599bb0fbe0ba22e681ed45e892b4fd29086b424daf02a",
|
||||
"i686-unknown-linux-musl-0.9.17": "988c7702a2e88092b30f16fb7f8c18284a8062044cf57e6abd1dfeae82aa6377",
|
||||
"powerpc64-unknown-linux-gnu-0.9.17": "5ad301d9fa15e0791ef96abd83f0ed97e7ac1191b4b7578caaad3151633fb17c",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.17": "4958185c5febf22f1c4c84944334cb0d9262c2c2c93faf30c1e0abd26f9d94fa",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.17": "feed7cc7b5fc8a99e683ee1761cf99e3da12b60a2a413b7b87a0447726a66369",
|
||||
"s390x-unknown-linux-gnu-0.9.17": "a297518913a0f0e4af1bce434440ca9d415728aaf828c7def0e913aa5c46da8f",
|
||||
"x86_64-apple-darwin-0.9.17": "249e7fb18d45c06ba283c48f0a8e586ecc5fbb9e8dad0923c4169a7c4db815b2",
|
||||
"x86_64-pc-windows-msvc-0.9.17": "ebc76197bf3e1a58f9dac6f70f49b0ebd3e6907ab35289ce228bce5ba8a3f201",
|
||||
"x86_64-unknown-linux-gnu-0.9.17": "0114d54f9aafd07516cf1cadfe72afa970f5fd293fbe82dd924b8a7b42c984d8",
|
||||
"x86_64-unknown-linux-musl-0.9.17": "ab616c1851e7b1ed377a9ff3997dcee184bea7eda0b20bc8607abba6c469cbad",
|
||||
"aarch64-apple-darwin-0.9.16": "db6d7fb299c35dc9bbbeb89cfa9aa55a9584f637d370c0a4c62a50df9c9294a7",
|
||||
"aarch64-pc-windows-msvc-0.9.16": "591c73f47dfec72f9d242eebcb36197f27ad652a59d70e70db5c52018684d78e",
|
||||
"aarch64-unknown-linux-gnu-0.9.16": "a8e9e3f7e621e212d9663ea28827bd8fb9ec11c453ae88d520b48e969e9ff5db",
|
||||
@@ -96773,9 +96793,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getArch = getArch;
|
||||
exports.getPlatform = getPlatform;
|
||||
exports.getOSNameVersion = getOSNameVersion;
|
||||
const node_fs_1 = __importDefault(__nccwpck_require__(3024));
|
||||
const node_os_1 = __importDefault(__nccwpck_require__(8161));
|
||||
const core = __importStar(__nccwpck_require__(7484));
|
||||
const exec = __importStar(__nccwpck_require__(5236));
|
||||
function getArch() {
|
||||
@@ -96833,6 +96859,63 @@ async function isMuslOs() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns OS name and version for cache key differentiation.
|
||||
* Examples: "ubuntu-22.04", "macos-14", "windows-2022"
|
||||
* Throws if OS detection fails.
|
||||
*/
|
||||
function getOSNameVersion() {
|
||||
const platform = process.platform;
|
||||
if (platform === "linux") {
|
||||
return getLinuxOSNameVersion();
|
||||
}
|
||||
if (platform === "darwin") {
|
||||
return getMacOSNameVersion();
|
||||
}
|
||||
if (platform === "win32") {
|
||||
return getWindowsNameVersion();
|
||||
}
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
function getLinuxOSNameVersion() {
|
||||
const files = ["/etc/os-release", "/usr/lib/os-release"];
|
||||
for (const file of files) {
|
||||
try {
|
||||
const content = node_fs_1.default.readFileSync(file, "utf8");
|
||||
const id = parseOsReleaseValue(content, "ID");
|
||||
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
||||
if (id && versionId) {
|
||||
return `${id}-${versionId}`;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Try next file
|
||||
}
|
||||
}
|
||||
throw new Error("Failed to determine Linux distribution. " +
|
||||
"Could not read /etc/os-release or /usr/lib/os-release");
|
||||
}
|
||||
function parseOsReleaseValue(content, key) {
|
||||
const regex = new RegExp(`^${key}=["']?([^"'\\n]*)["']?$`, "m");
|
||||
const match = content.match(regex);
|
||||
return match?.[1];
|
||||
}
|
||||
function getMacOSNameVersion() {
|
||||
const darwinVersion = Number.parseInt(node_os_1.default.release().split(".")[0], 10);
|
||||
if (Number.isNaN(darwinVersion)) {
|
||||
throw new Error(`Failed to parse macOS version from: ${node_os_1.default.release()}`);
|
||||
}
|
||||
const macosVersion = darwinVersion - 9;
|
||||
return `macos-${macosVersion}`;
|
||||
}
|
||||
function getWindowsNameVersion() {
|
||||
const version = node_os_1.default.version();
|
||||
const match = version.match(/Windows(?: Server)? (\d+)/);
|
||||
if (!match) {
|
||||
throw new Error(`Failed to parse Windows version from: ${version}`);
|
||||
}
|
||||
return `windows-${match[1]}`;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -97198,6 +97281,14 @@ module.exports = require("node:fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8161:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:os");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6760:
|
||||
/***/ ((module) => {
|
||||
|
||||
|
||||
18
dist/update-known-versions/index.js
generated
vendored
18
dist/update-known-versions/index.js
generated
vendored
@@ -28196,6 +28196,24 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.KNOWN_CHECKSUMS = void 0;
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
exports.KNOWN_CHECKSUMS = {
|
||||
"aarch64-apple-darwin-0.9.17": "a1e1464aa1d04d5e5fa700aa2f2e10397d1114e835dbd56be25ba65c9a31bd99",
|
||||
"aarch64-pc-windows-msvc-0.9.17": "28423a27ad1d82347c00411a6792567119b3c1cfe775d3312c0e08a6b489be5b",
|
||||
"aarch64-unknown-linux-gnu-0.9.17": "e9eba97b7169e47fd3c926e409f0b714820f0befc23b3ae062780586a793e4cc",
|
||||
"aarch64-unknown-linux-musl-0.9.17": "f6f48a301f8e855765af42ef50257af0cebc9c5439dfdcbc188142941aea45ca",
|
||||
"arm-unknown-linux-musleabihf-0.9.17": "4d80f3509b6351882a64c1dd08f72a80e2b27f055a996295ef1f935bc3efcdde",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.17": "30a6c041429e2176062573f33c5c44307cb756264224bcb005723a6e18cff34c",
|
||||
"armv7-unknown-linux-musleabihf-0.9.17": "6b034dc63735c2a4541430cbece688e28bce51a09e2ad1ea2c1646a6b24cf1c3",
|
||||
"i686-pc-windows-msvc-0.9.17": "6e93737710e31bf73fcc3b4b6da616bd341e9c6baf1162ddc1e7f65884063f50",
|
||||
"i686-unknown-linux-gnu-0.9.17": "d2426a6d10bedd83524599bb0fbe0ba22e681ed45e892b4fd29086b424daf02a",
|
||||
"i686-unknown-linux-musl-0.9.17": "988c7702a2e88092b30f16fb7f8c18284a8062044cf57e6abd1dfeae82aa6377",
|
||||
"powerpc64-unknown-linux-gnu-0.9.17": "5ad301d9fa15e0791ef96abd83f0ed97e7ac1191b4b7578caaad3151633fb17c",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.17": "4958185c5febf22f1c4c84944334cb0d9262c2c2c93faf30c1e0abd26f9d94fa",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.17": "feed7cc7b5fc8a99e683ee1761cf99e3da12b60a2a413b7b87a0447726a66369",
|
||||
"s390x-unknown-linux-gnu-0.9.17": "a297518913a0f0e4af1bce434440ca9d415728aaf828c7def0e913aa5c46da8f",
|
||||
"x86_64-apple-darwin-0.9.17": "249e7fb18d45c06ba283c48f0a8e586ecc5fbb9e8dad0923c4169a7c4db815b2",
|
||||
"x86_64-pc-windows-msvc-0.9.17": "ebc76197bf3e1a58f9dac6f70f49b0ebd3e6907ab35289ce228bce5ba8a3f201",
|
||||
"x86_64-unknown-linux-gnu-0.9.17": "0114d54f9aafd07516cf1cadfe72afa970f5fd293fbe82dd924b8a7b42c984d8",
|
||||
"x86_64-unknown-linux-musl-0.9.17": "ab616c1851e7b1ed377a9ff3997dcee184bea7eda0b20bc8607abba6c469cbad",
|
||||
"aarch64-apple-darwin-0.9.16": "db6d7fb299c35dc9bbbeb89cfa9aa55a9584f637d370c0a4c62a50df9c9294a7",
|
||||
"aarch64-pc-windows-msvc-0.9.16": "591c73f47dfec72f9d242eebcb36197f27ad652a59d70e70db5c52018684d78e",
|
||||
"aarch64-unknown-linux-gnu-0.9.16": "a8e9e3f7e621e212d9663ea28827bd8fb9ec11c453ae88d520b48e969e9ff5db",
|
||||
|
||||
@@ -2,6 +2,34 @@
|
||||
|
||||
This document covers all caching-related configuration options for setup-uv.
|
||||
|
||||
## Cache key
|
||||
|
||||
The cache key is automatically generated based on:
|
||||
|
||||
- **Architecture**: CPU architecture (e.g., `x86_64`, `aarch64`)
|
||||
- **Platform**: OS platform type (e.g., `unknown-linux-gnu`, `unknown-linux-musl`, `apple-darwin`,
|
||||
`pc-windows-msvc`)
|
||||
- **OS version**: OS name and version (e.g., `ubuntu-22.04`, `macos-14`, `windows-2022`)
|
||||
- **Python version**: The Python version in use
|
||||
- **Cache options**: Whether pruning and Python caching are enabled
|
||||
- **Dependency hash**: Hash of files matching `cache-dependency-glob`
|
||||
- **Suffix**: Optional `cache-suffix` if provided
|
||||
|
||||
Including the OS version ensures that caches are not shared between different OS versions,
|
||||
preventing binary incompatibility issues when runner images change.
|
||||
|
||||
The computed cache key is available as the `cache-key` output:
|
||||
|
||||
```yaml
|
||||
- name: Setup uv
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Print cache key
|
||||
run: echo "Cache key: ${{ steps.setup-uv.outputs.cache-key }}"
|
||||
```
|
||||
|
||||
## Enable caching
|
||||
|
||||
> [!NOTE]
|
||||
|
||||
8
src/cache/restore-cache.ts
vendored
8
src/cache/restore-cache.ts
vendored
@@ -13,15 +13,16 @@ import {
|
||||
restoreCache as shouldRestoreCache,
|
||||
workingDirectory,
|
||||
} from "../utils/inputs";
|
||||
import { getArch, getPlatform } from "../utils/platforms";
|
||||
import { getArch, getOSNameVersion, getPlatform } from "../utils/platforms";
|
||||
|
||||
export const STATE_CACHE_KEY = "cache-key";
|
||||
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
const CACHE_VERSION = "1";
|
||||
const CACHE_VERSION = "2";
|
||||
|
||||
export async function restoreCache(): Promise<void> {
|
||||
const cacheKey = await computeKeys();
|
||||
core.saveState(STATE_CACHE_KEY, cacheKey);
|
||||
core.setOutput("cache-key", cacheKey);
|
||||
|
||||
if (!shouldRestoreCache) {
|
||||
core.info("restore-cache is false. Skipping restore cache step.");
|
||||
@@ -72,9 +73,10 @@ async function computeKeys(): Promise<string> {
|
||||
const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
|
||||
const pythonVersion = await getPythonVersion();
|
||||
const platform = await getPlatform();
|
||||
const osNameVersion = getOSNameVersion();
|
||||
const pruned = pruneCache ? "-pruned" : "";
|
||||
const python = cachePython ? "-py" : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform}-${osNameVersion}-${pythonVersion}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
|
||||
async function getPythonVersion(): Promise<string> {
|
||||
|
||||
@@ -1,5 +1,41 @@
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
||||
"aarch64-apple-darwin-0.9.17":
|
||||
"a1e1464aa1d04d5e5fa700aa2f2e10397d1114e835dbd56be25ba65c9a31bd99",
|
||||
"aarch64-pc-windows-msvc-0.9.17":
|
||||
"28423a27ad1d82347c00411a6792567119b3c1cfe775d3312c0e08a6b489be5b",
|
||||
"aarch64-unknown-linux-gnu-0.9.17":
|
||||
"e9eba97b7169e47fd3c926e409f0b714820f0befc23b3ae062780586a793e4cc",
|
||||
"aarch64-unknown-linux-musl-0.9.17":
|
||||
"f6f48a301f8e855765af42ef50257af0cebc9c5439dfdcbc188142941aea45ca",
|
||||
"arm-unknown-linux-musleabihf-0.9.17":
|
||||
"4d80f3509b6351882a64c1dd08f72a80e2b27f055a996295ef1f935bc3efcdde",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.17":
|
||||
"30a6c041429e2176062573f33c5c44307cb756264224bcb005723a6e18cff34c",
|
||||
"armv7-unknown-linux-musleabihf-0.9.17":
|
||||
"6b034dc63735c2a4541430cbece688e28bce51a09e2ad1ea2c1646a6b24cf1c3",
|
||||
"i686-pc-windows-msvc-0.9.17":
|
||||
"6e93737710e31bf73fcc3b4b6da616bd341e9c6baf1162ddc1e7f65884063f50",
|
||||
"i686-unknown-linux-gnu-0.9.17":
|
||||
"d2426a6d10bedd83524599bb0fbe0ba22e681ed45e892b4fd29086b424daf02a",
|
||||
"i686-unknown-linux-musl-0.9.17":
|
||||
"988c7702a2e88092b30f16fb7f8c18284a8062044cf57e6abd1dfeae82aa6377",
|
||||
"powerpc64-unknown-linux-gnu-0.9.17":
|
||||
"5ad301d9fa15e0791ef96abd83f0ed97e7ac1191b4b7578caaad3151633fb17c",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.17":
|
||||
"4958185c5febf22f1c4c84944334cb0d9262c2c2c93faf30c1e0abd26f9d94fa",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.17":
|
||||
"feed7cc7b5fc8a99e683ee1761cf99e3da12b60a2a413b7b87a0447726a66369",
|
||||
"s390x-unknown-linux-gnu-0.9.17":
|
||||
"a297518913a0f0e4af1bce434440ca9d415728aaf828c7def0e913aa5c46da8f",
|
||||
"x86_64-apple-darwin-0.9.17":
|
||||
"249e7fb18d45c06ba283c48f0a8e586ecc5fbb9e8dad0923c4169a7c4db815b2",
|
||||
"x86_64-pc-windows-msvc-0.9.17":
|
||||
"ebc76197bf3e1a58f9dac6f70f49b0ebd3e6907ab35289ce228bce5ba8a3f201",
|
||||
"x86_64-unknown-linux-gnu-0.9.17":
|
||||
"0114d54f9aafd07516cf1cadfe72afa970f5fd293fbe82dd924b8a7b42c984d8",
|
||||
"x86_64-unknown-linux-musl-0.9.17":
|
||||
"ab616c1851e7b1ed377a9ff3997dcee184bea7eda0b20bc8607abba6c469cbad",
|
||||
"aarch64-apple-darwin-0.9.16":
|
||||
"db6d7fb299c35dc9bbbeb89cfa9aa55a9584f637d370c0a4c62a50df9c9294a7",
|
||||
"aarch64-pc-windows-msvc-0.9.16":
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import * as core from "@actions/core";
|
||||
import * as exec from "@actions/exec";
|
||||
export type Platform =
|
||||
@@ -74,3 +76,71 @@ async function isMuslOs(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns OS name and version for cache key differentiation.
|
||||
* Examples: "ubuntu-22.04", "macos-14", "windows-2022"
|
||||
* Throws if OS detection fails.
|
||||
*/
|
||||
export function getOSNameVersion(): string {
|
||||
const platform = process.platform;
|
||||
|
||||
if (platform === "linux") {
|
||||
return getLinuxOSNameVersion();
|
||||
}
|
||||
if (platform === "darwin") {
|
||||
return getMacOSNameVersion();
|
||||
}
|
||||
if (platform === "win32") {
|
||||
return getWindowsNameVersion();
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
|
||||
function getLinuxOSNameVersion(): string {
|
||||
const files = ["/etc/os-release", "/usr/lib/os-release"];
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
const content = fs.readFileSync(file, "utf8");
|
||||
const id = parseOsReleaseValue(content, "ID");
|
||||
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
||||
|
||||
if (id && versionId) {
|
||||
return `${id}-${versionId}`;
|
||||
}
|
||||
} catch {
|
||||
// Try next file
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Failed to determine Linux distribution. " +
|
||||
"Could not read /etc/os-release or /usr/lib/os-release",
|
||||
);
|
||||
}
|
||||
|
||||
function parseOsReleaseValue(content: string, key: string): string | undefined {
|
||||
const regex = new RegExp(`^${key}=["']?([^"'\\n]*)["']?$`, "m");
|
||||
const match = content.match(regex);
|
||||
return match?.[1];
|
||||
}
|
||||
|
||||
function getMacOSNameVersion(): string {
|
||||
const darwinVersion = Number.parseInt(os.release().split(".")[0], 10);
|
||||
if (Number.isNaN(darwinVersion)) {
|
||||
throw new Error(`Failed to parse macOS version from: ${os.release()}`);
|
||||
}
|
||||
const macosVersion = darwinVersion - 9;
|
||||
return `macos-${macosVersion}`;
|
||||
}
|
||||
|
||||
function getWindowsNameVersion(): string {
|
||||
const version = os.version();
|
||||
const match = version.match(/Windows(?: Server)? (\d+)/);
|
||||
if (!match) {
|
||||
throw new Error(`Failed to parse Windows version from: ${version}`);
|
||||
}
|
||||
return `windows-${match[1]}`;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,130 @@
|
||||
[
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-aarch64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-aarch64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "arm",
|
||||
"artifactName": "uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"platform": "unknown-linux-gnueabihf",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-i686-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-i686-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64",
|
||||
"artifactName": "uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64le",
|
||||
"artifactName": "uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "riscv64gc",
|
||||
"artifactName": "uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "s390x",
|
||||
"artifactName": "uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-x86_64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-x86_64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.17/uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.17"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-apple-darwin.tar.gz",
|
||||
|
||||
Reference in New Issue
Block a user