mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-11-05 01:35:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3050ded628 |
@@ -59,7 +59,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
|
||||
uses: github/codeql-action/autobuild@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: 🚀 Run Release Drafter
|
||||
uses: release-drafter/release-drafter@72967cdc98ddd3160f1fc3dff619de365e137dd0 # v7.9.0
|
||||
uses: release-drafter/release-drafter@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
|
||||
with:
|
||||
commitish: ${{ github.sha }}
|
||||
env:
|
||||
|
||||
+16
-41
@@ -53,8 +53,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
@@ -283,8 +281,6 @@ jobs:
|
||||
- os: macos-latest
|
||||
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
@@ -322,8 +318,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- name: Install default version
|
||||
uses: $/
|
||||
- run: uv tool install ruff==0.14.10
|
||||
@@ -335,8 +329,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
@@ -374,8 +366,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- name: Install latest version
|
||||
id: setup-uv
|
||||
uses: $/
|
||||
@@ -412,8 +402,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- name: Install latest version
|
||||
id: setup-uv
|
||||
uses: $/
|
||||
@@ -563,8 +551,6 @@ jobs:
|
||||
- os: windows-2025
|
||||
expected-os: "windows-2025"
|
||||
steps:
|
||||
- if: runner.os == 'macOS'
|
||||
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||
- name: Setup uv
|
||||
id: setup-uv
|
||||
uses: $/
|
||||
@@ -999,18 +985,14 @@ jobs:
|
||||
run: rm -rf "$UV_PYTHON_INSTALL_DIR"
|
||||
|
||||
test-cache-python-installs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-2022]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify Python install dir is not populated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -e "$RUNNER_TEMP/uv-python-dir" ]; then
|
||||
if [ -d /home/runner/work/_temp/uv-python-dir ]; then
|
||||
echo "Python install dir should not exist"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1023,26 +1005,21 @@ jobs:
|
||||
- run: uv sync --managed-python
|
||||
working-directory: __tests__/fixtures/uv-project
|
||||
- name: Verify Python install dir exists
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -d "$UV_PYTHON_INSTALL_DIR" ]; then
|
||||
if [ ! -d /home/runner/work/_temp/uv-python-dir ]; then
|
||||
echo "Python install dir should exist"
|
||||
exit 1
|
||||
fi
|
||||
test-restore-python-installs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-cache-python-installs
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-2022]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify Python install dir does not exist
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -e "$RUNNER_TEMP/uv-python-dir" ]; then
|
||||
if [ -d /home/runner/work/_temp/uv-python-dir ]; then
|
||||
echo "Python install dir should not exist"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1053,21 +1030,19 @@ jobs:
|
||||
enable-cache: true
|
||||
cache-python: true
|
||||
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-cache-python-installs
|
||||
- name: Verify the restored Python minor-version link resolves to the patch directory
|
||||
shell: python
|
||||
- name: Verify Python install dir exists
|
||||
run: |
|
||||
if [ ! -d /home/runner/work/_temp/uv-python-dir ]; then
|
||||
echo "Python install dir should exist"
|
||||
exit 1
|
||||
fi
|
||||
- name: Cache was hit
|
||||
run: |
|
||||
if [ "$CACHE_HIT" != "true" ]; then
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CACHE_HIT: ${{ steps.restore.outputs.python-cache-hit }}
|
||||
run: |
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
assert os.environ["CACHE_HIT"] == "true", "expected a Python cache hit"
|
||||
installs = Path(os.environ["UV_PYTHON_INSTALL_DIR"]).resolve()
|
||||
assert installs.is_dir(), "Python install dir should exist"
|
||||
patch_dir, = installs.glob("cpython-*.*.*-*")
|
||||
minor_prefix = patch_dir.name.rsplit(".", 1)[0]
|
||||
alias, = installs.glob(f"{minor_prefix}-*")
|
||||
assert alias.resolve(strict=True) == patch_dir, alias
|
||||
- run: uv sync --managed-python
|
||||
working-directory: __tests__/fixtures/uv-project
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
```
|
||||
|
||||
If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
|
||||
@@ -43,7 +43,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
|
||||
```yaml
|
||||
- name: Install uv with all available options
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
# The version of uv to install, e.g., "0.5.0", "latest", or "latest-known" (default: searches for version in config files, then latest)
|
||||
version: ""
|
||||
@@ -143,7 +143,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
- `venv`: Path to the activated venv if activate-environment is true.
|
||||
- `python-version`: The Python version that was set.
|
||||
- `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime. Empty when `activate-environment` is false.
|
||||
- `python-cache-hit`: A boolean indicating whether the Python cache was restored successfully.
|
||||
- `python-cache-hit`: A boolean value to indicate the Python cache entry was found.
|
||||
|
||||
### Python version
|
||||
|
||||
@@ -161,7 +161,7 @@ python 3.13
|
||||
```
|
||||
|
||||
```yaml
|
||||
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version-file: ".tool-versions"
|
||||
```
|
||||
@@ -172,7 +172,7 @@ a warning.
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv and set the python version to 3.13t
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
python-version: 3.13t
|
||||
- run: uv pip install --python=3.13t pip
|
||||
@@ -190,7 +190,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install the latest version of uv and set the python version
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Test with python ${{ matrix.python-version }}
|
||||
@@ -226,7 +226,7 @@ It also controls where [the venv gets created](#activate-environment), unless `v
|
||||
|
||||
```yaml
|
||||
- name: Install uv based on the config files in the working-directory
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
working-directory: my/subproject/dir
|
||||
```
|
||||
@@ -268,7 +268,7 @@ For example:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@main
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Test
|
||||
@@ -280,7 +280,7 @@ To install a specific version of Python, use
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Install Python 3.12
|
||||
@@ -299,7 +299,7 @@ output:
|
||||
uses: actions/checkout@main
|
||||
- name: Install the default version of uv
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
- name: Print the installed version
|
||||
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
||||
```
|
||||
|
||||
-37
@@ -1,4 +1,3 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import { createSetupInputs } from "../helpers/setup-inputs";
|
||||
|
||||
@@ -49,42 +48,6 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("restoreCache", () => {
|
||||
it.each([
|
||||
["win32", false],
|
||||
["linux", true],
|
||||
] as const)(
|
||||
"keeps the matched Python cache key on %s when the install directory cannot be read",
|
||||
async (platform, pythonCacheHit) => {
|
||||
const inputs = createSetupInputs({
|
||||
cachePython: true,
|
||||
// A file at the install directory path makes readdir fail.
|
||||
pythonDir: fileURLToPath(import.meta.url),
|
||||
restoreCache: true,
|
||||
});
|
||||
mockRestoreCache
|
||||
.mockReturnValueOnce("uv-key")
|
||||
.mockReturnValueOnce("python-key");
|
||||
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, "platform", { value: platform });
|
||||
try {
|
||||
await restoreCache(inputs);
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", { value: originalPlatform });
|
||||
}
|
||||
|
||||
expect(mockSetOutput).toHaveBeenCalledWith("cache-hit", true);
|
||||
expect(mockSetOutput).toHaveBeenCalledWith(
|
||||
"python-cache-hit",
|
||||
pythonCacheHit,
|
||||
);
|
||||
expect(mockSaveState).toHaveBeenCalledWith(
|
||||
"python-cache-matched-key",
|
||||
"python-key",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it("encodes Python version ranges before adding them to the cache key", async () => {
|
||||
await restoreCache(createSetupInputs(), ">3.10.11,<3.11");
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ describe("download-version", () => {
|
||||
"token",
|
||||
),
|
||||
).rejects.toThrow(
|
||||
"Could not find artifact for version 0.9.26, arch x86_64, platform unknown-linux-gnu in https://releases.astral.sh/github/versions/main/v1/uv.ndjson .",
|
||||
"Could not find artifact for version 0.9.26, arch x86_64, platform unknown-linux-gnu in https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson .",
|
||||
);
|
||||
|
||||
expect(mockDownloadTool).not.toHaveBeenCalled();
|
||||
|
||||
@@ -96,78 +96,6 @@ describe("manifest", () => {
|
||||
expect(versions).toHaveLength(2);
|
||||
expect(versions[0]?.version).toBe("0.9.26");
|
||||
expect(versions[1]?.version).toBe("0.9.25");
|
||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
||||
]);
|
||||
});
|
||||
|
||||
it("falls back to GitHub after mirror network retries are exhausted", async () => {
|
||||
jest.useFakeTimers();
|
||||
mockFetch
|
||||
.mockRejectedValueOnce(new Error("mirror unavailable"))
|
||||
.mockRejectedValueOnce(new Error("mirror unavailable"))
|
||||
.mockRejectedValueOnce(new Error("mirror unavailable"))
|
||||
.mockResolvedValueOnce(
|
||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||
);
|
||||
|
||||
const result = fetchManifest();
|
||||
await jest.runAllTimersAsync();
|
||||
|
||||
await expect(result).resolves.toEqual([
|
||||
expect.objectContaining({ version: "0.9.26" }),
|
||||
expect.objectContaining({ version: "0.9.25" }),
|
||||
]);
|
||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
||||
]);
|
||||
|
||||
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||
expect(mockFetch).toHaveBeenCalledTimes(4);
|
||||
});
|
||||
|
||||
it.each([404, 429, 503])(
|
||||
"falls back to a streaming GitHub manifest on mirror HTTP %s",
|
||||
async (status) => {
|
||||
mockFetch
|
||||
.mockResolvedValueOnce(createMockResponse(false, status, "Error", ""))
|
||||
.mockResolvedValueOnce(
|
||||
createStreamingMockResponse([`${sampleManifestResponse}\n`]),
|
||||
);
|
||||
|
||||
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||
await expect(
|
||||
getArtifact("0.9.26", "aarch64", "apple-darwin"),
|
||||
).resolves.toEqual({
|
||||
archiveFormat: "tar.gz",
|
||||
checksum:
|
||||
"fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f",
|
||||
downloadUrl:
|
||||
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-apple-darwin.tar.gz",
|
||||
});
|
||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it("does not fall back from a custom manifest", async () => {
|
||||
mockFetch.mockResolvedValue(
|
||||
createMockResponse(false, 503, "Service Unavailable", ""),
|
||||
);
|
||||
|
||||
await expect(
|
||||
fetchManifest("https://example.com/custom.ndjson"),
|
||||
).rejects.toThrow(
|
||||
"Failed to fetch manifest data: 503 Service Unavailable",
|
||||
);
|
||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
||||
"https://example.com/custom.ndjson",
|
||||
]);
|
||||
});
|
||||
|
||||
it("retries network failures", async () => {
|
||||
@@ -195,7 +123,7 @@ describe("manifest", () => {
|
||||
await jest.runAllTimersAsync();
|
||||
|
||||
await result;
|
||||
expect(mockFetch).toHaveBeenCalledTimes(MANIFEST_FETCH_ATTEMPTS * 2);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(MANIFEST_FETCH_ATTEMPTS);
|
||||
});
|
||||
|
||||
it("throws on a failed fetch", async () => {
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ outputs:
|
||||
python-runtime-id:
|
||||
description: "An opaque identifier reported by uv for the activated venv's Python runtime. Empty when activate-environment is false."
|
||||
python-cache-hit:
|
||||
description: "A boolean indicating whether the Python cache was restored successfully."
|
||||
description: "A boolean value to indicate the Python cache entry was found"
|
||||
runs:
|
||||
using: "node24"
|
||||
main: "dist/setup/index.cjs"
|
||||
|
||||
+30
-128
@@ -93966,53 +93966,6 @@ function getWindowsNameVersion() {
|
||||
return `windows-${match4[1]}`;
|
||||
}
|
||||
|
||||
// src/cache/repair-python-junctions.ts
|
||||
var import_promises = require("node:fs/promises");
|
||||
var import_node_path = __toESM(require("node:path"), 1);
|
||||
async function repairPythonJunctions(pythonDir) {
|
||||
const entries = await (0, import_promises.readdir)(pythonDir, { withFileTypes: true });
|
||||
const directories = new Set(
|
||||
entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name.toLowerCase())
|
||||
);
|
||||
for (const entry of entries) {
|
||||
const name = entry.name.toLowerCase();
|
||||
if (!entry.isSymbolicLink() || !/^cpython-\d+\.\d+[+-].+$/.test(name)) {
|
||||
continue;
|
||||
}
|
||||
const link = import_node_path.default.join(pythonDir, entry.name);
|
||||
let target;
|
||||
try {
|
||||
target = import_node_path.default.resolve(pythonDir, await (0, import_promises.readlink)(link));
|
||||
} catch (err) {
|
||||
if (await resolvesWithAccessDenied(link)) {
|
||||
throw err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const sibling = import_node_path.default.relative(pythonDir, target).toLowerCase();
|
||||
const version3 = /^(cpython-\d+\.\d+)\.\d+(?:(?:a|b|rc)\d+)?([+-].+)$/.exec(
|
||||
sibling
|
||||
);
|
||||
if (!version3 || version3[1] + version3[2] !== name || !directories.has(sibling)) {
|
||||
continue;
|
||||
}
|
||||
if (!await resolvesWithAccessDenied(link)) {
|
||||
continue;
|
||||
}
|
||||
await (0, import_promises.realpath)(target);
|
||||
await (0, import_promises.unlink)(link);
|
||||
await (0, import_promises.symlink)(target, link, "junction");
|
||||
}
|
||||
}
|
||||
async function resolvesWithAccessDenied(link) {
|
||||
try {
|
||||
await (0, import_promises.realpath)(link);
|
||||
return false;
|
||||
} catch (err) {
|
||||
return err.code === "EPERM";
|
||||
}
|
||||
}
|
||||
|
||||
// src/cache/restore-cache.ts
|
||||
var STATE_CACHE_KEY = "cache-key";
|
||||
var STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
@@ -94043,37 +93996,26 @@ async function restoreCache2(inputs, pythonVersion) {
|
||||
`${cacheKey}-python`,
|
||||
inputs.pythonDir,
|
||||
STATE_PYTHON_CACHE_MATCHED_KEY,
|
||||
"python-cache-hit",
|
||||
// TODO: Remove this repair once @actions/cache preserves Windows junctions.
|
||||
// https://github.com/actions/toolkit/issues/2562
|
||||
process.platform === "win32" ? repairPythonJunctions : void 0
|
||||
"python-cache-hit"
|
||||
);
|
||||
} else {
|
||||
setOutput("python-cache-hit", false);
|
||||
}
|
||||
}
|
||||
async function restoreCacheFromKey(cacheKey, cachePath, stateKey, outputKey, afterRestore) {
|
||||
async function restoreCacheFromKey(cacheKey, cachePath, stateKey, outputKey) {
|
||||
info2(
|
||||
`Trying to restore cache from GitHub Actions cache with key: ${cacheKey}`
|
||||
);
|
||||
let matchedKey;
|
||||
try {
|
||||
const matchedKey = await restoreCache([cachePath], cacheKey);
|
||||
if (!matchedKey) {
|
||||
info2(`No GitHub Actions cache found for key: ${cacheKey}`);
|
||||
setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
saveState(stateKey, matchedKey);
|
||||
await afterRestore?.(cachePath);
|
||||
info2(
|
||||
`cache restored from GitHub Actions cache with key: ${matchedKey}`
|
||||
);
|
||||
setOutput(outputKey, true);
|
||||
matchedKey = await restoreCache([cachePath], cacheKey);
|
||||
} catch (err) {
|
||||
const message = err.message;
|
||||
warning2(message);
|
||||
setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
handleMatchResult(matchedKey, cacheKey, stateKey, outputKey);
|
||||
}
|
||||
async function computeKeys(inputs, pythonVersion) {
|
||||
let cacheDependencyPathHash = "-";
|
||||
@@ -94103,6 +94045,16 @@ async function computeKeys(inputs, pythonVersion) {
|
||||
const python = inputs.cachePython ? "-py" : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform2}-${osNameVersion}-${version3}${pythonArchKey}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
function handleMatchResult(matchedKey, primaryKey, stateKey, outputKey) {
|
||||
if (!matchedKey) {
|
||||
info2(`No GitHub Actions cache found for key: ${primaryKey}`);
|
||||
setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
saveState(stateKey, matchedKey);
|
||||
info2(`cache restored from GitHub Actions cache with key: ${matchedKey}`);
|
||||
setOutput(outputKey, true);
|
||||
}
|
||||
|
||||
// src/download/download-version.ts
|
||||
var import_node_fs7 = require("node:fs");
|
||||
@@ -94547,8 +94499,7 @@ function _getGlobal(key, defaultValue) {
|
||||
var TOOL_CACHE_NAME = "uv";
|
||||
var STATE_UV_PATH = "uv-path";
|
||||
var STATE_UV_VERSION = "uv-version";
|
||||
var VERSIONS_MANIFEST_URL = "https://releases.astral.sh/github/versions/main/v1/uv.ndjson";
|
||||
var GITHUB_VERSIONS_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
||||
var VERSIONS_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
||||
var GITHUB_RELEASES_PREFIX = "https://github.com/astral-sh/uv/releases/download/";
|
||||
var ASTRAL_MIRROR_PREFIX = "https://releases.astral.sh/github/uv/releases/download/";
|
||||
|
||||
@@ -94558,42 +94509,6 @@ var fs10 = __toESM(require("node:fs"), 1);
|
||||
|
||||
// src/download/checksum/known-checksums.json
|
||||
var known_checksums_default = {
|
||||
"aarch64-apple-darwin-0.13.7": "81b811b57e4624df7ed3aac148e0359100d9962f3d9dce00aec533dc2e086731",
|
||||
"aarch64-pc-windows-msvc-0.13.7": "505d9e65e7692bac3ddf98c66754aa26c5050c409c184af30a881a0a72cc85e3",
|
||||
"aarch64-unknown-linux-gnu-0.13.7": "71279f8d3c67241e807b9d8db872d1bf541579fb9f08b7d1eb1682196d1e57dc",
|
||||
"aarch64-unknown-linux-musl-0.13.7": "2d3ec076a0c4c0e8250bb6418c44080828b544f1a3be0b6e46adf9fb6923de45",
|
||||
"arm-unknown-linux-musleabihf-0.13.7": "2c029d1eda470c667e46a36fc5e2479c9a3e4af91e0cabcde07711bf40d587a9",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.7": "5e2a1315a1b8b4a25250d536f62fa5c1ab5ed17233e7bf486c3c7849cb663284",
|
||||
"armv7-unknown-linux-musleabihf-0.13.7": "4a1a7dc0b1713bbeac665a2f95e680eea3bb7ecebea226ae3b2de552bc72e88b",
|
||||
"i686-pc-windows-msvc-0.13.7": "fa2abbf16f7d12cb01c9b7f313d843218fbd91a9d3fab487cc06a1d6765b27bf",
|
||||
"i686-unknown-linux-gnu-0.13.7": "cc4f86390f9c99e8f53530e5e7f2cdc6ae7c011c9e805764332a3e3c01a378e4",
|
||||
"i686-unknown-linux-musl-0.13.7": "c2d50f5c64eb81fd1fd1ec5870403c0533fe4b6bf76f940cc5e97824e49ab782",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.7": "e8b65412482f848743e73566808f5bb480e826c9ce25361997891fcf71299080",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.7": "48aff38af87c7c8255beb9b51b3676598045786ac5197de15fea54ebfe6c72e1",
|
||||
"riscv64gc-unknown-linux-musl-0.13.7": "6c2e67417dda9661e67c2591a6226805ef2ed8ebc203baeed411f67d459207b2",
|
||||
"s390x-unknown-linux-gnu-0.13.7": "2b64a479b905b9cdab99c71105e523a0d7aa79581cbd716d40bce26d7b595428",
|
||||
"x86_64-apple-darwin-0.13.7": "20c47e4c1f630b8abaff8c291fa9b9aa300fef92c4fbff95adf198b55287cda7",
|
||||
"x86_64-pc-windows-msvc-0.13.7": "0cdc5b38fe5a8168ed6a25814f5ba43c21d313dd3187314fccb37b7cec46e021",
|
||||
"x86_64-unknown-linux-gnu-0.13.7": "c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83",
|
||||
"x86_64-unknown-linux-musl-0.13.7": "287491da03f2a785c70fa75b13e1f849918c2f2b5415fe84876b8214eeb792f9",
|
||||
"aarch64-apple-darwin-0.13.6": "60fbd5c8a1ed681845eea28d9d622fcde03c51e91a43465b64a1e17db1ed3472",
|
||||
"aarch64-pc-windows-msvc-0.13.6": "c2426c0c8e28b53d8c440e47a18d96ad4db51e159866c0e81435b196d7f0081c",
|
||||
"aarch64-unknown-linux-gnu-0.13.6": "229e194255c7958d86d56e8790d969a6f74736592133f0dfd0076f754c642c1d",
|
||||
"aarch64-unknown-linux-musl-0.13.6": "819692e404d23e5aae6bc44c0e260f1f5492fd1910ab4693b2c650f926dbe800",
|
||||
"arm-unknown-linux-musleabihf-0.13.6": "57ac0f7c04deb42c5d686b4eeeef555c442db6ffea16fe4cbd7adb0384403794",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.6": "d00cd4949c4524c934afcfee1aedfa9d337cf4e43be4d6b692ad8d74d0a65562",
|
||||
"armv7-unknown-linux-musleabihf-0.13.6": "b215398c886e8cc2cfa282fe346c02025957f8633b75a3d4fd848e0adda4eddd",
|
||||
"i686-pc-windows-msvc-0.13.6": "32ceb64db231cbedfd499f7654c72e4c0b564f2846f9e76c0a4a7b2d03d7e67c",
|
||||
"i686-unknown-linux-gnu-0.13.6": "665ea831c38d342900950e606beb2ccc37b7ba0fcefc37b814eb4b076305f2b6",
|
||||
"i686-unknown-linux-musl-0.13.6": "de3a015c4b0fce63c178ae4fa95c94c873adfd92fa1e258c6a2a94e529812629",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.6": "3b2847185ec2946fcc928500efef7e3e74c255d3be6f2cb435081a84885d8c6c",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.6": "517052603ed46483b59d8875c9c61a577946b8f493c73e4339e45e7b119171d0",
|
||||
"riscv64gc-unknown-linux-musl-0.13.6": "659a95dc6aee3ecf86742a08d8ca6c6261422121cbd41decc0042f5a71af6305",
|
||||
"s390x-unknown-linux-gnu-0.13.6": "fb56d731308aa5c7718059d71afcb14d9a933a974997cee3d4eb5d06fc462a4b",
|
||||
"x86_64-apple-darwin-0.13.6": "63ba17fdda55ad1a230d4b37fc6017ffa10c23688c83818bd3bfdf914c652a02",
|
||||
"x86_64-pc-windows-msvc-0.13.6": "a2a8820d5eea32f08ef467ef3b7f66883a9b076d5737a2fc2fbb5f458d1bb50f",
|
||||
"x86_64-unknown-linux-gnu-0.13.6": "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645",
|
||||
"x86_64-unknown-linux-musl-0.13.6": "5d61f26b6c7213779eda90edc6971ea6b0b796bfb8d49a574c8ad69b59838548",
|
||||
"aarch64-apple-darwin-0.13.5": "743f85035a1996ecb350659e01cd9faea9709829be09b1b4b03c73eaf3c9cd73",
|
||||
"aarch64-pc-windows-msvc-0.13.5": "09f47edf90726084a70f9426f6e3ca4f46e9bf7cbf23b1716ec64d60b055fae3",
|
||||
"aarch64-unknown-linux-gnu-0.13.5": "4bb69cf95ed13f23713bb7bc09f241896ea0c75b7c557e615a20604b82f9c403",
|
||||
@@ -100372,19 +100287,6 @@ async function getArtifact(version3, arch3, platform2, manifestUrl = VERSIONS_MA
|
||||
};
|
||||
}
|
||||
async function fetchManifestResponse(manifestUrl) {
|
||||
try {
|
||||
return await fetchManifestResponseFromUrl(manifestUrl);
|
||||
} catch (error2) {
|
||||
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
|
||||
throw error2;
|
||||
}
|
||||
info2(
|
||||
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${error2.message}`
|
||||
);
|
||||
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
|
||||
}
|
||||
}
|
||||
async function fetchManifestResponseFromUrl(manifestUrl) {
|
||||
let response;
|
||||
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
|
||||
info2(`Fetching manifest data from ${manifestUrl} ...`);
|
||||
@@ -102212,7 +102114,7 @@ function getExtension(platform2) {
|
||||
|
||||
// src/utils/inputs.ts
|
||||
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
||||
var import_node_path2 = __toESM(require("node:path"), 1);
|
||||
var import_node_path = __toESM(require("node:path"), 1);
|
||||
function loadInputs() {
|
||||
const workingDirectory = getInput("working-directory");
|
||||
const version3 = getInput("version");
|
||||
@@ -102358,7 +102260,7 @@ function getToolBinDir(workingDirectory) {
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
if (process.env.RUNNER_TEMP !== void 0) {
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path2.default.sep}uv-tool-bin-dir`;
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path.default.sep}uv-tool-bin-dir`;
|
||||
}
|
||||
throw Error(
|
||||
"Could not determine UV_TOOL_BIN_DIR. Please make sure RUNNER_TEMP is set or provide the tool-bin-dir input"
|
||||
@@ -102374,7 +102276,7 @@ function getToolDir(workingDirectory) {
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
if (process.env.RUNNER_TEMP !== void 0) {
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path2.default.sep}uv-tool-dir`;
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path.default.sep}uv-tool-dir`;
|
||||
}
|
||||
throw Error(
|
||||
"Could not determine UV_TOOL_DIR. Please make sure RUNNER_TEMP is set or provide the tool-dir input"
|
||||
@@ -102406,7 +102308,7 @@ function getCacheLocalPath(workingDirectory, versionFile, enableCache) {
|
||||
if (process.env.RUNNER_ENVIRONMENT === "github-hosted") {
|
||||
if (process.env.RUNNER_TEMP !== void 0) {
|
||||
return {
|
||||
path: `${process.env.RUNNER_TEMP}${import_node_path2.default.sep}setup-uv-cache`,
|
||||
path: `${process.env.RUNNER_TEMP}${import_node_path.default.sep}setup-uv-cache`,
|
||||
source: 3 /* Default */
|
||||
};
|
||||
}
|
||||
@@ -102416,12 +102318,12 @@ function getCacheLocalPath(workingDirectory, versionFile, enableCache) {
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
return {
|
||||
path: `${process.env.APPDATA}${import_node_path2.default.sep}uv${import_node_path2.default.sep}cache`,
|
||||
path: `${process.env.APPDATA}${import_node_path.default.sep}uv${import_node_path.default.sep}cache`,
|
||||
source: 3 /* Default */
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: `${process.env.HOME}${import_node_path2.default.sep}.cache${import_node_path2.default.sep}uv`,
|
||||
path: `${process.env.HOME}${import_node_path.default.sep}.cache${import_node_path.default.sep}uv`,
|
||||
source: 3 /* Default */
|
||||
};
|
||||
}
|
||||
@@ -102452,12 +102354,12 @@ function getUvPythonDir() {
|
||||
}
|
||||
if (process.env.RUNNER_ENVIRONMENT !== "github-hosted") {
|
||||
if (process.platform === "win32") {
|
||||
return `${process.env.APPDATA}${import_node_path2.default.sep}uv${import_node_path2.default.sep}python`;
|
||||
return `${process.env.APPDATA}${import_node_path.default.sep}uv${import_node_path.default.sep}python`;
|
||||
}
|
||||
return `${process.env.HOME}${import_node_path2.default.sep}.local${import_node_path2.default.sep}share${import_node_path2.default.sep}uv${import_node_path2.default.sep}python`;
|
||||
return `${process.env.HOME}${import_node_path.default.sep}.local${import_node_path.default.sep}share${import_node_path.default.sep}uv${import_node_path.default.sep}python`;
|
||||
}
|
||||
if (process.env.RUNNER_TEMP !== void 0) {
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path2.default.sep}uv-python-dir`;
|
||||
return `${process.env.RUNNER_TEMP}${import_node_path.default.sep}uv-python-dir`;
|
||||
}
|
||||
throw Error(
|
||||
"Could not determine UV_PYTHON_INSTALL_DIR. Please make sure RUNNER_TEMP is set or provide the UV_PYTHON_INSTALL_DIR environment variable"
|
||||
@@ -102477,10 +102379,10 @@ function expandTilde(input) {
|
||||
return input;
|
||||
}
|
||||
function normalizePath(inputPath) {
|
||||
const normalized = import_node_path2.default.normalize(inputPath);
|
||||
const root = import_node_path2.default.parse(normalized).root;
|
||||
const normalized = import_node_path.default.normalize(inputPath);
|
||||
const root = import_node_path.default.parse(normalized).root;
|
||||
let trimmed = normalized;
|
||||
while (trimmed.length > root.length && trimmed.endsWith(import_node_path2.default.sep)) {
|
||||
while (trimmed.length > root.length && trimmed.endsWith(import_node_path.default.sep)) {
|
||||
trimmed = trimmed.slice(0, -1);
|
||||
}
|
||||
return trimmed;
|
||||
@@ -102488,7 +102390,7 @@ function normalizePath(inputPath) {
|
||||
function resolveRelativePath(workingDirectory, inputPath) {
|
||||
const hasNegation = inputPath.startsWith("!");
|
||||
const pathWithoutNegation = hasNegation ? inputPath.substring(1) : inputPath;
|
||||
const resolvedPath = import_node_path2.default.resolve(workingDirectory, pathWithoutNegation);
|
||||
const resolvedPath = import_node_path.default.resolve(workingDirectory, pathWithoutNegation);
|
||||
debug(
|
||||
`Resolving relative path ${inputPath} to ${hasNegation ? "!" : ""}${resolvedPath}`
|
||||
);
|
||||
|
||||
+1
-51
@@ -47182,42 +47182,6 @@ var semver = __toESM(require_semver(), 1);
|
||||
|
||||
// src/download/checksum/known-checksums.json
|
||||
var known_checksums_default = {
|
||||
"aarch64-apple-darwin-0.13.7": "81b811b57e4624df7ed3aac148e0359100d9962f3d9dce00aec533dc2e086731",
|
||||
"aarch64-pc-windows-msvc-0.13.7": "505d9e65e7692bac3ddf98c66754aa26c5050c409c184af30a881a0a72cc85e3",
|
||||
"aarch64-unknown-linux-gnu-0.13.7": "71279f8d3c67241e807b9d8db872d1bf541579fb9f08b7d1eb1682196d1e57dc",
|
||||
"aarch64-unknown-linux-musl-0.13.7": "2d3ec076a0c4c0e8250bb6418c44080828b544f1a3be0b6e46adf9fb6923de45",
|
||||
"arm-unknown-linux-musleabihf-0.13.7": "2c029d1eda470c667e46a36fc5e2479c9a3e4af91e0cabcde07711bf40d587a9",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.7": "5e2a1315a1b8b4a25250d536f62fa5c1ab5ed17233e7bf486c3c7849cb663284",
|
||||
"armv7-unknown-linux-musleabihf-0.13.7": "4a1a7dc0b1713bbeac665a2f95e680eea3bb7ecebea226ae3b2de552bc72e88b",
|
||||
"i686-pc-windows-msvc-0.13.7": "fa2abbf16f7d12cb01c9b7f313d843218fbd91a9d3fab487cc06a1d6765b27bf",
|
||||
"i686-unknown-linux-gnu-0.13.7": "cc4f86390f9c99e8f53530e5e7f2cdc6ae7c011c9e805764332a3e3c01a378e4",
|
||||
"i686-unknown-linux-musl-0.13.7": "c2d50f5c64eb81fd1fd1ec5870403c0533fe4b6bf76f940cc5e97824e49ab782",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.7": "e8b65412482f848743e73566808f5bb480e826c9ce25361997891fcf71299080",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.7": "48aff38af87c7c8255beb9b51b3676598045786ac5197de15fea54ebfe6c72e1",
|
||||
"riscv64gc-unknown-linux-musl-0.13.7": "6c2e67417dda9661e67c2591a6226805ef2ed8ebc203baeed411f67d459207b2",
|
||||
"s390x-unknown-linux-gnu-0.13.7": "2b64a479b905b9cdab99c71105e523a0d7aa79581cbd716d40bce26d7b595428",
|
||||
"x86_64-apple-darwin-0.13.7": "20c47e4c1f630b8abaff8c291fa9b9aa300fef92c4fbff95adf198b55287cda7",
|
||||
"x86_64-pc-windows-msvc-0.13.7": "0cdc5b38fe5a8168ed6a25814f5ba43c21d313dd3187314fccb37b7cec46e021",
|
||||
"x86_64-unknown-linux-gnu-0.13.7": "c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83",
|
||||
"x86_64-unknown-linux-musl-0.13.7": "287491da03f2a785c70fa75b13e1f849918c2f2b5415fe84876b8214eeb792f9",
|
||||
"aarch64-apple-darwin-0.13.6": "60fbd5c8a1ed681845eea28d9d622fcde03c51e91a43465b64a1e17db1ed3472",
|
||||
"aarch64-pc-windows-msvc-0.13.6": "c2426c0c8e28b53d8c440e47a18d96ad4db51e159866c0e81435b196d7f0081c",
|
||||
"aarch64-unknown-linux-gnu-0.13.6": "229e194255c7958d86d56e8790d969a6f74736592133f0dfd0076f754c642c1d",
|
||||
"aarch64-unknown-linux-musl-0.13.6": "819692e404d23e5aae6bc44c0e260f1f5492fd1910ab4693b2c650f926dbe800",
|
||||
"arm-unknown-linux-musleabihf-0.13.6": "57ac0f7c04deb42c5d686b4eeeef555c442db6ffea16fe4cbd7adb0384403794",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.6": "d00cd4949c4524c934afcfee1aedfa9d337cf4e43be4d6b692ad8d74d0a65562",
|
||||
"armv7-unknown-linux-musleabihf-0.13.6": "b215398c886e8cc2cfa282fe346c02025957f8633b75a3d4fd848e0adda4eddd",
|
||||
"i686-pc-windows-msvc-0.13.6": "32ceb64db231cbedfd499f7654c72e4c0b564f2846f9e76c0a4a7b2d03d7e67c",
|
||||
"i686-unknown-linux-gnu-0.13.6": "665ea831c38d342900950e606beb2ccc37b7ba0fcefc37b814eb4b076305f2b6",
|
||||
"i686-unknown-linux-musl-0.13.6": "de3a015c4b0fce63c178ae4fa95c94c873adfd92fa1e258c6a2a94e529812629",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.6": "3b2847185ec2946fcc928500efef7e3e74c255d3be6f2cb435081a84885d8c6c",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.6": "517052603ed46483b59d8875c9c61a577946b8f493c73e4339e45e7b119171d0",
|
||||
"riscv64gc-unknown-linux-musl-0.13.6": "659a95dc6aee3ecf86742a08d8ca6c6261422121cbd41decc0042f5a71af6305",
|
||||
"s390x-unknown-linux-gnu-0.13.6": "fb56d731308aa5c7718059d71afcb14d9a933a974997cee3d4eb5d06fc462a4b",
|
||||
"x86_64-apple-darwin-0.13.6": "63ba17fdda55ad1a230d4b37fc6017ffa10c23688c83818bd3bfdf914c652a02",
|
||||
"x86_64-pc-windows-msvc-0.13.6": "a2a8820d5eea32f08ef467ef3b7f66883a9b076d5737a2fc2fbb5f458d1bb50f",
|
||||
"x86_64-unknown-linux-gnu-0.13.6": "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645",
|
||||
"x86_64-unknown-linux-musl-0.13.6": "5d61f26b6c7213779eda90edc6971ea6b0b796bfb8d49a574c8ad69b59838548",
|
||||
"aarch64-apple-darwin-0.13.5": "743f85035a1996ecb350659e01cd9faea9709829be09b1b4b03c73eaf3c9cd73",
|
||||
"aarch64-pc-windows-msvc-0.13.5": "09f47edf90726084a70f9426f6e3ca4f46e9bf7cbf23b1716ec64d60b055fae3",
|
||||
"aarch64-unknown-linux-gnu-0.13.5": "4bb69cf95ed13f23713bb7bc09f241896ea0c75b7c557e615a20604b82f9c403",
|
||||
@@ -52872,8 +52836,7 @@ var import_node_readline = require("node:readline");
|
||||
var import_node_stream = require("node:stream");
|
||||
|
||||
// src/utils/constants.ts
|
||||
var VERSIONS_MANIFEST_URL = "https://releases.astral.sh/github/versions/main/v1/uv.ndjson";
|
||||
var GITHUB_VERSIONS_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
||||
var VERSIONS_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
||||
|
||||
// src/utils/fetch.ts
|
||||
var import_undici2 = __toESM(require_undici2(), 1);
|
||||
@@ -52945,19 +52908,6 @@ async function getLatestVersion(manifestUrl = VERSIONS_MANIFEST_URL) {
|
||||
return latestVersion;
|
||||
}
|
||||
async function fetchManifestResponse(manifestUrl) {
|
||||
try {
|
||||
return await fetchManifestResponseFromUrl(manifestUrl);
|
||||
} catch (error2) {
|
||||
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
|
||||
throw error2;
|
||||
}
|
||||
info2(
|
||||
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${error2.message}`
|
||||
);
|
||||
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
|
||||
}
|
||||
}
|
||||
async function fetchManifestResponseFromUrl(manifestUrl) {
|
||||
let response;
|
||||
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
|
||||
info2(`Fetching manifest data from ${manifestUrl} ...`);
|
||||
|
||||
@@ -6,7 +6,7 @@ This document covers advanced options for configuring which version of uv to ins
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: "latest"
|
||||
```
|
||||
@@ -19,7 +19,7 @@ When `manifest-file` is set, `latest-known` still selects a version from setup-u
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv known to setup-uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: "latest-known"
|
||||
```
|
||||
@@ -28,7 +28,7 @@ When `manifest-file` is set, `latest-known` still selects a version from setup-u
|
||||
|
||||
```yaml
|
||||
- name: Install a specific version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: "0.4.4"
|
||||
```
|
||||
@@ -41,21 +41,21 @@ to install the latest version that satisfies the range.
|
||||
|
||||
```yaml
|
||||
- name: Install a semver range of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: ">=0.4.0"
|
||||
```
|
||||
|
||||
```yaml
|
||||
- name: Pinning a minor version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: "0.4.x"
|
||||
```
|
||||
|
||||
```yaml
|
||||
- name: Install a pep440-specifier-satisfying version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: ">=0.4.25,<0.5"
|
||||
```
|
||||
@@ -67,7 +67,7 @@ You can change this behavior using the `resolution-strategy` input:
|
||||
|
||||
```yaml
|
||||
- name: Install the lowest compatible version of uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: ">=0.4.0"
|
||||
resolution-strategy: "lowest"
|
||||
@@ -92,7 +92,7 @@ as `UV_PYTHON`. Only a single Python version is supported; multiple fallback ver
|
||||
|
||||
```yaml
|
||||
- name: Install uv based on the version defined in pyproject.toml
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version-file: "pyproject.toml"
|
||||
```
|
||||
@@ -103,7 +103,7 @@ silently picking up a newer uv until the lockfile is updated.
|
||||
|
||||
```yaml
|
||||
- name: Install uv based on the version locked in uv.lock
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version-file: "uv.lock"
|
||||
```
|
||||
|
||||
+12
-12
@@ -24,7 +24,7 @@ The computed cache key is available as the `cache-key` output:
|
||||
```yaml
|
||||
- name: Setup uv
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Print cache key
|
||||
@@ -54,7 +54,7 @@ You can optionally define a custom cache key suffix.
|
||||
```yaml
|
||||
- name: Enable caching and define a custom cache key suffix
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-suffix: "optional-suffix"
|
||||
@@ -93,7 +93,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define a cache dependency glob
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "**/pyproject.toml"
|
||||
@@ -101,7 +101,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define a list of cache dependency globs
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: |
|
||||
@@ -111,7 +111,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define an absolute cache dependency glob
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
|
||||
@@ -119,7 +119,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Never invalidate the cache
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: ""
|
||||
@@ -132,7 +132,7 @@ By default, the cache will be restored.
|
||||
|
||||
```yaml
|
||||
- name: Don't restore an existing cache
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
restore-cache: false
|
||||
@@ -148,7 +148,7 @@ these events. Set `save-cache: true` to save the cache for all events.
|
||||
|
||||
```yaml
|
||||
- name: Don't save the cache after the run
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
save-cache: false
|
||||
@@ -174,7 +174,7 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
|
||||
|
||||
```yaml
|
||||
- name: Define a custom uv cache path
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
cache-local-path: "/path/to/cache"
|
||||
```
|
||||
@@ -191,7 +191,7 @@ If you want to prune the cache before saving it, enable cache pruning with the `
|
||||
|
||||
```yaml
|
||||
- name: Prune the cache before saving it
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
prune-cache: true
|
||||
@@ -210,7 +210,7 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
|
||||
|
||||
```yaml
|
||||
- name: Cache Python installs
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-python: true
|
||||
@@ -228,7 +228,7 @@ If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
|
||||
|
||||
```yaml
|
||||
- name: Ignore nothing to cache
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
ignore-nothing-to-cache: true
|
||||
|
||||
@@ -11,7 +11,7 @@ You can specify a checksum to override those values. The sha256 hashes can also
|
||||
|
||||
```yaml
|
||||
- name: Install a specific version and validate the checksum
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
version: "0.3.1"
|
||||
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
||||
@@ -20,12 +20,10 @@ You can specify a checksum to override those values. The sha256 hashes can also
|
||||
## Manifest file
|
||||
|
||||
By default, setup-uv reads version metadata from
|
||||
the [Astral mirror](https://releases.astral.sh/github/versions/main/v1/uv.ndjson).
|
||||
If the mirror request fails, it falls back to [`astral-sh/versions`](https://github.com/astral-sh/versions).
|
||||
[`astral-sh/versions`](https://github.com/astral-sh/versions).
|
||||
|
||||
The `manifest-file` input lets you override that source with your own URL, for example to test
|
||||
custom uv builds or alternate download locations. Custom manifest URLs do not fall back to the
|
||||
default sources.
|
||||
custom uv builds or alternate download locations.
|
||||
|
||||
### Format
|
||||
|
||||
@@ -42,7 +40,7 @@ The `archive_format` field is currently ignored.
|
||||
|
||||
```yaml
|
||||
- name: Use a custom manifest file
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
manifest-file: "https://example.com/my-custom-manifest.ndjson"
|
||||
```
|
||||
@@ -61,7 +59,7 @@ You can disable this by setting the `add-problem-matchers` input to `false`.
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv without problem matchers
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
add-problem-matchers: false
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ This allows directly using it in later steps:
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv and activate the environment
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
activate-environment: true
|
||||
- run: uv pip install pip
|
||||
@@ -32,7 +32,7 @@ key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python
|
||||
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
|
||||
|
||||
```yaml
|
||||
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
activate-environment: true
|
||||
venv-path: ${{ runner.temp }}/custom-venv
|
||||
@@ -50,13 +50,12 @@ You can customize the venv location with `venv-path`, for example to place it in
|
||||
|
||||
## GitHub authentication token
|
||||
|
||||
By default, this action fetches version metadata and uv archives from the Astral mirror.
|
||||
If a manifest request fails, it falls back to `raw.githubusercontent.com`. If an archive download
|
||||
fails, it falls back to GitHub Releases.
|
||||
By default, this action resolves available uv versions from
|
||||
[`astral-sh/versions`](https://github.com/astral-sh/versions), then downloads uv artifacts from
|
||||
GitHub Releases.
|
||||
|
||||
You can provide a token via `github-token` to authenticate GitHub Releases downloads. The token
|
||||
is not sent to the Astral mirror or used for manifest requests. By default, the `GITHUB_TOKEN`
|
||||
secret is used, which is automatically provided by GitHub Actions.
|
||||
You can provide a token via `github-token` to authenticate those downloads. By default, the
|
||||
`GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions.
|
||||
|
||||
If the default
|
||||
[permissions for the GitHub token](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
|
||||
@@ -64,7 +63,7 @@ are not sufficient, you can provide a custom GitHub token with the necessary per
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom GitHub token
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
```
|
||||
@@ -82,7 +81,7 @@ input:
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom tool dir
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
tool-dir: "/path/to/tool/dir"
|
||||
```
|
||||
@@ -101,7 +100,7 @@ If you want to change this behaviour (especially on self-hosted runners) you can
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom tool bin dir
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
tool-bin-dir: "/path/to/tool-bin/dir"
|
||||
```
|
||||
@@ -118,7 +117,7 @@ This action supports expanding the `~` character to the user's home directory fo
|
||||
|
||||
```yaml
|
||||
- name: Expand the tilde character
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
cache-local-path: "~/path/to/cache"
|
||||
tool-dir: "~/path/to/tool/dir"
|
||||
@@ -135,7 +134,7 @@ If you want to ignore this, set the `ignore-empty-workdir` input to `true`.
|
||||
|
||||
```yaml
|
||||
- name: Ignore empty workdir
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
ignore-empty-workdir: true
|
||||
```
|
||||
@@ -161,7 +160,7 @@ This action sets several environment variables that influence uv's behavior and
|
||||
|
||||
```yaml
|
||||
- name: Example using environment variables
|
||||
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
||||
with:
|
||||
python-version: "3.12"
|
||||
tool-dir: "/custom/tool/dir"
|
||||
|
||||
Vendored
-60
@@ -1,60 +0,0 @@
|
||||
import { readdir, readlink, realpath, symlink, unlink } from "node:fs/promises";
|
||||
import nodePath from "node:path";
|
||||
|
||||
export async function repairPythonJunctions(pythonDir: string): Promise<void> {
|
||||
const entries = await readdir(pythonDir, { withFileTypes: true });
|
||||
const directories = new Set(
|
||||
entries
|
||||
.filter((entry) => entry.isDirectory())
|
||||
.map((entry) => entry.name.toLowerCase()),
|
||||
);
|
||||
|
||||
for (const entry of entries) {
|
||||
const name = entry.name.toLowerCase();
|
||||
if (!entry.isSymbolicLink() || !/^cpython-\d+\.\d+[+-].+$/.test(name)) {
|
||||
continue;
|
||||
}
|
||||
const link = nodePath.join(pythonDir, entry.name);
|
||||
let target: string;
|
||||
try {
|
||||
target = nodePath.resolve(pythonDir, await readlink(link));
|
||||
} catch (err) {
|
||||
// Fail only if the link still has the access error that requires repair.
|
||||
if (await resolvesWithAccessDenied(link)) {
|
||||
throw err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// uv omits only the patch and prerelease from its minor-version links.
|
||||
const sibling = nodePath.relative(pythonDir, target).toLowerCase();
|
||||
const version = /^(cpython-\d+\.\d+)\.\d+(?:(?:a|b|rc)\d+)?([+-].+)$/.exec(
|
||||
sibling,
|
||||
);
|
||||
if (
|
||||
!version ||
|
||||
version[1] + version[2] !== name ||
|
||||
!directories.has(sibling)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// Git for Windows tar can restore a junction as a file symlink when it
|
||||
// extracts the link before its target. Opening it as a directory fails.
|
||||
if (!(await resolvesWithAccessDenied(link))) {
|
||||
continue;
|
||||
}
|
||||
// An inaccessible installation can also cause EPERM through a valid link.
|
||||
await realpath(target);
|
||||
await unlink(link);
|
||||
await symlink(target, link, "junction");
|
||||
}
|
||||
}
|
||||
|
||||
async function resolvesWithAccessDenied(link: string): Promise<boolean> {
|
||||
try {
|
||||
await realpath(link);
|
||||
return false;
|
||||
} catch (err) {
|
||||
return (err as NodeJS.ErrnoException).code === "EPERM";
|
||||
}
|
||||
}
|
||||
Vendored
+22
-21
@@ -4,7 +4,6 @@ import { hashFiles } from "../hash/hash-files";
|
||||
import type { SetupInputs } from "../utils/inputs";
|
||||
import * as log from "../utils/logging";
|
||||
import { getArch, getOSNameVersion, getPlatform } from "../utils/platforms";
|
||||
import { repairPythonJunctions } from "./repair-python-junctions";
|
||||
|
||||
export const STATE_CACHE_KEY = "cache-key";
|
||||
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
@@ -45,9 +44,6 @@ export async function restoreCache(
|
||||
inputs.pythonDir,
|
||||
STATE_PYTHON_CACHE_MATCHED_KEY,
|
||||
"python-cache-hit",
|
||||
// TODO: Remove this repair once @actions/cache preserves Windows junctions.
|
||||
// https://github.com/actions/toolkit/issues/2562
|
||||
process.platform === "win32" ? repairPythonJunctions : undefined,
|
||||
);
|
||||
} else {
|
||||
core.setOutput("python-cache-hit", false);
|
||||
@@ -59,33 +55,21 @@ async function restoreCacheFromKey(
|
||||
cachePath: string,
|
||||
stateKey: string,
|
||||
outputKey: string,
|
||||
afterRestore?: (cachePath: string) => Promise<void>,
|
||||
): Promise<void> {
|
||||
log.info(
|
||||
`Trying to restore cache from GitHub Actions cache with key: ${cacheKey}`,
|
||||
);
|
||||
let matchedKey: string | undefined;
|
||||
try {
|
||||
const matchedKey = await cache.restoreCache([cachePath], cacheKey);
|
||||
if (!matchedKey) {
|
||||
log.info(`No GitHub Actions cache found for key: ${cacheKey}`);
|
||||
core.setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Record the match before the post-restore hook so the post step can skip
|
||||
// archiving the directory again even if the hook fails. A PR that restored
|
||||
// from its base branch could otherwise save the broken copy in its own cache.
|
||||
core.saveState(stateKey, matchedKey);
|
||||
await afterRestore?.(cachePath);
|
||||
log.info(
|
||||
`cache restored from GitHub Actions cache with key: ${matchedKey}`,
|
||||
);
|
||||
core.setOutput(outputKey, true);
|
||||
matchedKey = await cache.restoreCache([cachePath], cacheKey);
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
log.warning(message);
|
||||
core.setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
|
||||
handleMatchResult(matchedKey, cacheKey, stateKey, outputKey);
|
||||
}
|
||||
|
||||
async function computeKeys(
|
||||
@@ -123,3 +107,20 @@ async function computeKeys(
|
||||
const python = inputs.cachePython ? "-py" : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform}-${osNameVersion}-${version}${pythonArchKey}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
|
||||
}
|
||||
|
||||
function handleMatchResult(
|
||||
matchedKey: string | undefined,
|
||||
primaryKey: string,
|
||||
stateKey: string,
|
||||
outputKey: string,
|
||||
): void {
|
||||
if (!matchedKey) {
|
||||
log.info(`No GitHub Actions cache found for key: ${primaryKey}`);
|
||||
core.setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
|
||||
core.saveState(stateKey, matchedKey);
|
||||
log.info(`cache restored from GitHub Actions cache with key: ${matchedKey}`);
|
||||
core.setOutput(outputKey, true);
|
||||
}
|
||||
|
||||
-36
@@ -1,40 +1,4 @@
|
||||
{
|
||||
"aarch64-apple-darwin-0.13.7": "81b811b57e4624df7ed3aac148e0359100d9962f3d9dce00aec533dc2e086731",
|
||||
"aarch64-pc-windows-msvc-0.13.7": "505d9e65e7692bac3ddf98c66754aa26c5050c409c184af30a881a0a72cc85e3",
|
||||
"aarch64-unknown-linux-gnu-0.13.7": "71279f8d3c67241e807b9d8db872d1bf541579fb9f08b7d1eb1682196d1e57dc",
|
||||
"aarch64-unknown-linux-musl-0.13.7": "2d3ec076a0c4c0e8250bb6418c44080828b544f1a3be0b6e46adf9fb6923de45",
|
||||
"arm-unknown-linux-musleabihf-0.13.7": "2c029d1eda470c667e46a36fc5e2479c9a3e4af91e0cabcde07711bf40d587a9",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.7": "5e2a1315a1b8b4a25250d536f62fa5c1ab5ed17233e7bf486c3c7849cb663284",
|
||||
"armv7-unknown-linux-musleabihf-0.13.7": "4a1a7dc0b1713bbeac665a2f95e680eea3bb7ecebea226ae3b2de552bc72e88b",
|
||||
"i686-pc-windows-msvc-0.13.7": "fa2abbf16f7d12cb01c9b7f313d843218fbd91a9d3fab487cc06a1d6765b27bf",
|
||||
"i686-unknown-linux-gnu-0.13.7": "cc4f86390f9c99e8f53530e5e7f2cdc6ae7c011c9e805764332a3e3c01a378e4",
|
||||
"i686-unknown-linux-musl-0.13.7": "c2d50f5c64eb81fd1fd1ec5870403c0533fe4b6bf76f940cc5e97824e49ab782",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.7": "e8b65412482f848743e73566808f5bb480e826c9ce25361997891fcf71299080",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.7": "48aff38af87c7c8255beb9b51b3676598045786ac5197de15fea54ebfe6c72e1",
|
||||
"riscv64gc-unknown-linux-musl-0.13.7": "6c2e67417dda9661e67c2591a6226805ef2ed8ebc203baeed411f67d459207b2",
|
||||
"s390x-unknown-linux-gnu-0.13.7": "2b64a479b905b9cdab99c71105e523a0d7aa79581cbd716d40bce26d7b595428",
|
||||
"x86_64-apple-darwin-0.13.7": "20c47e4c1f630b8abaff8c291fa9b9aa300fef92c4fbff95adf198b55287cda7",
|
||||
"x86_64-pc-windows-msvc-0.13.7": "0cdc5b38fe5a8168ed6a25814f5ba43c21d313dd3187314fccb37b7cec46e021",
|
||||
"x86_64-unknown-linux-gnu-0.13.7": "c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83",
|
||||
"x86_64-unknown-linux-musl-0.13.7": "287491da03f2a785c70fa75b13e1f849918c2f2b5415fe84876b8214eeb792f9",
|
||||
"aarch64-apple-darwin-0.13.6": "60fbd5c8a1ed681845eea28d9d622fcde03c51e91a43465b64a1e17db1ed3472",
|
||||
"aarch64-pc-windows-msvc-0.13.6": "c2426c0c8e28b53d8c440e47a18d96ad4db51e159866c0e81435b196d7f0081c",
|
||||
"aarch64-unknown-linux-gnu-0.13.6": "229e194255c7958d86d56e8790d969a6f74736592133f0dfd0076f754c642c1d",
|
||||
"aarch64-unknown-linux-musl-0.13.6": "819692e404d23e5aae6bc44c0e260f1f5492fd1910ab4693b2c650f926dbe800",
|
||||
"arm-unknown-linux-musleabihf-0.13.6": "57ac0f7c04deb42c5d686b4eeeef555c442db6ffea16fe4cbd7adb0384403794",
|
||||
"armv7-unknown-linux-gnueabihf-0.13.6": "d00cd4949c4524c934afcfee1aedfa9d337cf4e43be4d6b692ad8d74d0a65562",
|
||||
"armv7-unknown-linux-musleabihf-0.13.6": "b215398c886e8cc2cfa282fe346c02025957f8633b75a3d4fd848e0adda4eddd",
|
||||
"i686-pc-windows-msvc-0.13.6": "32ceb64db231cbedfd499f7654c72e4c0b564f2846f9e76c0a4a7b2d03d7e67c",
|
||||
"i686-unknown-linux-gnu-0.13.6": "665ea831c38d342900950e606beb2ccc37b7ba0fcefc37b814eb4b076305f2b6",
|
||||
"i686-unknown-linux-musl-0.13.6": "de3a015c4b0fce63c178ae4fa95c94c873adfd92fa1e258c6a2a94e529812629",
|
||||
"powerpc64le-unknown-linux-gnu-0.13.6": "3b2847185ec2946fcc928500efef7e3e74c255d3be6f2cb435081a84885d8c6c",
|
||||
"riscv64gc-unknown-linux-gnu-0.13.6": "517052603ed46483b59d8875c9c61a577946b8f493c73e4339e45e7b119171d0",
|
||||
"riscv64gc-unknown-linux-musl-0.13.6": "659a95dc6aee3ecf86742a08d8ca6c6261422121cbd41decc0042f5a71af6305",
|
||||
"s390x-unknown-linux-gnu-0.13.6": "fb56d731308aa5c7718059d71afcb14d9a933a974997cee3d4eb5d06fc462a4b",
|
||||
"x86_64-apple-darwin-0.13.6": "63ba17fdda55ad1a230d4b37fc6017ffa10c23688c83818bd3bfdf914c652a02",
|
||||
"x86_64-pc-windows-msvc-0.13.6": "a2a8820d5eea32f08ef467ef3b7f66883a9b076d5737a2fc2fbb5f458d1bb50f",
|
||||
"x86_64-unknown-linux-gnu-0.13.6": "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645",
|
||||
"x86_64-unknown-linux-musl-0.13.6": "5d61f26b6c7213779eda90edc6971ea6b0b796bfb8d49a574c8ad69b59838548",
|
||||
"aarch64-apple-darwin-0.13.5": "743f85035a1996ecb350659e01cd9faea9709829be09b1b4b03c73eaf3c9cd73",
|
||||
"aarch64-pc-windows-msvc-0.13.5": "09f47edf90726084a70f9426f6e3ca4f46e9bf7cbf23b1716ec64d60b055fae3",
|
||||
"aarch64-unknown-linux-gnu-0.13.5": "4bb69cf95ed13f23713bb7bc09f241896ea0c75b7c557e615a20604b82f9c403",
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { createInterface } from "node:readline";
|
||||
import { Readable } from "node:stream";
|
||||
import * as core from "@actions/core";
|
||||
import {
|
||||
GITHUB_VERSIONS_MANIFEST_URL,
|
||||
VERSIONS_MANIFEST_URL,
|
||||
} from "../utils/constants";
|
||||
import { VERSIONS_MANIFEST_URL } from "../utils/constants";
|
||||
import { fetch } from "../utils/fetch";
|
||||
import * as log from "../utils/logging";
|
||||
import { selectDefaultVariant } from "./variant-selection";
|
||||
@@ -170,20 +167,6 @@ export function clearManifestCache(manifestUrl?: string): void {
|
||||
}
|
||||
|
||||
async function fetchManifestResponse(manifestUrl: string) {
|
||||
try {
|
||||
return await fetchManifestResponseFromUrl(manifestUrl);
|
||||
} catch (error) {
|
||||
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
|
||||
throw error;
|
||||
}
|
||||
log.info(
|
||||
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${(error as Error).message}`,
|
||||
);
|
||||
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchManifestResponseFromUrl(manifestUrl: string) {
|
||||
let response: Awaited<ReturnType<typeof fetch>> | undefined;
|
||||
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
|
||||
log.info(`Fetching manifest data from ${manifestUrl} ...`);
|
||||
|
||||
@@ -2,8 +2,6 @@ export const TOOL_CACHE_NAME = "uv";
|
||||
export const STATE_UV_PATH = "uv-path";
|
||||
export const STATE_UV_VERSION = "uv-version";
|
||||
export const VERSIONS_MANIFEST_URL =
|
||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson";
|
||||
export const GITHUB_VERSIONS_MANIFEST_URL =
|
||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
||||
|
||||
/** GitHub Releases URL prefix for uv artifacts. */
|
||||
|
||||
Reference in New Issue
Block a user