mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-04-07 07:58:48 -04:00
Add uv-cache-hit and test CI
This commit is contained in:
parent
e85263fd93
commit
50d654e3c5
4 changed files with 26 additions and 7 deletions
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
@ -35,6 +35,25 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
- run: uv sync
|
- run: uv sync
|
||||||
working-directory: __tests__/fixtures/uv-project
|
working-directory: __tests__/fixtures/uv-project
|
||||||
|
test-default-version-cache: # https://github.com/astral-sh/setup-uv/issues/171
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, macos-14]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install latest version
|
||||||
|
uses: ./
|
||||||
|
- name: Verify cache hit
|
||||||
|
id: re-setup-uv
|
||||||
|
uses: ./
|
||||||
|
- name: Verify uv cache hit
|
||||||
|
run: |
|
||||||
|
if [ "$UV_CACHE_HIT" != "true" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
UV_CACHE_HIT: ${{ steps.re-setup-uv.outputs.uv-cache-hit }}
|
||||||
test-specific-version:
|
test-specific-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -105,13 +124,7 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
|
||||||
[
|
|
||||||
ubuntu-latest,
|
|
||||||
macos-latest,
|
|
||||||
macos-14,
|
|
||||||
windows-latest,
|
|
||||||
]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install default version
|
- name: Install default version
|
||||||
|
|
|
@ -47,6 +47,8 @@ inputs:
|
||||||
outputs:
|
outputs:
|
||||||
uv-version:
|
uv-version:
|
||||||
description: "The installed uv version. Useful when using latest."
|
description: "The installed uv version. Useful when using latest."
|
||||||
|
uv-cache-hit:
|
||||||
|
description: "A boolean value to indicate a cache entry for uv was found"
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: "A boolean value to indicate a cache entry was found"
|
description: "A boolean value to indicate a cache entry was found"
|
||||||
runs:
|
runs:
|
||||||
|
|
2
dist/setup/index.js
generated
vendored
2
dist/setup/index.js
generated
vendored
|
@ -90010,8 +90010,10 @@ function setupUv(platform, arch, versionInput, checkSum, githubToken) {
|
||||||
const toolCacheResult = (0, download_version_1.tryGetFromToolCache)(arch, resolvedVersion);
|
const toolCacheResult = (0, download_version_1.tryGetFromToolCache)(arch, resolvedVersion);
|
||||||
if (toolCacheResult.installedPath) {
|
if (toolCacheResult.installedPath) {
|
||||||
core.info(`Found uv in tool-cache for ${resolvedVersion}`);
|
core.info(`Found uv in tool-cache for ${resolvedVersion}`);
|
||||||
|
core.setOutput("uv-cache-hit", true);
|
||||||
return { uvDir: toolCacheResult.installedPath, version: resolvedVersion };
|
return { uvDir: toolCacheResult.installedPath, version: resolvedVersion };
|
||||||
}
|
}
|
||||||
|
core.setOutput("uv-cache-hit", false);
|
||||||
const versionResult = yield (0, download_version_1.downloadVersion)(platform, arch, resolvedVersion, checkSum, githubToken);
|
const versionResult = yield (0, download_version_1.downloadVersion)(platform, arch, resolvedVersion, checkSum, githubToken);
|
||||||
return { uvDir: versionResult.cachedToolDir, version: versionResult.version };
|
return { uvDir: versionResult.cachedToolDir, version: versionResult.version };
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,8 +80,10 @@ async function setupUv(
|
||||||
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
|
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
|
||||||
if (toolCacheResult.installedPath) {
|
if (toolCacheResult.installedPath) {
|
||||||
core.info(`Found uv in tool-cache for ${resolvedVersion}`);
|
core.info(`Found uv in tool-cache for ${resolvedVersion}`);
|
||||||
|
core.setOutput("uv-cache-hit", true);
|
||||||
return { uvDir: toolCacheResult.installedPath, version: resolvedVersion };
|
return { uvDir: toolCacheResult.installedPath, version: resolvedVersion };
|
||||||
}
|
}
|
||||||
|
core.setOutput("uv-cache-hit", false);
|
||||||
|
|
||||||
const versionResult = await downloadVersion(
|
const versionResult = await downloadVersion(
|
||||||
platform,
|
platform,
|
||||||
|
|
Loading…
Add table
Reference in a new issue