mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-12-04 02:16:06 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c4d57fa90 |
No files matched your search
@@ -1,5 +1,4 @@
|
|||||||
name: Release
|
name: Release
|
||||||
run-name: Release v${{ inputs.version }}
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: Actionlint
|
- name: Actionlint
|
||||||
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
|
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
|
||||||
- name: Run zizmor
|
- name: Run zizmor
|
||||||
uses: zizmorcore/zizmor-action@53290badfa369cb0bf7ad16342cb62c2fa47ac7b # v0.8.0
|
uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4
|
||||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: .nvmrc
|
node-version-file: .nvmrc
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
@@ -287,7 +287,7 @@ jobs:
|
|||||||
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
|
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
@@ -326,7 +326,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- name: Install default version
|
- name: Install default version
|
||||||
uses: $/
|
uses: $/
|
||||||
- run: uv tool install ruff==0.14.10
|
- run: uv tool install ruff==0.14.10
|
||||||
@@ -339,7 +339,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
@@ -378,7 +378,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- name: Install latest version
|
- name: Install latest version
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: $/
|
uses: $/
|
||||||
@@ -416,7 +416,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- name: Install latest version
|
- name: Install latest version
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: $/
|
uses: $/
|
||||||
@@ -567,7 +567,7 @@ jobs:
|
|||||||
expected-os: "windows-2025"
|
expected-os: "windows-2025"
|
||||||
steps:
|
steps:
|
||||||
- if: runner.os == 'macOS'
|
- if: runner.os == 'macOS'
|
||||||
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
|
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
|
||||||
- name: Setup uv
|
- name: Setup uv
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: $/
|
uses: $/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
|||||||
- Cache the installed version of uv to speed up consecutive runs on self-hosted runners
|
- Cache the installed version of uv to speed up consecutive runs on self-hosted runners
|
||||||
- Register problem matchers for error output
|
- Register problem matchers for error output
|
||||||
- (Optional) Persist the uv's cache in the GitHub Actions Cache
|
- (Optional) Persist the uv's cache in the GitHub Actions Cache
|
||||||
- Verify the SHA-256 checksum of the downloaded uv archive
|
- (Optional) Verify the checksum of the downloaded uv executable
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
```
|
```
|
||||||
|
|
||||||
If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
|
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
|
```yaml
|
||||||
- name: Install uv with all available options
|
- name: Install uv with all available options
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
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)
|
# 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: ""
|
version: ""
|
||||||
@@ -75,9 +75,6 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
|||||||
# The checksum of the uv version to install
|
# The checksum of the uv version to install
|
||||||
checksum: ""
|
checksum: ""
|
||||||
|
|
||||||
# Require a checksum bundled with setup-uv or supplied through the checksum input
|
|
||||||
require-checksums: "false"
|
|
||||||
|
|
||||||
# Used when downloading uv from GitHub releases
|
# Used when downloading uv from GitHub releases
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
@@ -127,7 +124,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
|||||||
# URL to a custom manifest file in the astral-sh/versions format
|
# URL to a custom manifest file in the astral-sh/versions format
|
||||||
manifest-file: ""
|
manifest-file: ""
|
||||||
|
|
||||||
# Use the Astral mirror for the default version manifest and uv release archives
|
# Download uv from the Astral mirror instead of directly from GitHub Releases
|
||||||
download-from-astral-mirror: "true"
|
download-from-astral-mirror: "true"
|
||||||
|
|
||||||
# Add problem matchers
|
# Add problem matchers
|
||||||
@@ -164,7 +161,7 @@ python 3.13
|
|||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version-file: ".tool-versions"
|
version-file: ".tool-versions"
|
||||||
```
|
```
|
||||||
@@ -175,7 +172,7 @@ a warning.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv and set the python version to 3.13t
|
- name: Install the latest version of uv and set the python version to 3.13t
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
python-version: 3.13t
|
python-version: 3.13t
|
||||||
- run: uv pip install --python=3.13t pip
|
- run: uv pip install --python=3.13t pip
|
||||||
@@ -193,7 +190,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Install the latest version of uv and set the python version
|
- name: Install the latest version of uv and set the python version
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Test with python ${{ matrix.python-version }}
|
- name: Test with python ${{ matrix.python-version }}
|
||||||
@@ -229,7 +226,7 @@ It also controls where [the venv gets created](#activate-environment), unless `v
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install uv based on the config files in the working-directory
|
- name: Install uv based on the config files in the working-directory
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
working-directory: my/subproject/dir
|
working-directory: my/subproject/dir
|
||||||
```
|
```
|
||||||
@@ -271,7 +268,7 @@ For example:
|
|||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Test
|
- name: Test
|
||||||
@@ -283,7 +280,7 @@ To install a specific version of Python, use
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Install Python 3.12
|
- name: Install Python 3.12
|
||||||
@@ -302,7 +299,7 @@ output:
|
|||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: Install the default version of uv
|
- name: Install the default version of uv
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
- name: Print the installed version
|
- name: Print the installed version
|
||||||
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ test("manifest checksums are used when no known checksum exists", async () => {
|
|||||||
).rejects.toThrow("did not match");
|
).rejects.toThrow("did not match");
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each(["", undefined])("rejects missing checksums (%s)", async (hash) => {
|
test("empty manifest checksums are rejected", async () => {
|
||||||
await expect(
|
await expect(
|
||||||
validateChecksum(
|
validateChecksum(
|
||||||
undefined,
|
undefined,
|
||||||
@@ -64,7 +64,7 @@ test.each(["", undefined])("rejects missing checksums (%s)", async (hash) => {
|
|||||||
"aarch64",
|
"aarch64",
|
||||||
"pc-windows-msvc",
|
"pc-windows-msvc",
|
||||||
"1.2.3",
|
"1.2.3",
|
||||||
hash,
|
"",
|
||||||
),
|
),
|
||||||
).rejects.toThrow("No checksum found");
|
).rejects.toThrow("No checksum found");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
||||||
import * as semver from "semver";
|
import * as semver from "semver";
|
||||||
import type { ManifestSource } from "../../src/utils/inputs";
|
import { VERSIONS_MANIFEST_URL } from "../../src/utils/constants";
|
||||||
|
|
||||||
const customManifest: ManifestSource = {
|
|
||||||
custom: true,
|
|
||||||
newestFirst: false,
|
|
||||||
url: "https://example.com/custom.ndjson",
|
|
||||||
};
|
|
||||||
|
|
||||||
const mockInfo = jest.fn();
|
const mockInfo = jest.fn();
|
||||||
const mockWarning = jest.fn();
|
const mockWarning = jest.fn();
|
||||||
@@ -44,11 +38,14 @@ const mockGetLatestVersion = jest.fn<any>();
|
|||||||
const mockGetAllVersions = jest.fn<any>();
|
const mockGetAllVersions = jest.fn<any>();
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
||||||
const mockGetFirstMatchingVersion = jest.fn<any>();
|
const mockGetFirstMatchingVersion = jest.fn<any>();
|
||||||
|
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
||||||
|
const mockGetArtifact = jest.fn<any>();
|
||||||
|
|
||||||
jest.unstable_mockModule("../../src/download/manifest", () => ({
|
jest.unstable_mockModule("../../src/download/manifest", () => ({
|
||||||
getAllVersions: mockGetAllVersions,
|
getAllVersions: mockGetAllVersions,
|
||||||
|
getArtifact: mockGetArtifact,
|
||||||
getFirstMatchingVersion: mockGetFirstMatchingVersion,
|
getFirstMatchingVersion: mockGetFirstMatchingVersion,
|
||||||
getFirstVersion: mockGetLatestVersion,
|
getLatestVersion: mockGetLatestVersion,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
||||||
@@ -64,11 +61,9 @@ jest.unstable_mockModule("../../src/download/checksum/known-version", () => ({
|
|||||||
getLatestKnownVersion: mockGetLatestKnownVersion,
|
getLatestKnownVersion: mockGetLatestKnownVersion,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const { downloadVersion, rewriteToMirror } = await import(
|
const { downloadVersion, resolveVersion, rewriteToMirror } = await import(
|
||||||
"../../src/download/download-version"
|
"../../src/download/download-version"
|
||||||
);
|
);
|
||||||
const { resolveVersion } = await import("../../src/version/resolve");
|
|
||||||
const { ASTRAL_MANIFEST } = await import("../../src/utils/inputs");
|
|
||||||
|
|
||||||
describe("download-version", () => {
|
describe("download-version", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -81,6 +76,7 @@ describe("download-version", () => {
|
|||||||
mockGetLatestVersion.mockReset();
|
mockGetLatestVersion.mockReset();
|
||||||
mockGetAllVersions.mockReset();
|
mockGetAllVersions.mockReset();
|
||||||
mockGetFirstMatchingVersion.mockReset();
|
mockGetFirstMatchingVersion.mockReset();
|
||||||
|
mockGetArtifact.mockReset();
|
||||||
mockValidateChecksum.mockReset();
|
mockValidateChecksum.mockReset();
|
||||||
mockGetLatestKnownVersion.mockClear();
|
mockGetLatestKnownVersion.mockClear();
|
||||||
|
|
||||||
@@ -94,15 +90,15 @@ describe("download-version", () => {
|
|||||||
it("uses the default manifest to resolve latest", async () => {
|
it("uses the default manifest to resolve latest", async () => {
|
||||||
mockGetLatestVersion.mockResolvedValue("0.9.26");
|
mockGetLatestVersion.mockResolvedValue("0.9.26");
|
||||||
|
|
||||||
const version = await resolveVersion("latest", ASTRAL_MANIFEST);
|
const version = await resolveVersion("latest", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.9.26");
|
expect(version).toBe("0.9.26");
|
||||||
expect(mockGetLatestVersion).toHaveBeenCalledTimes(1);
|
expect(mockGetLatestVersion).toHaveBeenCalledTimes(1);
|
||||||
expect(mockGetLatestVersion).toHaveBeenCalledWith(ASTRAL_MANIFEST);
|
expect(mockGetLatestVersion).toHaveBeenCalledWith(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resolves latest-known without reading the manifest", async () => {
|
it("resolves latest-known without reading the manifest", async () => {
|
||||||
const version = await resolveVersion("latest-known", ASTRAL_MANIFEST);
|
const version = await resolveVersion("latest-known", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.9.25");
|
expect(version).toBe("0.9.25");
|
||||||
expect(mockGetLatestKnownVersion).toHaveBeenCalledTimes(1);
|
expect(mockGetLatestKnownVersion).toHaveBeenCalledTimes(1);
|
||||||
@@ -117,31 +113,23 @@ describe("download-version", () => {
|
|||||||
["0.9.26", "0.9.25"].find(predicate),
|
["0.9.26", "0.9.25"].find(predicate),
|
||||||
);
|
);
|
||||||
|
|
||||||
const version = await resolveVersion("^0.9.0", ASTRAL_MANIFEST);
|
const version = await resolveVersion("^0.9.0", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.9.26");
|
expect(version).toBe("0.9.26");
|
||||||
expect(mockGetFirstMatchingVersion).toHaveBeenCalledTimes(1);
|
expect(mockGetFirstMatchingVersion).toHaveBeenCalledTimes(1);
|
||||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses the ordered search for the direct GitHub manifest", async () => {
|
it("streams ranges when the default manifest URL is explicit", async () => {
|
||||||
mockGetFirstMatchingVersion.mockImplementation(
|
mockGetFirstMatchingVersion.mockImplementation(
|
||||||
(predicate: (version: string) => boolean) =>
|
(predicate: (version: string) => boolean) =>
|
||||||
["0.9.26", "0.9.25"].find(predicate),
|
["0.9.26", "0.9.25"].find(predicate),
|
||||||
);
|
);
|
||||||
const source: ManifestSource = {
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
|
||||||
};
|
|
||||||
|
|
||||||
const version = await resolveVersion("^0.9.0", source);
|
const version = await resolveVersion("^0.9.0", VERSIONS_MANIFEST_URL);
|
||||||
|
|
||||||
expect(version).toBe("0.9.26");
|
expect(version).toBe("0.9.26");
|
||||||
expect(mockGetFirstMatchingVersion).toHaveBeenCalledWith(
|
expect(mockGetFirstMatchingVersion).toHaveBeenCalledTimes(1);
|
||||||
expect.any(Function),
|
|
||||||
source,
|
|
||||||
);
|
|
||||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -151,7 +139,7 @@ describe("download-version", () => {
|
|||||||
["0.9.26", "0.9.25"].find(predicate),
|
["0.9.26", "0.9.25"].find(predicate),
|
||||||
);
|
);
|
||||||
|
|
||||||
const version = await resolveVersion("!=0.9.26", ASTRAL_MANIFEST);
|
const version = await resolveVersion("!=0.9.26", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.9.25");
|
expect(version).toBe("0.9.25");
|
||||||
expect(mockGetFirstMatchingVersion).toHaveBeenCalledTimes(1);
|
expect(mockGetFirstMatchingVersion).toHaveBeenCalledTimes(1);
|
||||||
@@ -164,15 +152,18 @@ describe("download-version", () => {
|
|||||||
["1.0.0", "0.10.2", "0.9.26"].find(predicate),
|
["1.0.0", "0.10.2", "0.9.26"].find(predicate),
|
||||||
);
|
);
|
||||||
|
|
||||||
const version = await resolveVersion("~=0.9", ASTRAL_MANIFEST);
|
const version = await resolveVersion("~=0.9", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.10.2");
|
expect(version).toBe("0.10.2");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resolves ~= with PEP 440 compatible release semantics from manifest-file", async () => {
|
it("resolves ~= with PEP 440 compatible release semantics from manifest-file", async () => {
|
||||||
mockGetAllVersions.mockResolvedValue(["0.9.26", "1.0.0", "0.10.2"]);
|
mockGetAllVersions.mockResolvedValue(["1.0.0", "0.10.2", "0.9.26"]);
|
||||||
|
|
||||||
const version = await resolveVersion("~=0.9", customManifest);
|
const version = await resolveVersion(
|
||||||
|
"~=0.9",
|
||||||
|
"https://example.com/custom.ndjson",
|
||||||
|
);
|
||||||
|
|
||||||
expect(version).toBe("0.10.2");
|
expect(version).toBe("0.10.2");
|
||||||
});
|
});
|
||||||
@@ -186,7 +177,7 @@ describe("download-version", () => {
|
|||||||
["0.10.2", "0.9.26", "0.9.0", "0.8.24"].find(predicate),
|
["0.10.2", "0.9.26", "0.9.0", "0.8.24"].find(predicate),
|
||||||
);
|
);
|
||||||
|
|
||||||
const version = await resolveVersion(specifier, ASTRAL_MANIFEST);
|
const version = await resolveVersion(specifier, undefined);
|
||||||
|
|
||||||
expect(version).toBe(expected);
|
expect(version).toBe(expected);
|
||||||
});
|
});
|
||||||
@@ -199,13 +190,13 @@ describe("download-version", () => {
|
|||||||
"0.9.0",
|
"0.9.0",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const version = await resolveVersion(">0.9", ASTRAL_MANIFEST, "lowest");
|
const version = await resolveVersion(">0.9", undefined, "lowest");
|
||||||
|
|
||||||
expect(version).toBe("0.9.1");
|
expect(version).toBe("0.9.1");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("treats == exact pins as explicit versions", async () => {
|
it("treats == exact pins as explicit versions", async () => {
|
||||||
const version = await resolveVersion("==0.9.26", ASTRAL_MANIFEST);
|
const version = await resolveVersion("==0.9.26", undefined);
|
||||||
|
|
||||||
expect(version).toBe("0.9.26");
|
expect(version).toBe("0.9.26");
|
||||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||||
@@ -215,79 +206,269 @@ describe("download-version", () => {
|
|||||||
it("uses latest for minimum-only ranges when using the highest strategy", async () => {
|
it("uses latest for minimum-only ranges when using the highest strategy", async () => {
|
||||||
mockGetLatestVersion.mockResolvedValue("0.9.26");
|
mockGetLatestVersion.mockResolvedValue("0.9.26");
|
||||||
|
|
||||||
const version = await resolveVersion(
|
const version = await resolveVersion(">=0.9.0", undefined, "highest");
|
||||||
">=0.9.0",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
"highest",
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(version).toBe("0.9.26");
|
expect(version).toBe("0.9.26");
|
||||||
expect(mockGetLatestVersion).toHaveBeenCalledTimes(1);
|
expect(mockGetLatestVersion).toHaveBeenCalledTimes(1);
|
||||||
expect(mockGetLatestVersion).toHaveBeenCalledWith(ASTRAL_MANIFEST);
|
expect(mockGetLatestVersion).toHaveBeenCalledWith(undefined);
|
||||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses the lowest compatible version when requested", async () => {
|
it("uses the lowest compatible version when requested", async () => {
|
||||||
mockGetAllVersions.mockResolvedValue(["0.9.26", "0.9.25"]);
|
mockGetAllVersions.mockResolvedValue(["0.9.26", "0.9.25"]);
|
||||||
|
|
||||||
const version = await resolveVersion("^0.9.0", ASTRAL_MANIFEST, "lowest");
|
const version = await resolveVersion("^0.9.0", undefined, "lowest");
|
||||||
|
|
||||||
expect(version).toBe("0.9.25");
|
expect(version).toBe("0.9.25");
|
||||||
expect(mockGetAllVersions).toHaveBeenCalledTimes(1);
|
expect(mockGetAllVersions).toHaveBeenCalledTimes(1);
|
||||||
expect(mockGetAllVersions).toHaveBeenCalledWith(ASTRAL_MANIFEST);
|
expect(mockGetAllVersions).toHaveBeenCalledWith(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(["latest", ">=0.9.0"])(
|
it("uses manifest-file when provided", async () => {
|
||||||
"uses the first custom manifest record for %s",
|
mockGetAllVersions.mockResolvedValue(["0.9.26", "0.9.25"]);
|
||||||
async (specifier) => {
|
|
||||||
mockGetLatestVersion.mockResolvedValue("0.9.7");
|
|
||||||
mockGetAllVersions.mockResolvedValue(["0.9.7", "0.9.26"]);
|
|
||||||
|
|
||||||
await expect(resolveVersion(specifier, customManifest)).resolves.toBe(
|
const version = await resolveVersion(
|
||||||
"0.9.7",
|
"^0.9.0",
|
||||||
);
|
"https://example.com/custom.ndjson",
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
it("rejects the first custom manifest record if it does not meet the minimum", async () => {
|
|
||||||
mockGetLatestVersion.mockResolvedValue("0.9.7");
|
|
||||||
mockGetAllVersions.mockResolvedValue(["0.9.7", "0.9.26"]);
|
|
||||||
|
|
||||||
await expect(resolveVersion(">=0.9.8", customManifest)).rejects.toThrow(
|
|
||||||
"No version found for >=0.9.8",
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
it("resolves a range from an unordered custom manifest", async () => {
|
expect(version).toBe("0.9.26");
|
||||||
mockGetAllVersions.mockResolvedValue(["0.9.7", "0.9.26", "0.9.25"]);
|
expect(mockGetAllVersions).toHaveBeenCalledWith(
|
||||||
|
"https://example.com/custom.ndjson",
|
||||||
await expect(resolveVersion("^0.9.0", customManifest)).resolves.toBe(
|
|
||||||
"0.9.26",
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("downloadVersion", () => {
|
describe("downloadVersion", () => {
|
||||||
const githubUrl =
|
it("fails when manifest lookup fails", async () => {
|
||||||
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz";
|
mockGetArtifact.mockRejectedValue(new Error("manifest unavailable"));
|
||||||
const mirrorUrl =
|
|
||||||
"https://releases.astral.sh/github/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz";
|
|
||||||
const customUrl = "https://example.com/uv.tar.gz";
|
|
||||||
|
|
||||||
function install(downloadUrl: string, checksum?: string, useMirror = true) {
|
await expect(
|
||||||
return downloadVersion(
|
downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
),
|
||||||
|
).rejects.toThrow("manifest unavailable");
|
||||||
|
|
||||||
|
expect(mockDownloadTool).not.toHaveBeenCalled();
|
||||||
|
expect(mockValidateChecksum).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fails when no matching artifact exists in the default manifest", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue(undefined);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"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 .",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockDownloadTool).not.toHaveBeenCalled();
|
||||||
|
expect(mockValidateChecksum).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses the default manifest checksum as a fallback", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "manifest-checksum",
|
||||||
|
downloadUrl: "https://example.com/uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
"unknown-linux-gnu",
|
"unknown-linux-gnu",
|
||||||
"x86_64",
|
"x86_64",
|
||||||
"0.9.26",
|
"0.9.26",
|
||||||
{ checksum: "manifest-checksum", downloadUrl },
|
undefined,
|
||||||
checksum,
|
|
||||||
"token",
|
"token",
|
||||||
useMirror,
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
it("passes the explicit and fallback checksums to verification", async () => {
|
expect(mockValidateChecksum).toHaveBeenCalledWith(
|
||||||
await install(customUrl, "user-checksum");
|
undefined,
|
||||||
|
"/tmp/downloaded",
|
||||||
|
"x86_64",
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"0.9.26",
|
||||||
|
"manifest-checksum",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rewrites GitHub Releases URLs to the Astral mirror", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl:
|
||||||
|
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockDownloadTool).toHaveBeenCalledWith(
|
||||||
|
"https://releases.astral.sh/github/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not send the token to non-GitHub URLs from the default manifest", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl: "https://example.com/uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockDownloadTool).toHaveBeenCalledWith(
|
||||||
|
"https://example.com/uv.tar.gz",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not send the token to GitHub lookalike hosts", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl: "https://github.com.evil.test/uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockDownloadTool).toHaveBeenCalledWith(
|
||||||
|
"https://github.com.evil.test/uv.tar.gz",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("falls back to GitHub Releases when the mirror fails", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl:
|
||||||
|
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
mockDownloadTool
|
||||||
|
.mockRejectedValueOnce(new Error("mirror unavailable"))
|
||||||
|
.mockResolvedValueOnce("/tmp/downloaded");
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockDownloadTool).toHaveBeenCalledTimes(2);
|
||||||
|
expect(mockDownloadTool).toHaveBeenNthCalledWith(
|
||||||
|
1,
|
||||||
|
"https://releases.astral.sh/github/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
expect(mockDownloadTool).toHaveBeenNthCalledWith(
|
||||||
|
2,
|
||||||
|
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
);
|
||||||
|
expect(mockWarning).toHaveBeenCalledWith(
|
||||||
|
"Failed to download from mirror, falling back to GitHub Releases: mirror unavailable",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not fall back for non-GitHub URLs", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl: "https://example.com/uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
mockDownloadTool.mockRejectedValue(new Error("download failed"));
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
undefined,
|
||||||
|
"token",
|
||||||
|
),
|
||||||
|
).rejects.toThrow("download failed");
|
||||||
|
|
||||||
|
expect(mockDownloadTool).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses manifest-file checksum metadata when checksum input is unset", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "manifest-checksum",
|
||||||
|
downloadUrl: "https://example.com/custom-uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
"",
|
||||||
|
"token",
|
||||||
|
"https://example.com/custom.ndjson",
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mockValidateChecksum).toHaveBeenCalledWith(
|
||||||
|
"manifest-checksum",
|
||||||
|
"/tmp/downloaded",
|
||||||
|
"x86_64",
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"0.9.26",
|
||||||
|
"manifest-checksum",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("prefers checksum input over manifest-file checksum metadata", async () => {
|
||||||
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "manifest-checksum",
|
||||||
|
downloadUrl: "https://example.com/custom-uv.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
|
await downloadVersion(
|
||||||
|
"unknown-linux-gnu",
|
||||||
|
"x86_64",
|
||||||
|
"0.9.26",
|
||||||
|
"user-checksum",
|
||||||
|
"token",
|
||||||
|
"https://example.com/custom.ndjson",
|
||||||
|
);
|
||||||
|
|
||||||
expect(mockValidateChecksum).toHaveBeenCalledWith(
|
expect(mockValidateChecksum).toHaveBeenCalledWith(
|
||||||
"user-checksum",
|
"user-checksum",
|
||||||
@@ -299,66 +480,26 @@ describe("download-version", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rewrites GitHub Releases URLs to the Astral mirror", async () => {
|
it("skips the Astral mirror when downloadFromAstralMirror is false", async () => {
|
||||||
await install(githubUrl);
|
mockGetArtifact.mockResolvedValue({
|
||||||
|
archiveFormat: "tar.gz",
|
||||||
|
checksum: "abc123",
|
||||||
|
downloadUrl:
|
||||||
|
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
|
});
|
||||||
|
|
||||||
expect(mockDownloadTool).toHaveBeenCalledWith(
|
await downloadVersion(
|
||||||
mirrorUrl,
|
"unknown-linux-gnu",
|
||||||
undefined,
|
"x86_64",
|
||||||
undefined,
|
"0.9.26",
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each([customUrl, "https://github.com.evil.test/uv.tar.gz"])(
|
|
||||||
"does not send the token to %s",
|
|
||||||
async (url) => {
|
|
||||||
await install(url);
|
|
||||||
expect(mockDownloadTool).toHaveBeenCalledWith(
|
|
||||||
url,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
it("falls back to GitHub Releases when the mirror fails", async () => {
|
|
||||||
mockDownloadTool
|
|
||||||
.mockRejectedValueOnce(new Error("mirror unavailable"))
|
|
||||||
.mockResolvedValueOnce("/tmp/downloaded");
|
|
||||||
|
|
||||||
await install(githubUrl);
|
|
||||||
|
|
||||||
expect(mockDownloadTool).toHaveBeenCalledTimes(2);
|
|
||||||
expect(mockDownloadTool).toHaveBeenNthCalledWith(
|
|
||||||
1,
|
|
||||||
mirrorUrl,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
);
|
|
||||||
expect(mockDownloadTool).toHaveBeenNthCalledWith(
|
|
||||||
2,
|
|
||||||
githubUrl,
|
|
||||||
undefined,
|
undefined,
|
||||||
"token",
|
"token",
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
expect(mockWarning).toHaveBeenCalledWith(
|
|
||||||
"Failed to download from mirror, falling back to GitHub Releases: mirror unavailable",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not fall back for non-GitHub URLs", async () => {
|
|
||||||
mockDownloadTool.mockRejectedValue(new Error("download failed"));
|
|
||||||
|
|
||||||
await expect(install(customUrl)).rejects.toThrow("download failed");
|
|
||||||
|
|
||||||
expect(mockDownloadTool).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("skips the Astral mirror when downloadFromAstralMirror is false", async () => {
|
|
||||||
await install(githubUrl, undefined, false);
|
|
||||||
|
|
||||||
expect(mockDownloadTool).toHaveBeenCalledWith(
|
expect(mockDownloadTool).toHaveBeenCalledWith(
|
||||||
githubUrl,
|
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||||
undefined,
|
undefined,
|
||||||
"token",
|
"token",
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
import { execFile, execFileSync } from "node:child_process";
|
|
||||||
import { createHash } from "node:crypto";
|
|
||||||
import fs from "node:fs";
|
|
||||||
import { createServer } from "node:http";
|
|
||||||
import type { AddressInfo } from "node:net";
|
|
||||||
import { tmpdir } from "node:os";
|
|
||||||
import path from "node:path";
|
|
||||||
import { promisify } from "node:util";
|
|
||||||
import { expect, test } from "@jest/globals";
|
|
||||||
import { getArch, getPlatform } from "../../src/utils/platforms";
|
|
||||||
|
|
||||||
test("enforces intrinsic checksums on downloads and tool-cache hits", async () => {
|
|
||||||
const platform = await getPlatform();
|
|
||||||
const target = `${getArch()}-${platform}`;
|
|
||||||
const windows = platform === "pc-windows-msvc";
|
|
||||||
const dir = fs.mkdtempSync(path.join(tmpdir(), "setup-uv-checksums-"));
|
|
||||||
const server = createServer();
|
|
||||||
try {
|
|
||||||
const member = windows ? "uv.exe" : `uv-${target}/uv`;
|
|
||||||
const archiveName = windows ? "uv.zip" : "uv.tar.gz";
|
|
||||||
fs.mkdirSync(path.dirname(path.join(dir, member)), { recursive: true });
|
|
||||||
fs.writeFileSync(path.join(dir, member), "test build");
|
|
||||||
execFileSync("tar", ["-acf", archiveName, member], { cwd: dir });
|
|
||||||
const archive = fs.readFileSync(path.join(dir, archiveName));
|
|
||||||
const digest = createHash("sha256").update(archive).digest("hex");
|
|
||||||
let downloads = 0;
|
|
||||||
server.on("request", (_req, res) => {
|
|
||||||
downloads++;
|
|
||||||
res.end(archive);
|
|
||||||
});
|
|
||||||
await new Promise<void>((resolve) =>
|
|
||||||
server.listen(0, "127.0.0.1", resolve),
|
|
||||||
);
|
|
||||||
const address = server.address() as AddressInfo;
|
|
||||||
|
|
||||||
function install(version: string, strict: boolean, checksum = "") {
|
|
||||||
const manifest = JSON.stringify({
|
|
||||||
artifacts: [
|
|
||||||
{
|
|
||||||
archive_format: windows ? "zip" : "tar.gz",
|
|
||||||
platform: target,
|
|
||||||
sha256: digest,
|
|
||||||
url: `http://127.0.0.1:${address.port}/${archiveName}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
version,
|
|
||||||
});
|
|
||||||
return promisify(execFile)(process.execPath, ["dist/setup/index.cjs"], {
|
|
||||||
env: {
|
|
||||||
"INPUT_ACTIVATE-ENVIRONMENT": "false",
|
|
||||||
INPUT_CHECKSUM: checksum,
|
|
||||||
"INPUT_MANIFEST-FILE": `data:application/json,${encodeURIComponent(manifest)}`,
|
|
||||||
"INPUT_NO-PROJECT": "false",
|
|
||||||
"INPUT_PYTHON-VERSION": "3.13",
|
|
||||||
"INPUT_REQUIRE-CHECKSUMS": String(strict),
|
|
||||||
INPUT_VERSION: version,
|
|
||||||
"INPUT_WORKING-DIRECTORY": dir,
|
|
||||||
PATH: process.env.PATH,
|
|
||||||
RUNNER_TEMP: dir,
|
|
||||||
RUNNER_TOOL_CACHE: path.join(dir, "cache"),
|
|
||||||
SystemRoot: process.env.SystemRoot,
|
|
||||||
},
|
|
||||||
timeout: 10_000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const version = "99.0.0";
|
|
||||||
await install(version, false);
|
|
||||||
await expect(install(version, true)).rejects.toMatchObject({
|
|
||||||
stdout: expect.stringContaining(
|
|
||||||
`No bundled checksum for ${target}-${version}`,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
expect(downloads).toBe(1);
|
|
||||||
await install(version, true, digest);
|
|
||||||
expect(downloads).toBe(2);
|
|
||||||
await install(version, true, digest);
|
|
||||||
expect(downloads).toBe(2);
|
|
||||||
await expect(install(version, true, "0".repeat(64))).rejects.toMatchObject({
|
|
||||||
stdout: expect.stringContaining("did not match"),
|
|
||||||
});
|
|
||||||
// The custom manifest checksum wins unless intrinsic checksums are required.
|
|
||||||
await install("0.9.26", false);
|
|
||||||
await expect(install("0.9.26", true)).rejects.toMatchObject({
|
|
||||||
stdout: expect.stringContaining("did not match"),
|
|
||||||
});
|
|
||||||
await expect(install(version, true, "../uv")).rejects.toMatchObject({
|
|
||||||
stdout: expect.stringContaining("Expected a SHA-256 checksum"),
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
server.close();
|
|
||||||
fs.rmSync(dir, { force: true, recursive: true });
|
|
||||||
}
|
|
||||||
}, 30_000);
|
|
||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
it,
|
it,
|
||||||
jest,
|
jest,
|
||||||
} from "@jest/globals";
|
} from "@jest/globals";
|
||||||
import type { ManifestSource } from "../../src/utils/inputs";
|
|
||||||
|
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
// biome-ignore lint/suspicious/noExplicitAny: Mock requires flexible typing in tests.
|
||||||
const mockFetch = jest.fn<any>();
|
const mockFetch = jest.fn<any>();
|
||||||
@@ -20,7 +19,6 @@ jest.unstable_mockModule("../../src/utils/fetch", () => ({
|
|||||||
fetch: mockFetch,
|
fetch: mockFetch,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const { ASTRAL_MANIFEST } = await import("../../src/utils/inputs");
|
|
||||||
const {
|
const {
|
||||||
MANIFEST_FETCH_ATTEMPTS,
|
MANIFEST_FETCH_ATTEMPTS,
|
||||||
clearManifestCache,
|
clearManifestCache,
|
||||||
@@ -28,21 +26,10 @@ const {
|
|||||||
getAllVersions,
|
getAllVersions,
|
||||||
getArtifact,
|
getArtifact,
|
||||||
getFirstMatchingVersion,
|
getFirstMatchingVersion,
|
||||||
getFirstVersion,
|
getLatestVersion,
|
||||||
parseManifest,
|
parseManifest,
|
||||||
} = await import("../../src/download/manifest");
|
} = await import("../../src/download/manifest");
|
||||||
|
|
||||||
const githubManifest: ManifestSource = {
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
|
||||||
};
|
|
||||||
const customManifest: ManifestSource = {
|
|
||||||
custom: true,
|
|
||||||
newestFirst: false,
|
|
||||||
url: "https://example.com/custom.ndjson",
|
|
||||||
};
|
|
||||||
|
|
||||||
const sampleManifestResponse = `{"version":"0.9.26","artifacts":[{"platform":"aarch64-apple-darwin","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-apple-darwin.tar.gz","archive_format":"tar.gz","sha256":"fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f"},{"platform":"x86_64-pc-windows-msvc","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-pc-windows-msvc.zip","archive_format":"zip","sha256":"eb02fd95d8e0eed462b4a67ecdd320d865b38c560bffcda9a0b87ec944bdf036"}]}
|
const sampleManifestResponse = `{"version":"0.9.26","artifacts":[{"platform":"aarch64-apple-darwin","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-apple-darwin.tar.gz","archive_format":"tar.gz","sha256":"fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f"},{"platform":"x86_64-pc-windows-msvc","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-pc-windows-msvc.zip","archive_format":"zip","sha256":"eb02fd95d8e0eed462b4a67ecdd320d865b38c560bffcda9a0b87ec944bdf036"}]}
|
||||||
{"version":"0.9.25","artifacts":[{"platform":"aarch64-apple-darwin","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-apple-darwin.tar.gz","archive_format":"tar.gz","sha256":"606b3c6949d971709f2526fa0d9f0fd23ccf60e09f117999b406b424af18a6a6"}]}`;
|
{"version":"0.9.25","artifacts":[{"platform":"aarch64-apple-darwin","variant":"default","url":"https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-apple-darwin.tar.gz","archive_format":"tar.gz","sha256":"606b3c6949d971709f2526fa0d9f0fd23ccf60e09f117999b406b424af18a6a6"}]}`;
|
||||||
|
|
||||||
@@ -104,7 +91,7 @@ describe("manifest", () => {
|
|||||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
const versions = await fetchManifest(ASTRAL_MANIFEST);
|
const versions = await fetchManifest();
|
||||||
|
|
||||||
expect(versions).toHaveLength(2);
|
expect(versions).toHaveLength(2);
|
||||||
expect(versions[0]?.version).toBe("0.9.26");
|
expect(versions[0]?.version).toBe("0.9.26");
|
||||||
@@ -124,7 +111,7 @@ describe("manifest", () => {
|
|||||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = fetchManifest(ASTRAL_MANIFEST);
|
const result = fetchManifest();
|
||||||
await jest.runAllTimersAsync();
|
await jest.runAllTimersAsync();
|
||||||
|
|
||||||
await expect(result).resolves.toEqual([
|
await expect(result).resolves.toEqual([
|
||||||
@@ -138,7 +125,7 @@ describe("manifest", () => {
|
|||||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
expect(mockFetch).toHaveBeenCalledTimes(4);
|
expect(mockFetch).toHaveBeenCalledTimes(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -151,9 +138,9 @@ describe("manifest", () => {
|
|||||||
createStreamingMockResponse([`${sampleManifestResponse}\n`]),
|
createStreamingMockResponse([`${sampleManifestResponse}\n`]),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
await expect(
|
await expect(
|
||||||
getArtifact("0.9.26", "aarch64", "apple-darwin", ASTRAL_MANIFEST),
|
getArtifact("0.9.26", "aarch64", "apple-darwin"),
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
archiveFormat: "tar.gz",
|
archiveFormat: "tar.gz",
|
||||||
checksum:
|
checksum:
|
||||||
@@ -173,7 +160,9 @@ describe("manifest", () => {
|
|||||||
createMockResponse(false, 503, "Service Unavailable", ""),
|
createMockResponse(false, 503, "Service Unavailable", ""),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(fetchManifest(customManifest)).rejects.toThrow(
|
await expect(
|
||||||
|
fetchManifest("https://example.com/custom.ndjson"),
|
||||||
|
).rejects.toThrow(
|
||||||
"Failed to fetch manifest data: 503 Service Unavailable",
|
"Failed to fetch manifest data: 503 Service Unavailable",
|
||||||
);
|
);
|
||||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
||||||
@@ -189,7 +178,7 @@ describe("manifest", () => {
|
|||||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = fetchManifest(ASTRAL_MANIFEST);
|
const result = fetchManifest();
|
||||||
await jest.runAllTimersAsync();
|
await jest.runAllTimersAsync();
|
||||||
|
|
||||||
await expect(result).resolves.toHaveLength(2);
|
await expect(result).resolves.toHaveLength(2);
|
||||||
@@ -200,7 +189,7 @@ describe("manifest", () => {
|
|||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
mockFetch.mockRejectedValue(new Error("request timed out"));
|
mockFetch.mockRejectedValue(new Error("request timed out"));
|
||||||
|
|
||||||
const result = expect(fetchManifest(ASTRAL_MANIFEST)).rejects.toThrow(
|
const result = expect(fetchManifest()).rejects.toThrow(
|
||||||
"request timed out",
|
"request timed out",
|
||||||
);
|
);
|
||||||
await jest.runAllTimersAsync();
|
await jest.runAllTimersAsync();
|
||||||
@@ -214,26 +203,20 @@ describe("manifest", () => {
|
|||||||
createMockResponse(false, 500, "Internal Server Error", ""),
|
createMockResponse(false, 500, "Internal Server Error", ""),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(fetchManifest(ASTRAL_MANIFEST)).rejects.toThrow(
|
await expect(fetchManifest()).rejects.toThrow(
|
||||||
"Failed to fetch manifest data: 500 Internal Server Error",
|
"Failed to fetch manifest data: 500 Internal Server Error",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reuses a custom manifest across version and artifact lookups", async () => {
|
it("caches results per URL", async () => {
|
||||||
mockFetch.mockResolvedValue(
|
mockFetch.mockResolvedValue(
|
||||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
await expect(getAllVersions(customManifest)).resolves.toEqual([
|
|
||||||
"0.9.26",
|
|
||||||
"0.9.25",
|
|
||||||
]);
|
|
||||||
await expect(
|
|
||||||
getArtifact("0.9.25", "aarch64", "apple-darwin", customManifest),
|
|
||||||
).resolves.toBeDefined();
|
|
||||||
|
|
||||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
await fetchManifest("https://example.com/custom.ndjson");
|
||||||
"https://example.com/custom.ndjson",
|
await fetchManifest("https://example.com/custom.ndjson");
|
||||||
]);
|
|
||||||
|
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -243,50 +226,46 @@ describe("manifest", () => {
|
|||||||
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
const versions = await getAllVersions(customManifest);
|
const versions = await getAllVersions(
|
||||||
|
"https://example.com/custom.ndjson",
|
||||||
|
);
|
||||||
|
|
||||||
expect(versions).toEqual(["0.9.26", "0.9.25"]);
|
expect(versions).toEqual(["0.9.26", "0.9.25"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getFirstVersion", () => {
|
describe("getLatestVersion", () => {
|
||||||
it.each([ASTRAL_MANIFEST, githubManifest])(
|
it("returns the first version string", async () => {
|
||||||
"stops after the first record from $url",
|
|
||||||
async (source) => {
|
|
||||||
const [latestVersion] = sampleManifestResponse.split("\n");
|
|
||||||
const cancel = jest.fn();
|
|
||||||
mockFetch.mockResolvedValue(
|
|
||||||
createStreamingMockResponse(
|
|
||||||
[
|
|
||||||
latestVersion.slice(0, 100),
|
|
||||||
`${latestVersion.slice(100)}\n`,
|
|
||||||
"invalid trailing data\n",
|
|
||||||
],
|
|
||||||
cancel,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await expect(getFirstVersion(source)).resolves.toBe("0.9.26");
|
|
||||||
await expect(
|
|
||||||
getArtifact("0.9.26", "aarch64", "apple-darwin", source),
|
|
||||||
).resolves.toBeDefined();
|
|
||||||
|
|
||||||
expect(cancel).toHaveBeenCalledTimes(1);
|
|
||||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([source.url]);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
it("does not fall back to Astral when direct GitHub fetching fails", async () => {
|
|
||||||
mockFetch.mockResolvedValue(
|
mockFetch.mockResolvedValue(
|
||||||
createMockResponse(false, 503, "Service Unavailable", ""),
|
createMockResponse(true, 200, "OK", sampleManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(getFirstVersion(githubManifest)).rejects.toThrow(
|
await expect(
|
||||||
"503 Service Unavailable",
|
getLatestVersion("https://example.com/custom.ndjson"),
|
||||||
|
).resolves.toBe("0.9.26");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("stops reading the default manifest after the first record", async () => {
|
||||||
|
const [latestVersion] = sampleManifestResponse.split("\n");
|
||||||
|
const cancel = jest.fn();
|
||||||
|
mockFetch.mockResolvedValue(
|
||||||
|
createStreamingMockResponse(
|
||||||
|
[
|
||||||
|
latestVersion.slice(0, 100),
|
||||||
|
`${latestVersion.slice(100)}\n`,
|
||||||
|
"invalid trailing data\n",
|
||||||
|
],
|
||||||
|
cancel,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
|
|
||||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
]);
|
await expect(
|
||||||
|
getArtifact("0.9.26", "aarch64", "apple-darwin"),
|
||||||
|
).resolves.toBeDefined();
|
||||||
|
|
||||||
|
expect(cancel).toHaveBeenCalledTimes(1);
|
||||||
|
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not fail when canceling the remaining response fails", async () => {
|
it("does not fail when canceling the remaining response fails", async () => {
|
||||||
@@ -297,7 +276,7 @@ describe("manifest", () => {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -312,10 +291,7 @@ describe("manifest", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
getFirstMatchingVersion(
|
getFirstMatchingVersion((version) => version === "0.9.25"),
|
||||||
(version) => version === "0.9.25",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
),
|
|
||||||
).resolves.toBe("0.9.25");
|
).resolves.toBe("0.9.25");
|
||||||
|
|
||||||
expect(cancel).toHaveBeenCalledTimes(1);
|
expect(cancel).toHaveBeenCalledTimes(1);
|
||||||
@@ -331,12 +307,9 @@ describe("manifest", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
getFirstMatchingVersion(
|
getFirstMatchingVersion((version) => version === "0.0.1"),
|
||||||
(version) => version === "0.0.1",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
),
|
|
||||||
).resolves.toBeUndefined();
|
).resolves.toBeUndefined();
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
|
|
||||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
@@ -350,12 +323,7 @@ describe("manifest", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("finds an artifact by version and platform", async () => {
|
it("finds an artifact by version and platform", async () => {
|
||||||
const artifact = await getArtifact(
|
const artifact = await getArtifact("0.9.26", "aarch64", "apple-darwin");
|
||||||
"0.9.26",
|
|
||||||
"aarch64",
|
|
||||||
"apple-darwin",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(artifact).toEqual({
|
expect(artifact).toEqual({
|
||||||
archiveFormat: "tar.gz",
|
archiveFormat: "tar.gz",
|
||||||
@@ -367,12 +335,7 @@ describe("manifest", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("finds a windows artifact", async () => {
|
it("finds a windows artifact", async () => {
|
||||||
const artifact = await getArtifact(
|
const artifact = await getArtifact("0.9.26", "x86_64", "pc-windows-msvc");
|
||||||
"0.9.26",
|
|
||||||
"x86_64",
|
|
||||||
"pc-windows-msvc",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(artifact).toEqual({
|
expect(artifact).toEqual({
|
||||||
archiveFormat: "zip",
|
archiveFormat: "zip",
|
||||||
@@ -388,12 +351,7 @@ describe("manifest", () => {
|
|||||||
createMockResponse(true, 200, "OK", multiVariantManifestResponse),
|
createMockResponse(true, 200, "OK", multiVariantManifestResponse),
|
||||||
);
|
);
|
||||||
|
|
||||||
const artifact = await getArtifact(
|
const artifact = await getArtifact("0.9.26", "aarch64", "apple-darwin");
|
||||||
"0.9.26",
|
|
||||||
"aarch64",
|
|
||||||
"apple-darwin",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(artifact).toEqual({
|
expect(artifact).toEqual({
|
||||||
archiveFormat: "zip",
|
archiveFormat: "zip",
|
||||||
@@ -404,12 +362,7 @@ describe("manifest", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns undefined for an unknown version", async () => {
|
it("returns undefined for an unknown version", async () => {
|
||||||
const artifact = await getArtifact(
|
const artifact = await getArtifact("0.0.1", "aarch64", "apple-darwin");
|
||||||
"0.0.1",
|
|
||||||
"aarch64",
|
|
||||||
"apple-darwin",
|
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(artifact).toBeUndefined();
|
expect(artifact).toBeUndefined();
|
||||||
});
|
});
|
||||||
@@ -419,7 +372,6 @@ describe("manifest", () => {
|
|||||||
"0.9.26",
|
"0.9.26",
|
||||||
"aarch64",
|
"aarch64",
|
||||||
"unknown-linux-musl",
|
"unknown-linux-musl",
|
||||||
ASTRAL_MANIFEST,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(artifact).toBeUndefined();
|
expect(artifact).toBeUndefined();
|
||||||
@@ -439,9 +391,9 @@ describe("manifest", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
getArtifact("0.0.1", "aarch64", "apple-darwin", ASTRAL_MANIFEST),
|
getArtifact("0.0.1", "aarch64", "apple-darwin"),
|
||||||
).rejects.toThrow("Failed to parse manifest data");
|
).rejects.toThrow("Failed to parse manifest data");
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
|
|
||||||
expect(mockFetch).toHaveBeenCalledTimes(2);
|
expect(mockFetch).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
@@ -472,9 +424,9 @@ describe("manifest", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
getArtifact("0.0.1", "aarch64", "apple-darwin", ASTRAL_MANIFEST),
|
getArtifact("0.0.1", "aarch64", "apple-darwin"),
|
||||||
).rejects.toThrow("response stream failed");
|
).rejects.toThrow("response stream failed");
|
||||||
await expect(getFirstVersion(ASTRAL_MANIFEST)).resolves.toBe("0.9.26");
|
await expect(getLatestVersion()).resolves.toBe("0.9.26");
|
||||||
|
|
||||||
expect(mockFetch).toHaveBeenCalledTimes(2);
|
expect(mockFetch).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,18 +20,12 @@ export function createSetupInputs(
|
|||||||
githubToken: "",
|
githubToken: "",
|
||||||
ignoreEmptyWorkdir: false,
|
ignoreEmptyWorkdir: false,
|
||||||
ignoreNothingToCache: false,
|
ignoreNothingToCache: false,
|
||||||
manifestSource: {
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: "https://example.com/uv.ndjson",
|
|
||||||
},
|
|
||||||
noProject: false,
|
noProject: false,
|
||||||
pruneCache: false,
|
pruneCache: false,
|
||||||
pythonArch: "",
|
pythonArch: "",
|
||||||
pythonDir: "/tmp/uv-python-dir",
|
pythonDir: "/tmp/uv-python-dir",
|
||||||
pythonVersion: "",
|
pythonVersion: "",
|
||||||
quiet: false,
|
quiet: false,
|
||||||
requireChecksums: false,
|
|
||||||
resolutionStrategy: "highest",
|
resolutionStrategy: "highest",
|
||||||
restoreCache: false,
|
restoreCache: false,
|
||||||
saveCache: true,
|
saveCache: true,
|
||||||
|
|||||||
@@ -108,50 +108,10 @@ describe("loadInputs", () => {
|
|||||||
expect(inputs.pythonArch).toBe("");
|
expect(inputs.pythonArch).toBe("");
|
||||||
expect(inputs.exportPythonArch).toBe(false);
|
expect(inputs.exportPythonArch).toBe(false);
|
||||||
expect(inputs.venvPath).toBe("/workspace/.venv");
|
expect(inputs.venvPath).toBe("/workspace/.venv");
|
||||||
expect(inputs.requireChecksums).toBe(false);
|
expect(inputs.manifestFile).toBeUndefined();
|
||||||
expect(inputs.resolutionStrategy).toBe("highest");
|
expect(inputs.resolutionStrategy).toBe("highest");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
|
||||||
[
|
|
||||||
"true",
|
|
||||||
{
|
|
||||||
custom: false,
|
|
||||||
fallbackUrl:
|
|
||||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
|
||||||
newestFirst: true,
|
|
||||||
url: "https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"false",
|
|
||||||
{
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
])("selects the official source when the mirror is %s", (mirror, source) => {
|
|
||||||
mockInputs["download-from-astral-mirror"] = mirror;
|
|
||||||
expect(loadInputs().manifestSource).toStrictEqual(source);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("uses an explicit manifest source even with the mirror enabled", () => {
|
|
||||||
mockInputs["download-from-astral-mirror"] = "true";
|
|
||||||
mockInputs["manifest-file"] = "https://example.com/custom.ndjson";
|
|
||||||
|
|
||||||
expect(loadInputs().manifestSource).toStrictEqual({
|
|
||||||
custom: true,
|
|
||||||
newestFirst: false,
|
|
||||||
url: "https://example.com/custom.ndjson",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("loads require-checksums", () => {
|
|
||||||
mockInputs["require-checksums"] = "true";
|
|
||||||
expect(loadInputs().requireChecksums).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("uses the Python version from an explicitly selected .tool-versions file", () => {
|
it("uses the Python version from an explicitly selected .tool-versions file", () => {
|
||||||
mockInputs["working-directory"] = createTempProject({
|
mockInputs["working-directory"] = createTempProject({
|
||||||
".tool-versions": "uv 0.12.3\npython 3.13.1t\n",
|
".tool-versions": "uv 0.12.3\npython 3.13.1t\n",
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ inputs:
|
|||||||
type: string
|
type: string
|
||||||
checksum:
|
checksum:
|
||||||
type: string
|
type: string
|
||||||
require-checksums:
|
|
||||||
type: boolean
|
|
||||||
github-token:
|
github-token:
|
||||||
type: string
|
type: string
|
||||||
enable-cache:
|
enable-cache:
|
||||||
|
|||||||
+1
-4
@@ -30,9 +30,6 @@ inputs:
|
|||||||
checksum:
|
checksum:
|
||||||
description: "The checksum of the uv version to install"
|
description: "The checksum of the uv version to install"
|
||||||
required: false
|
required: false
|
||||||
require-checksums:
|
|
||||||
description: "Require a SHA-256 checksum bundled with setup-uv or supplied through the checksum input."
|
|
||||||
default: "false"
|
|
||||||
github-token:
|
github-token:
|
||||||
description:
|
description:
|
||||||
"Used when downloading uv from GitHub releases."
|
"Used when downloading uv from GitHub releases."
|
||||||
@@ -87,7 +84,7 @@ inputs:
|
|||||||
description: "URL to a custom manifest file in the astral-sh/versions format."
|
description: "URL to a custom manifest file in the astral-sh/versions format."
|
||||||
required: false
|
required: false
|
||||||
download-from-astral-mirror:
|
download-from-astral-mirror:
|
||||||
description: "Use the Astral mirror for the default version manifest and uv release archives."
|
description: "Download uv from the Astral mirror instead of directly from GitHub Releases."
|
||||||
default: "true"
|
default: "true"
|
||||||
add-problem-matchers:
|
add-problem-matchers:
|
||||||
description: "Add problem matchers."
|
description: "Add problem matchers."
|
||||||
|
|||||||
+8
-23
@@ -66230,19 +66230,6 @@ function getConfigValueFromTomlContent(filePath, fileContent, key) {
|
|||||||
__name(getConfigValueFromTomlContent, "getConfigValueFromTomlContent");
|
__name(getConfigValueFromTomlContent, "getConfigValueFromTomlContent");
|
||||||
|
|
||||||
// src/utils/inputs.ts
|
// src/utils/inputs.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 ASTRAL_MANIFEST = {
|
|
||||||
custom: false,
|
|
||||||
fallbackUrl: GITHUB_VERSIONS_MANIFEST_URL,
|
|
||||||
newestFirst: true,
|
|
||||||
url: VERSIONS_MANIFEST_URL
|
|
||||||
};
|
|
||||||
var GITHUB_MANIFEST = {
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: GITHUB_VERSIONS_MANIFEST_URL
|
|
||||||
};
|
|
||||||
function loadInputs() {
|
function loadInputs() {
|
||||||
const workingDirectory = getInput("working-directory");
|
const workingDirectory = getInput("working-directory");
|
||||||
const version3 = getInput("version");
|
const version3 = getInput("version");
|
||||||
@@ -66255,7 +66242,6 @@ function loadInputs() {
|
|||||||
const noProject = getBooleanInput("no-project");
|
const noProject = getBooleanInput("no-project");
|
||||||
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
||||||
const checksum = getInput("checksum");
|
const checksum = getInput("checksum");
|
||||||
const requireChecksums = getBooleanInput("require-checksums");
|
|
||||||
const enableCache = getEnableCache();
|
const enableCache = getEnableCache();
|
||||||
const restoreCache2 = getInput("restore-cache") === "true";
|
const restoreCache2 = getInput("restore-cache") === "true";
|
||||||
const saveCache4 = getSaveCache();
|
const saveCache4 = getSaveCache();
|
||||||
@@ -66274,8 +66260,8 @@ function loadInputs() {
|
|||||||
const toolDir = getToolDir(workingDirectory);
|
const toolDir = getToolDir(workingDirectory);
|
||||||
const pythonDir = getUvPythonDir();
|
const pythonDir = getUvPythonDir();
|
||||||
const githubToken = getInput("github-token");
|
const githubToken = getInput("github-token");
|
||||||
|
const manifestFile = getManifestFile();
|
||||||
const downloadFromAstralMirror = getInput("download-from-astral-mirror") === "true";
|
const downloadFromAstralMirror = getInput("download-from-astral-mirror") === "true";
|
||||||
const manifestSource = getManifestSource(downloadFromAstralMirror);
|
|
||||||
const addProblemMatchers = getInput("add-problem-matchers") === "true";
|
const addProblemMatchers = getInput("add-problem-matchers") === "true";
|
||||||
const quiet2 = getInput("quiet") === "true";
|
const quiet2 = getInput("quiet") === "true";
|
||||||
const resolutionStrategy = getResolutionStrategy();
|
const resolutionStrategy = getResolutionStrategy();
|
||||||
@@ -66293,14 +66279,13 @@ function loadInputs() {
|
|||||||
githubToken,
|
githubToken,
|
||||||
ignoreEmptyWorkdir,
|
ignoreEmptyWorkdir,
|
||||||
ignoreNothingToCache,
|
ignoreNothingToCache,
|
||||||
manifestSource,
|
manifestFile,
|
||||||
noProject,
|
noProject,
|
||||||
pruneCache: pruneCache2,
|
pruneCache: pruneCache2,
|
||||||
pythonArch,
|
pythonArch,
|
||||||
pythonDir,
|
pythonDir,
|
||||||
pythonVersion,
|
pythonVersion,
|
||||||
quiet: quiet2,
|
quiet: quiet2,
|
||||||
requireChecksums,
|
|
||||||
resolutionStrategy,
|
resolutionStrategy,
|
||||||
restoreCache: restoreCache2,
|
restoreCache: restoreCache2,
|
||||||
saveCache: saveCache4,
|
saveCache: saveCache4,
|
||||||
@@ -66541,14 +66526,14 @@ function resolveRelativePath(workingDirectory, inputPath) {
|
|||||||
return hasNegation ? `!${resolvedPath}` : resolvedPath;
|
return hasNegation ? `!${resolvedPath}` : resolvedPath;
|
||||||
}
|
}
|
||||||
__name(resolveRelativePath, "resolveRelativePath");
|
__name(resolveRelativePath, "resolveRelativePath");
|
||||||
function getManifestSource(useAstralMirror) {
|
function getManifestFile() {
|
||||||
const manifestFile = getInput("manifest-file");
|
const manifestFileInput = getInput("manifest-file");
|
||||||
if (manifestFile !== "") {
|
if (manifestFileInput !== "") {
|
||||||
return { custom: true, newestFirst: false, url: manifestFile };
|
return manifestFileInput;
|
||||||
}
|
}
|
||||||
return useAstralMirror ? ASTRAL_MANIFEST : GITHUB_MANIFEST;
|
return void 0;
|
||||||
}
|
}
|
||||||
__name(getManifestSource, "getManifestSource");
|
__name(getManifestFile, "getManifestFile");
|
||||||
function getResolutionStrategy() {
|
function getResolutionStrategy() {
|
||||||
const resolutionStrategyInput = getInput("resolution-strategy");
|
const resolutionStrategyInput = getInput("resolution-strategy");
|
||||||
if (resolutionStrategyInput === "lowest") {
|
if (resolutionStrategyInput === "lowest") {
|
||||||
|
|||||||
+1105
-1207
File diff suppressed because it is too large.
Load diff
+63
-173
@@ -963,7 +963,7 @@ var require_util = __commonJS({
|
|||||||
var net = require("node:net");
|
var net = require("node:net");
|
||||||
var { Blob: Blob2 } = require("node:buffer");
|
var { Blob: Blob2 } = require("node:buffer");
|
||||||
var nodeUtil = require("node:util");
|
var nodeUtil = require("node:util");
|
||||||
var { stringify: stringify2 } = require("node:querystring");
|
var { stringify } = require("node:querystring");
|
||||||
var { EventEmitter: EE } = require("node:events");
|
var { EventEmitter: EE } = require("node:events");
|
||||||
var { InvalidArgumentError } = require_errors();
|
var { InvalidArgumentError } = require_errors();
|
||||||
var { headerNameLowerCasedRecord } = require_constants();
|
var { headerNameLowerCasedRecord } = require_constants();
|
||||||
@@ -1023,7 +1023,7 @@ var require_util = __commonJS({
|
|||||||
if (url.includes("?") || url.includes("#")) {
|
if (url.includes("?") || url.includes("#")) {
|
||||||
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
|
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
|
||||||
}
|
}
|
||||||
const stringified = stringify2(queryParams);
|
const stringified = stringify(queryParams);
|
||||||
if (stringified) {
|
if (stringified) {
|
||||||
url += "?" + stringified;
|
url += "?" + stringified;
|
||||||
}
|
}
|
||||||
@@ -3425,7 +3425,7 @@ var require_data_url = __commonJS({
|
|||||||
const buffer = Buffer.from(data, "base64");
|
const buffer = Buffer.from(data, "base64");
|
||||||
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
||||||
}
|
}
|
||||||
function collectAnHTTPQuotedString(input, position, extractValue2) {
|
function collectAnHTTPQuotedString(input, position, extractValue) {
|
||||||
const positionStart = position.position;
|
const positionStart = position.position;
|
||||||
let value = "";
|
let value = "";
|
||||||
assert(input[position.position] === '"');
|
assert(input[position.position] === '"');
|
||||||
@@ -3453,7 +3453,7 @@ var require_data_url = __commonJS({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (extractValue2) {
|
if (extractValue) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return input.slice(positionStart, position.position);
|
return input.slice(positionStart, position.position);
|
||||||
@@ -15920,7 +15920,7 @@ var require_util6 = __commonJS({
|
|||||||
throw new Error("Invalid cookie max-age");
|
throw new Error("Invalid cookie max-age");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function stringify2(cookie) {
|
function stringify(cookie) {
|
||||||
if (cookie.name.length === 0) {
|
if (cookie.name.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -15974,7 +15974,7 @@ var require_util6 = __commonJS({
|
|||||||
validateCookiePath,
|
validateCookiePath,
|
||||||
validateCookieValue,
|
validateCookieValue,
|
||||||
toIMFDate,
|
toIMFDate,
|
||||||
stringify: stringify2
|
stringify
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -16124,7 +16124,7 @@ var require_cookies = __commonJS({
|
|||||||
"node_modules/@actions/http-client/node_modules/undici/lib/web/cookies/index.js"(exports2, module2) {
|
"node_modules/@actions/http-client/node_modules/undici/lib/web/cookies/index.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { parseSetCookie } = require_parse();
|
var { parseSetCookie } = require_parse();
|
||||||
var { stringify: stringify2 } = require_util6();
|
var { stringify } = require_util6();
|
||||||
var { webidl } = require_webidl();
|
var { webidl } = require_webidl();
|
||||||
var { Headers: Headers2 } = require_headers();
|
var { Headers: Headers2 } = require_headers();
|
||||||
function getCookies(headers) {
|
function getCookies(headers) {
|
||||||
@@ -16167,7 +16167,7 @@ var require_cookies = __commonJS({
|
|||||||
webidl.argumentLengthCheck(arguments, 2, "setCookie");
|
webidl.argumentLengthCheck(arguments, 2, "setCookie");
|
||||||
webidl.brandCheck(headers, Headers2, { strict: false });
|
webidl.brandCheck(headers, Headers2, { strict: false });
|
||||||
cookie = webidl.converters.Cookie(cookie);
|
cookie = webidl.converters.Cookie(cookie);
|
||||||
const str = stringify2(cookie);
|
const str = stringify(cookie);
|
||||||
if (str) {
|
if (str) {
|
||||||
headers.append("Set-Cookie", str);
|
headers.append("Set-Cookie", str);
|
||||||
}
|
}
|
||||||
@@ -18724,8 +18724,8 @@ var require_semver = __commonJS({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var i;
|
var i;
|
||||||
exports2.parse = parse2;
|
exports2.parse = parse;
|
||||||
function parse2(version, options) {
|
function parse(version, options) {
|
||||||
if (!options || typeof options !== "object") {
|
if (!options || typeof options !== "object") {
|
||||||
options = {
|
options = {
|
||||||
loose: !!options,
|
loose: !!options,
|
||||||
@@ -18753,12 +18753,12 @@ var require_semver = __commonJS({
|
|||||||
}
|
}
|
||||||
exports2.valid = valid;
|
exports2.valid = valid;
|
||||||
function valid(version, options) {
|
function valid(version, options) {
|
||||||
var v = parse2(version, options);
|
var v = parse(version, options);
|
||||||
return v ? v.version : null;
|
return v ? v.version : null;
|
||||||
}
|
}
|
||||||
exports2.clean = clean;
|
exports2.clean = clean;
|
||||||
function clean(version, options) {
|
function clean(version, options) {
|
||||||
var s = parse2(version.trim().replace(/^[=v]+/, ""), options);
|
var s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
||||||
return s ? s.version : null;
|
return s ? s.version : null;
|
||||||
}
|
}
|
||||||
exports2.SemVer = SemVer;
|
exports2.SemVer = SemVer;
|
||||||
@@ -18994,8 +18994,8 @@ var require_semver = __commonJS({
|
|||||||
if (eq(version1, version2)) {
|
if (eq(version1, version2)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
var v1 = parse2(version1);
|
var v1 = parse(version1);
|
||||||
var v2 = parse2(version2);
|
var v2 = parse(version2);
|
||||||
var prefix = "";
|
var prefix = "";
|
||||||
if (v1.prerelease.length || v2.prerelease.length) {
|
if (v1.prerelease.length || v2.prerelease.length) {
|
||||||
prefix = "pre";
|
prefix = "pre";
|
||||||
@@ -19701,7 +19701,7 @@ var require_semver = __commonJS({
|
|||||||
}
|
}
|
||||||
exports2.prerelease = prerelease;
|
exports2.prerelease = prerelease;
|
||||||
function prerelease(version, options) {
|
function prerelease(version, options) {
|
||||||
var parsed = parse2(version, options);
|
var parsed = parse(version, options);
|
||||||
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
||||||
}
|
}
|
||||||
exports2.intersects = intersects;
|
exports2.intersects = intersects;
|
||||||
@@ -19738,7 +19738,7 @@ var require_semver = __commonJS({
|
|||||||
if (match === null) {
|
if (match === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return parse2(match[2] + "." + (match[3] || "0") + "." + (match[4] || "0"), options);
|
return parse(match[2] + "." + (match[3] || "0") + "." + (match[4] || "0"), options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -20751,7 +20751,7 @@ var require_util9 = __commonJS({
|
|||||||
var { IncomingMessage } = require("node:http");
|
var { IncomingMessage } = require("node:http");
|
||||||
var stream = require("node:stream");
|
var stream = require("node:stream");
|
||||||
var net = require("node:net");
|
var net = require("node:net");
|
||||||
var { stringify: stringify2 } = require("node:querystring");
|
var { stringify } = require("node:querystring");
|
||||||
var { EventEmitter: EE, addAbortListener: addAbortListenerNative } = require("node:events");
|
var { EventEmitter: EE, addAbortListener: addAbortListenerNative } = require("node:events");
|
||||||
var timers = require_timers2();
|
var timers = require_timers2();
|
||||||
var { InvalidArgumentError, ConnectTimeoutError } = require_errors2();
|
var { InvalidArgumentError, ConnectTimeoutError } = require_errors2();
|
||||||
@@ -20807,7 +20807,7 @@ var require_util9 = __commonJS({
|
|||||||
if (pathHasQueryOrFragment(url)) {
|
if (pathHasQueryOrFragment(url)) {
|
||||||
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
|
throw new Error('Query params cannot be passed when url already contains "?" or "#".');
|
||||||
}
|
}
|
||||||
const stringified = stringify2(queryParams);
|
const stringified = stringify(queryParams);
|
||||||
if (stringified) {
|
if (stringified) {
|
||||||
url += "?" + stringified;
|
url += "?" + stringified;
|
||||||
}
|
}
|
||||||
@@ -23887,7 +23887,7 @@ var require_data_url2 = __commonJS({
|
|||||||
}
|
}
|
||||||
return mimeType;
|
return mimeType;
|
||||||
}
|
}
|
||||||
function collectAnHTTPQuotedString(input, position, extractValue2 = false) {
|
function collectAnHTTPQuotedString(input, position, extractValue = false) {
|
||||||
const positionStart = position.position;
|
const positionStart = position.position;
|
||||||
let value = "";
|
let value = "";
|
||||||
assert(input[position.position] === '"');
|
assert(input[position.position] === '"');
|
||||||
@@ -23915,7 +23915,7 @@ var require_data_url2 = __commonJS({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (extractValue2) {
|
if (extractValue) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return input.slice(positionStart, position.position);
|
return input.slice(positionStart, position.position);
|
||||||
@@ -43997,7 +43997,7 @@ var require_util12 = __commonJS({
|
|||||||
throw new Error("Invalid cookie max-age");
|
throw new Error("Invalid cookie max-age");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function stringify2(cookie) {
|
function stringify(cookie) {
|
||||||
if (cookie.name.length === 0) {
|
if (cookie.name.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -44055,7 +44055,7 @@ var require_util12 = __commonJS({
|
|||||||
validateCookiePath,
|
validateCookiePath,
|
||||||
validateCookieValue,
|
validateCookieValue,
|
||||||
toIMFDate,
|
toIMFDate,
|
||||||
stringify: stringify2
|
stringify
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -44206,7 +44206,7 @@ var require_cookies2 = __commonJS({
|
|||||||
"node_modules/undici/lib/web/cookies/index.js"(exports2, module2) {
|
"node_modules/undici/lib/web/cookies/index.js"(exports2, module2) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var { parseSetCookie } = require_parse2();
|
var { parseSetCookie } = require_parse2();
|
||||||
var { stringify: stringify2 } = require_util12();
|
var { stringify } = require_util12();
|
||||||
var { webidl } = require_webidl2();
|
var { webidl } = require_webidl2();
|
||||||
var globalHeadersBrandCheck = (arg) => webidl.brandCheck(arg, webidl.util.MakeTypeAssertion(globalThis.Headers));
|
var globalHeadersBrandCheck = (arg) => webidl.brandCheck(arg, webidl.util.MakeTypeAssertion(globalThis.Headers));
|
||||||
var undiciHeadersBrandCheck = (arg) => webidl.brandCheck(arg, webidl.is.Headers);
|
var undiciHeadersBrandCheck = (arg) => webidl.brandCheck(arg, webidl.is.Headers);
|
||||||
@@ -44262,7 +44262,7 @@ var require_cookies2 = __commonJS({
|
|||||||
webidl.argumentLengthCheck(arguments, 2, "setCookie");
|
webidl.argumentLengthCheck(arguments, 2, "setCookie");
|
||||||
brandCheckHeaders(headers);
|
brandCheckHeaders(headers);
|
||||||
cookie = webidl.converters.Cookie(cookie);
|
cookie = webidl.converters.Cookie(cookie);
|
||||||
const str = stringify2(cookie);
|
const str = stringify(cookie);
|
||||||
if (str) {
|
if (str) {
|
||||||
headers.append("set-cookie", str, true);
|
headers.append("set-cookie", str, true);
|
||||||
}
|
}
|
||||||
@@ -47954,78 +47954,6 @@ var semver = __toESM(require_semver(), 1);
|
|||||||
|
|
||||||
// src/download/checksum/known-checksums.json
|
// src/download/checksum/known-checksums.json
|
||||||
var known_checksums_default = {
|
var known_checksums_default = {
|
||||||
"aarch64-apple-darwin-0.13.12": "d905e1a64548255c3ed1235fc933e5f7d0d5b7351d2b458c715d47577fe1412c",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.12": "7c824762c7e6b38f30b3284876b58aa891373e67b759f9b70e0dfc2b4d2e2765",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.12": "33566e9a9736a658745e843cae59e9d749c46b370ec1a96394a1bbae4cfc64bc",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.12": "a7045ebd5c321a7682c7e4c0eb7e091ac5ce3596967323c5e408962197f34bfd",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.12": "ecc9b6de82f070cf3a393579b07033e3cabd083f8a25fab38093e154f5ff9cae",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.12": "3fce28697e213d9b63e8132ead143d0f739549c09b6c5933e5b752cc158f7403",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.12": "029fa66e7293dcc6bcadcb3f78c6ce126a49e5c3d5824e78321450ab67a8e501",
|
|
||||||
"i686-pc-windows-msvc-0.13.12": "5fa7d60af5e2bbb8e6e2ebae0bea351c3613125f63a71fadf5bd599eceed8d1d",
|
|
||||||
"i686-unknown-linux-gnu-0.13.12": "98903540af249f6f696be945d4af70505f0b6fadae83f3f63af0beeca8391c23",
|
|
||||||
"i686-unknown-linux-musl-0.13.12": "8a71524fdfebfb66c40d14e5ff7ed42654d7827f3c62028f55858b32257389d9",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.12": "f018f4347a357c53a867cfffa6ce8f6738cf6a3717f9f2279d9837eb37935fa1",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.12": "900301c8cfbd172ad3ef0e546faee7d761dd039047e13105696b0147320dba68",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.12": "790f8e93727338f8c18e75a965604dbf2950d149a6d2e55428b8a267721f0f09",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.12": "0ce1ecdcb1abc4359ab9aae7bad3804294a681a56701735e889c0571f322a4b6",
|
|
||||||
"x86_64-apple-darwin-0.13.12": "ed4e96c5b2c69dc1d3f0866ad5e3b659eeb6bd3e0f2dcf60b7c7d8fa39e77e72",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.12": "12c4aa5774d2924cbc8b9b7a6b351951f9dfc5d7f11995742ed558434114bd1d",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.12": "0bc2e0afabc7791518b20545e54bc5dec8c401b4063ce4b5060133a73210f8ee",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.12": "0161ae6528adaf5e9d4520bdbe8d55f88de35a3ee6e1ec2db6da9b0358e859f1",
|
|
||||||
"aarch64-apple-darwin-0.13.11": "616883f2325f29ae6788147da00ad262cadd54eae17c8c79c61f848697deefbd",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.11": "5713e09f307eca35e4dbf01decf0890938286837746995b43c818f2ad9930ab0",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.11": "93abb5e26e6230ed38085027eb0bea73304c157d0313607a662bc92dbdd1b64c",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.11": "8df6512348fef63198c105f57bf413bb87b90ecef431663e1ad838906be38929",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.11": "6a8121c2e27f6a064f1ff2c409efc067d27eb33d8840d507debee46a1b9ca88e",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.11": "ce03fe2f466697b98a93160071a5d2b17786299ee65828991cd32f44d5409272",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.11": "9141c9837f24954d42a09fe1c20c006073e2ac0320d54c1893859e996c597d04",
|
|
||||||
"i686-pc-windows-msvc-0.13.11": "06cc6bedb38929eb50073f93ef47af13c6e1cc83b7b77a66f1020ecd49dde5e9",
|
|
||||||
"i686-unknown-linux-gnu-0.13.11": "5f0c33eeb542975d2b717ca3ae12ac1d97153e52f7e0da98fc0430cfbb3c9220",
|
|
||||||
"i686-unknown-linux-musl-0.13.11": "2ea3656dbba9fb7688da4e062cd74606cd868d360b3661c0493a1b8cee026e4e",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.11": "b820136eec9f2bfb07e7e636913f761362a9c20225243249a1d1957a20b4b839",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.11": "855de3eaf539915580ac47f0782ceae644545fd7cd52e35a4ecf3ba3980475e0",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.11": "f0fcb13d128a65f02bdd21d38e30f17476f44e119e24701a30b90befb34c19c3",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.11": "c349bdffb298217df4f0333011a33d32f0f9da0ce7631b91aef745940d621f58",
|
|
||||||
"x86_64-apple-darwin-0.13.11": "f93134a5a7dd5b7f157e90c7ba1658576f8dabeb30783f24db33d933dae92ac7",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.11": "a3d41202a941be98284f1bd00dd469e9a2450e2207885b1db85b8680ba843b8b",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.11": "302504ac093f11a479d0618c2ebacd08ebeae16eb396b95a306a303a1a5ae6e3",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.11": "f6cdb8acb566d9d6fa1a700ec4ad8de35f2b6a3a8fe20d8f28774a1972ca694f",
|
|
||||||
"aarch64-apple-darwin-0.13.10": "e419bf07533bdbf48795fc793601c834dd79db57a8c49ce8e25cfe3a8639958d",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.10": "f223bcd3fa010174ffeeb885cc1d5334bb81388640c65baa5b8b42b47017337e",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.10": "14590f644805a6234ffe071154340669e38137f38e60aa9629690119704107d2",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.10": "68174084fe40b6300361c5b2038066120dc62c92920c22a0f31f6fc74b066b57",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.10": "804708f73ca25cbb63ec63fe645b7eaa84b5abf05c2035191434e4417d2cc38e",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.10": "ab7a68a76962f7403fe66418c4a005e0b17d822518f7fea9d3c1bd036e8f530f",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.10": "f6980b09607379c9974241da2ae11bde7960010d2f9b7a21099fae67ffbad30a",
|
|
||||||
"i686-pc-windows-msvc-0.13.10": "ea400c4d77a201e300b986387d83a65b26080bd5154b90e339de73395b08ce84",
|
|
||||||
"i686-unknown-linux-gnu-0.13.10": "621ae75ab65facd2c6eec13b73173f726a0aa1ddc8133b4047d1423a6c33e55c",
|
|
||||||
"i686-unknown-linux-musl-0.13.10": "f33b8e6753bc873e047fe58e48edddd42cca82d528648810031dd4b0b44c3170",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.10": "4173e6edf7630a655497969dad32cf7788f6a7b4f0d8d51b654650ea0b16ddb1",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.10": "cad2291ff12d9adee6673be5c5389eecf86d2a92d8d227826fbfe66462aebe5c",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.10": "1f177435625d0e56aafb565f8ffbabb18fa3cf76364f57eec4cc1d606f51df35",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.10": "175449a8d5dca11f3f964afe712c63f0db966da0ea7ecf500b6cb7913c9f1b23",
|
|
||||||
"x86_64-apple-darwin-0.13.10": "153e03197588204c04fc4c81cc4bafbfa4280222a385e4ee36a87aeec0ae63b4",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.10": "297b3881fe1adfb922becc2c1613202abb41dc83ea5ff43d472aa087ca1f8683",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.10": "bf65ac1a0af10f92c522d91ac096c7c0a39657647b155577e7836c2cbbb4526c",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.10": "5597970380083a340b7983af05a84824b4db1c62b7059c796935b7fd6dc95fd2",
|
|
||||||
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
|
|
||||||
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
|
|
||||||
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
|
|
||||||
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
|
|
||||||
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
|
|
||||||
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
|
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
|
||||||
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
|
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
|
||||||
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
|
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
|
||||||
@@ -53733,6 +53661,10 @@ async function updateChecksums(filePath, checksumEntries) {
|
|||||||
var import_node_readline = require("node:readline");
|
var import_node_readline = require("node:readline");
|
||||||
var import_node_stream = require("node:stream");
|
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";
|
||||||
|
|
||||||
// src/utils/fetch.ts
|
// src/utils/fetch.ts
|
||||||
var import_undici2 = __toESM(require_undici2(), 1);
|
var import_undici2 = __toESM(require_undici2(), 1);
|
||||||
var fetch = async (url, opts) => {
|
var fetch = async (url, opts) => {
|
||||||
@@ -53761,18 +53693,18 @@ function info2(msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/download/manifest.ts
|
// src/download/manifest.ts
|
||||||
var cachedManifestData = /* @__PURE__ */ new WeakMap();
|
var cachedManifestData = /* @__PURE__ */ new Map();
|
||||||
var MANIFEST_FETCH_ATTEMPTS = 3;
|
var MANIFEST_FETCH_ATTEMPTS = 3;
|
||||||
async function fetchManifest(source) {
|
async function fetchManifest(manifestUrl = VERSIONS_MANIFEST_URL) {
|
||||||
const cachedManifest = cachedManifestData.get(source);
|
const cachedManifest = cachedManifestData.get(manifestUrl);
|
||||||
if (cachedManifest?.complete === true) {
|
if (cachedManifest?.complete === true) {
|
||||||
debug(`Using cached manifest data from ${source.url}`);
|
debug(`Using cached manifest data from ${manifestUrl}`);
|
||||||
return cachedManifest.versions;
|
return cachedManifest.versions;
|
||||||
}
|
}
|
||||||
const response = await fetchManifestResponse(source);
|
const response = await fetchManifestResponse(manifestUrl);
|
||||||
const body = await response.text();
|
const body = await response.text();
|
||||||
const versions = parseManifest(body, source.url);
|
const versions = parseManifest(body, manifestUrl);
|
||||||
cachedManifestData.set(source, { complete: true, versions });
|
cachedManifestData.set(manifestUrl, { complete: true, versions });
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
function parseManifest(data, sourceDescription) {
|
function parseManifest(data, sourceDescription) {
|
||||||
@@ -53794,24 +53726,25 @@ function parseManifest(data, sourceDescription) {
|
|||||||
}
|
}
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
async function getFirstVersion(source) {
|
async function getLatestVersion(manifestUrl = VERSIONS_MANIFEST_URL) {
|
||||||
const version = (await findManifestVersion(source, () => true))?.version;
|
const latestVersion = manifestUrl === VERSIONS_MANIFEST_URL ? (await findManifestVersion(() => true))?.version : (await fetchManifest(manifestUrl))[0]?.version;
|
||||||
if (version === void 0) {
|
if (latestVersion === void 0) {
|
||||||
throw new Error("No versions found in manifest data");
|
throw new Error("No versions found in manifest data");
|
||||||
}
|
}
|
||||||
return version;
|
debug(`Latest version from manifest: ${latestVersion}`);
|
||||||
|
return latestVersion;
|
||||||
}
|
}
|
||||||
async function fetchManifestResponse(source) {
|
async function fetchManifestResponse(manifestUrl) {
|
||||||
try {
|
try {
|
||||||
return await fetchManifestResponseFromUrl(source.url);
|
return await fetchManifestResponseFromUrl(manifestUrl);
|
||||||
} catch (error2) {
|
} catch (error2) {
|
||||||
if (source.fallbackUrl === void 0) {
|
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
|
||||||
throw error2;
|
throw error2;
|
||||||
}
|
}
|
||||||
info2(
|
info2(
|
||||||
`Failed to fetch manifest from ${source.url}, falling back to ${source.fallbackUrl}: ${error2.message}`
|
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${error2.message}`
|
||||||
);
|
);
|
||||||
return await fetchManifestResponseFromUrl(source.fallbackUrl);
|
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function fetchManifestResponseFromUrl(manifestUrl) {
|
async function fetchManifestResponseFromUrl(manifestUrl) {
|
||||||
@@ -53840,19 +53773,19 @@ async function fetchManifestResponseFromUrl(manifestUrl) {
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
async function findManifestVersion(source, predicate) {
|
async function findManifestVersion(predicate) {
|
||||||
if (!source.newestFirst) {
|
const cachedManifest = cachedManifestData.get(VERSIONS_MANIFEST_URL);
|
||||||
return (await fetchManifest(source)).find(predicate);
|
|
||||||
}
|
|
||||||
const cachedManifest = cachedManifestData.get(source);
|
|
||||||
const cachedVersion = cachedManifest?.versions.find(predicate);
|
const cachedVersion = cachedManifest?.versions.find(predicate);
|
||||||
if (cachedVersion !== void 0 || cachedManifest?.complete === true) {
|
if (cachedVersion !== void 0 || cachedManifest?.complete === true) {
|
||||||
return cachedVersion;
|
return cachedVersion;
|
||||||
}
|
}
|
||||||
const response = await fetchManifestResponse(source);
|
const response = await fetchManifestResponse(VERSIONS_MANIFEST_URL);
|
||||||
if (response.body === null) {
|
if (response.body === null) {
|
||||||
const versions2 = parseManifest(await response.text(), source.url);
|
const versions2 = parseManifest(
|
||||||
cachedManifestData.set(source, {
|
await response.text(),
|
||||||
|
VERSIONS_MANIFEST_URL
|
||||||
|
);
|
||||||
|
cachedManifestData.set(VERSIONS_MANIFEST_URL, {
|
||||||
complete: true,
|
complete: true,
|
||||||
versions: versions2
|
versions: versions2
|
||||||
});
|
});
|
||||||
@@ -53872,9 +53805,13 @@ async function findManifestVersion(source, predicate) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (versions.length === 0) {
|
if (versions.length === 0) {
|
||||||
rejectLegacyManifest(record, source.url);
|
rejectLegacyManifest(record, VERSIONS_MANIFEST_URL);
|
||||||
}
|
}
|
||||||
const versionData = parseManifestRecord(record, source.url, lineNumber);
|
const versionData = parseManifestRecord(
|
||||||
|
record,
|
||||||
|
VERSIONS_MANIFEST_URL,
|
||||||
|
lineNumber
|
||||||
|
);
|
||||||
versions.push(versionData);
|
versions.push(versionData);
|
||||||
if (predicate(versionData)) {
|
if (predicate(versionData)) {
|
||||||
matchedVersion = versionData;
|
matchedVersion = versionData;
|
||||||
@@ -53889,9 +53826,9 @@ async function findManifestVersion(source, predicate) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (versions.length === 0) {
|
if (versions.length === 0) {
|
||||||
throw new Error(`Manifest at ${source.url} is empty.`);
|
throw new Error(`Manifest at ${VERSIONS_MANIFEST_URL} is empty.`);
|
||||||
}
|
}
|
||||||
cachedManifestData.set(source, { complete, versions });
|
cachedManifestData.set(VERSIONS_MANIFEST_URL, { complete, versions });
|
||||||
return matchedVersion;
|
return matchedVersion;
|
||||||
}
|
}
|
||||||
function parseManifestRecord(record, sourceDescription, lineNumber) {
|
function parseManifestRecord(record, sourceDescription, lineNumber) {
|
||||||
@@ -53937,16 +53874,6 @@ function isRecord(value) {
|
|||||||
return typeof value === "object" && value !== null;
|
return typeof value === "object" && value !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/utils/inputs.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 ASTRAL_MANIFEST = {
|
|
||||||
custom: false,
|
|
||||||
fallbackUrl: GITHUB_VERSIONS_MANIFEST_URL,
|
|
||||||
newestFirst: true,
|
|
||||||
url: VERSIONS_MANIFEST_URL
|
|
||||||
};
|
|
||||||
|
|
||||||
// src/update-known-checksums.ts
|
// src/update-known-checksums.ts
|
||||||
async function run() {
|
async function run() {
|
||||||
const checksumFilePath = process.argv.slice(2)[0];
|
const checksumFilePath = process.argv.slice(2)[0];
|
||||||
@@ -53955,7 +53882,7 @@ async function run() {
|
|||||||
"Missing checksum file path. Usage: node dist/update-known-checksums/index.cjs <checksum-file-path>"
|
"Missing checksum file path. Usage: node dist/update-known-checksums/index.cjs <checksum-file-path>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const latestVersion = await getFirstVersion(ASTRAL_MANIFEST);
|
const latestVersion = await getLatestVersion();
|
||||||
const latestKnownVersion = getLatestKnownVersion();
|
const latestKnownVersion = getLatestKnownVersion();
|
||||||
if (semver2.lte(latestVersion, latestKnownVersion)) {
|
if (semver2.lte(latestVersion, latestKnownVersion)) {
|
||||||
info2(
|
info2(
|
||||||
@@ -53963,7 +53890,7 @@ async function run() {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const versions = await fetchManifest(ASTRAL_MANIFEST);
|
const versions = await fetchManifest();
|
||||||
const checksumEntries = extractChecksumsFromManifest(versions);
|
const checksumEntries = extractChecksumsFromManifest(versions);
|
||||||
await updateChecksums(checksumFilePath, checksumEntries);
|
await updateChecksums(checksumFilePath, checksumEntries);
|
||||||
setOutput("latest-version", latestVersion);
|
setOutput("latest-version", latestVersion);
|
||||||
@@ -53990,41 +53917,4 @@ undici/lib/web/fetch/body.js:
|
|||||||
undici/lib/web/websocket/frame.js:
|
undici/lib/web/websocket/frame.js:
|
||||||
undici/lib/web/websocket/frame.js:
|
undici/lib/web/websocket/frame.js:
|
||||||
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
||||||
|
|
||||||
smol-toml/dist/date.js:
|
|
||||||
smol-toml/dist/error.js:
|
|
||||||
smol-toml/dist/util.js:
|
|
||||||
smol-toml/dist/primitive.js:
|
|
||||||
smol-toml/dist/extract.js:
|
|
||||||
smol-toml/dist/struct.js:
|
|
||||||
smol-toml/dist/parse.js:
|
|
||||||
smol-toml/dist/stringify.js:
|
|
||||||
smol-toml/dist/index.js:
|
|
||||||
(*!
|
|
||||||
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*)
|
|
||||||
*/
|
*/
|
||||||
@@ -6,7 +6,7 @@ This document covers advanced options for configuring which version of uv to ins
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
```
|
```
|
||||||
@@ -15,13 +15,11 @@ This document covers advanced options for configuring which version of uv to ins
|
|||||||
|
|
||||||
Use `latest-known` to install the newest uv version whose checksums were bundled with the version of setup-uv used by your workflow. Version resolution is performed locally without fetching the latest release, so updating setup-uv also updates the version selected by `latest-known`.
|
Use `latest-known` to install the newest uv version whose checksums were bundled with the version of setup-uv used by your workflow. Version resolution is performed locally without fetching the latest release, so updating setup-uv also updates the version selected by `latest-known`.
|
||||||
|
|
||||||
When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table.
|
When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table, but the artifact and checksum come from the custom manifest.
|
||||||
By default the custom manifest supplies the artifact and checksum. To require a bundled or explicitly
|
|
||||||
supplied checksum, enable `require-checksums`. [Checksum validation](customization.md#validate-checksum)
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv known to setup-uv
|
- name: Install the latest version of uv known to setup-uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: "latest-known"
|
version: "latest-known"
|
||||||
```
|
```
|
||||||
@@ -30,7 +28,7 @@ supplied checksum, enable `require-checksums`. [Checksum validation](customizati
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a specific version of uv
|
- name: Install a specific version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: "0.4.4"
|
version: "0.4.4"
|
||||||
```
|
```
|
||||||
@@ -43,21 +41,21 @@ to install the latest version that satisfies the range.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a semver range of uv
|
- name: Install a semver range of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: ">=0.4.0"
|
version: ">=0.4.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Pinning a minor version of uv
|
- name: Pinning a minor version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: "0.4.x"
|
version: "0.4.x"
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a pep440-specifier-satisfying version of uv
|
- name: Install a pep440-specifier-satisfying version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: ">=0.4.25,<0.5"
|
version: ">=0.4.25,<0.5"
|
||||||
```
|
```
|
||||||
@@ -69,7 +67,7 @@ You can change this behavior using the `resolution-strategy` input:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the lowest compatible version of uv
|
- name: Install the lowest compatible version of uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: ">=0.4.0"
|
version: ">=0.4.0"
|
||||||
resolution-strategy: "lowest"
|
resolution-strategy: "lowest"
|
||||||
@@ -94,7 +92,7 @@ as `UV_PYTHON`. Only a single Python version is supported; multiple fallback ver
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install uv based on the version defined in pyproject.toml
|
- name: Install uv based on the version defined in pyproject.toml
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version-file: "pyproject.toml"
|
version-file: "pyproject.toml"
|
||||||
```
|
```
|
||||||
@@ -105,7 +103,7 @@ silently picking up a newer uv until the lockfile is updated.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install uv based on the version locked in uv.lock
|
- name: Install uv based on the version locked in uv.lock
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version-file: "uv.lock"
|
version-file: "uv.lock"
|
||||||
```
|
```
|
||||||
+12
-12
@@ -24,7 +24,7 @@ The computed cache key is available as the `cache-key` output:
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Setup uv
|
- name: Setup uv
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Print cache key
|
- name: Print cache key
|
||||||
@@ -54,7 +54,7 @@ You can optionally define a custom cache key suffix.
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Enable caching and define a custom cache key suffix
|
- name: Enable caching and define a custom cache key suffix
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-suffix: "optional-suffix"
|
cache-suffix: "optional-suffix"
|
||||||
@@ -93,7 +93,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define a cache dependency glob
|
- name: Define a cache dependency glob
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: "**/pyproject.toml"
|
cache-dependency-glob: "**/pyproject.toml"
|
||||||
@@ -101,7 +101,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define a list of cache dependency globs
|
- name: Define a list of cache dependency globs
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: |
|
cache-dependency-glob: |
|
||||||
@@ -111,7 +111,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define an absolute cache dependency glob
|
- name: Define an absolute cache dependency glob
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
|
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
|
```yaml
|
||||||
- name: Never invalidate the cache
|
- name: Never invalidate the cache
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: ""
|
cache-dependency-glob: ""
|
||||||
@@ -132,7 +132,7 @@ By default, the cache will be restored.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Don't restore an existing cache
|
- name: Don't restore an existing cache
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
restore-cache: false
|
restore-cache: false
|
||||||
@@ -148,7 +148,7 @@ these events. Set `save-cache: true` to save the cache for all events.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Don't save the cache after the run
|
- name: Don't save the cache after the run
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
save-cache: false
|
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
|
```yaml
|
||||||
- name: Define a custom uv cache path
|
- name: Define a custom uv cache path
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
cache-local-path: "/path/to/cache"
|
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
|
```yaml
|
||||||
- name: Prune the cache before saving it
|
- name: Prune the cache before saving it
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
prune-cache: true
|
prune-cache: true
|
||||||
@@ -210,7 +210,7 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Cache Python installs
|
- name: Cache Python installs
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-python: true
|
cache-python: true
|
||||||
@@ -228,7 +228,7 @@ If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Ignore nothing to cache
|
- name: Ignore nothing to cache
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
ignore-nothing-to-cache: true
|
ignore-nothing-to-cache: true
|
||||||
|
|||||||
+5
-29
@@ -4,52 +4,28 @@ This document covers advanced customization options including checksum validatio
|
|||||||
|
|
||||||
## Validate checksum
|
## Validate checksum
|
||||||
|
|
||||||
Downloaded archives are automatically verified using checksums bundled with this action or,
|
Downloaded executables are automatically verified using checksums bundled with this action or,
|
||||||
for newer, not yet bundled versions, the checksum from [`astral-sh/versions`](https://github.com/astral-sh/versions).
|
for newer, not yet bundled versions, the checksum from [`astral-sh/versions`](https://github.com/astral-sh/versions).
|
||||||
You can specify a checksum to override those values. The sha256 hashes can also be found on the
|
You can specify a checksum to override those values. The sha256 hashes can also be found on the
|
||||||
[releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
|
[releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a specific version and validate the checksum
|
- name: Install a specific version and validate the checksum
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
version: "0.3.1"
|
version: "0.3.1"
|
||||||
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
||||||
```
|
```
|
||||||
|
|
||||||
For an additional layer of protection, you can set `require-checksums: true`.
|
|
||||||
This prevents setup-uv from trusting an unknown version's checksum from
|
|
||||||
[`astral-sh/versions`](https://github.com/astral-sh/versions) *unless* it is also
|
|
||||||
present in the action's own bundled data *or* explicitly provided with `checksum`.
|
|
||||||
|
|
||||||
This can be combined with `version: latest-known` to select the newest bundled release,
|
|
||||||
meaning that this newer requires an external checksum source:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Install the latest known version of uv
|
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
|
||||||
with:
|
|
||||||
version: latest-known
|
|
||||||
require-checksums: true
|
|
||||||
```
|
|
||||||
|
|
||||||
With this mode, you'll need to update setup-uv itself to get newer uv versions
|
|
||||||
*unless* you explicitly pass in a `checksum` with a version that post-dates the setup-uv
|
|
||||||
release.
|
|
||||||
|
|
||||||
On runners with a persistent tool cache, this mode reuses only installations previously verified
|
|
||||||
against the same digest. The first run may download uv again.
|
|
||||||
|
|
||||||
## Manifest file
|
## Manifest file
|
||||||
|
|
||||||
By default, setup-uv reads version metadata from
|
By default, setup-uv reads version metadata from
|
||||||
the [Astral mirror](https://releases.astral.sh/github/versions/main/v1/uv.ndjson).
|
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).
|
If the mirror request fails, it falls back to [`astral-sh/versions`](https://github.com/astral-sh/versions).
|
||||||
Set `download-from-astral-mirror: false` to fetch the default manifest and uv release archives directly from GitHub.
|
|
||||||
|
|
||||||
The `manifest-file` input lets you override that source with your own URL, for example to test
|
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
|
custom uv builds or alternate download locations. Custom manifest URLs do not fall back to the
|
||||||
default sources. The mirror setting does not change the custom manifest URL.
|
default sources.
|
||||||
|
|
||||||
### Format
|
### Format
|
||||||
|
|
||||||
@@ -66,7 +42,7 @@ The `archive_format` field is currently ignored.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Use a custom manifest file
|
- name: Use a custom manifest file
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
manifest-file: "https://example.com/my-custom-manifest.ndjson"
|
manifest-file: "https://example.com/my-custom-manifest.ndjson"
|
||||||
```
|
```
|
||||||
@@ -85,7 +61,7 @@ You can disable this by setting the `add-problem-matchers` input to `false`.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv without problem matchers
|
- name: Install the latest version of uv without problem matchers
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
add-problem-matchers: false
|
add-problem-matchers: false
|
||||||
```
|
```
|
||||||
@@ -9,7 +9,7 @@ This allows directly using it in later steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv and activate the environment
|
- name: Install the latest version of uv and activate the environment
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
activate-environment: true
|
activate-environment: true
|
||||||
- run: uv pip install pip
|
- 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:
|
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
activate-environment: true
|
activate-environment: true
|
||||||
venv-path: ${{ runner.temp }}/custom-venv
|
venv-path: ${{ runner.temp }}/custom-venv
|
||||||
@@ -64,7 +64,7 @@ are not sufficient, you can provide a custom GitHub token with the necessary per
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom GitHub token
|
- name: Install the latest version of uv with a custom GitHub token
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -82,7 +82,7 @@ input:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom tool dir
|
- name: Install the latest version of uv with a custom tool dir
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
tool-dir: "/path/to/tool/dir"
|
tool-dir: "/path/to/tool/dir"
|
||||||
```
|
```
|
||||||
@@ -101,7 +101,7 @@ If you want to change this behaviour (especially on self-hosted runners) you can
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom tool bin dir
|
- name: Install the latest version of uv with a custom tool bin dir
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
tool-bin-dir: "/path/to/tool-bin/dir"
|
tool-bin-dir: "/path/to/tool-bin/dir"
|
||||||
```
|
```
|
||||||
@@ -118,7 +118,7 @@ This action supports expanding the `~` character to the user's home directory fo
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Expand the tilde character
|
- name: Expand the tilde character
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
cache-local-path: "~/path/to/cache"
|
cache-local-path: "~/path/to/cache"
|
||||||
tool-dir: "~/path/to/tool/dir"
|
tool-dir: "~/path/to/tool/dir"
|
||||||
@@ -135,7 +135,7 @@ If you want to ignore this, set the `ignore-empty-workdir` input to `true`.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Ignore empty workdir
|
- name: Ignore empty workdir
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
ignore-empty-workdir: true
|
ignore-empty-workdir: true
|
||||||
```
|
```
|
||||||
@@ -161,7 +161,7 @@ This action sets several environment variables that influence uv's behavior and
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Example using environment variables
|
- name: Example using environment variables
|
||||||
uses: astral-sh/setup-uv@2a39bcff78b189a5800d31cfcf0205c7a3e8381e # v10.4.1
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
tool-dir: "/custom/tool/dir"
|
tool-dir: "/custom/tool/dir"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Material failures are unauthorized executable selection, credential disclosure,
|
|||||||
### Security invariants
|
### Security invariants
|
||||||
|
|
||||||
1. **Published runtime:** review `action.yml`, committed `dist/*.cjs`, and runner-interpreted shipped files; source-only fixes do not protect consumers.
|
1. **Published runtime:** review `action.yml`, committed `dist/*.cjs`, and runner-interpreted shipped files; source-only fixes do not protect consumers.
|
||||||
2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance. With `require-checksums`, only entries keyed by the explicit or bundled archive digest are eligible.
|
2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance.
|
||||||
3. **Credential recipients:** tokens and URL credentials may reach only workflow-authorized origins, redirects, paths, and logs. Metadata authority does not imply token-recipient authority.
|
3. **Credential recipients:** tokens and URL credentials may reach only workflow-authorized origins, redirects, paths, and logs. Metadata authority does not imply token-recipient authority.
|
||||||
4. **Executable boundaries:** checkout-selected interpreters are authorized by default. Explicit workflow selections must win, and independent cache, runner, or remote state must not substitute executables or gain additional authority.
|
4. **Executable boundaries:** checkout-selected interpreters are authorized by default. Explicit workflow selections must win, and independent cache, runner, or remote state must not substitute executables or gain additional authority.
|
||||||
5. **Paths and action channels:** path/environment changes, virtual-environment clearing, outputs, state, and problem matchers must affect only authorized targets and keep untrusted values as data.
|
5. **Paths and action channels:** path/environment changes, virtual-environment clearing, outputs, state, and problem matchers must affect only authorized targets and keep untrusted values as data.
|
||||||
|
|||||||
Generated
+71
-71
@@ -20,7 +20,7 @@
|
|||||||
"undici": "^8.11.0"
|
"undici": "^8.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.5.14",
|
"@biomejs/biome": "^2.5.15",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/node": "^26.6.2",
|
"@types/node": "^26.6.2",
|
||||||
"@types/semver": "^7.8.0",
|
"@types/semver": "^7.8.0",
|
||||||
@@ -912,9 +912,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/biome": {
|
"node_modules/@biomejs/biome": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.15.tgz",
|
||||||
"integrity": "sha512-0FabLIjd4M/dm8VFI86RMaLLdgepzbdfiAL2R8cr7V81OYYrP1w7Z73KfAwPK5h9SrEBXTzNG2y+mBwPo9xRnw==",
|
"integrity": "sha512-WZTW4slm/pdkh92K6t/3aEN++44JD1PQ7squ7RCMLI1flHGl43DVOIGXvCjHiZgBMO1V4uYxoFNtqrIA4qGuIQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT OR Apache-2.0",
|
"license": "MIT OR Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -928,20 +928,20 @@
|
|||||||
"url": "https://opencollective.com/biome"
|
"url": "https://opencollective.com/biome"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@biomejs/cli-darwin-arm64": "2.5.14",
|
"@biomejs/cli-darwin-arm64": "2.5.15",
|
||||||
"@biomejs/cli-darwin-x64": "2.5.14",
|
"@biomejs/cli-darwin-x64": "2.5.15",
|
||||||
"@biomejs/cli-linux-arm64": "2.5.14",
|
"@biomejs/cli-linux-arm64": "2.5.15",
|
||||||
"@biomejs/cli-linux-arm64-musl": "2.5.14",
|
"@biomejs/cli-linux-arm64-musl": "2.5.15",
|
||||||
"@biomejs/cli-linux-x64": "2.5.14",
|
"@biomejs/cli-linux-x64": "2.5.15",
|
||||||
"@biomejs/cli-linux-x64-musl": "2.5.14",
|
"@biomejs/cli-linux-x64-musl": "2.5.15",
|
||||||
"@biomejs/cli-win32-arm64": "2.5.14",
|
"@biomejs/cli-win32-arm64": "2.5.15",
|
||||||
"@biomejs/cli-win32-x64": "2.5.14"
|
"@biomejs/cli-win32-x64": "2.5.15"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-darwin-arm64": {
|
"node_modules/@biomejs/cli-darwin-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-UnzaXO65L4tsZimFITFP2M121GyhDcWFrT3pL5ZJ5U4XcS/0L5VHYytVohdCf/gnDUFHgl2I9xnt5bV/J1kxHQ==",
|
"integrity": "sha512-BZVzFhJ/mUvTLMYbc9x6el0o2Uv5zP7bACYyhFb6fSc1giroXm7PL0a5KqMJ9F+/BnkYRjagD/ROSDVOZ6eapg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -956,9 +956,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-darwin-x64": {
|
"node_modules/@biomejs/cli-darwin-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-kiy8qA16K93J7uvFfWi4LgjqDpnRKyePAna6A0Y4jxyUga35SYpIZ2cNWlhy0lsfgqRenCpfymnJWEZ6mgpRgA==",
|
"integrity": "sha512-V5Kw63V+fVGNFhFrizDxMbGXAzZCh8kYzJpy3GI6gTapWDg7bZK9oYC9CbVgQSEdTnupz0U5Efz8Ev+5vdBBXw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -973,9 +973,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-arm64": {
|
"node_modules/@biomejs/cli-linux-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-vO/9BaU1n30CiFNLx49gMTMtbCAAqlo/EqFoG0BU3deQInTbJrmXSmTQ9e3FoDZIKQnvSLDVNL4lx1ci7y1T1Q==",
|
"integrity": "sha512-XaG7P7eeSLYETD3K9grfB0mQmpLQZjygdbsxekWBJAg4am79fGAtRpfRyNnTvXB2fZFNnJZG3nXm7HBat0+VUw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -993,9 +993,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.15.tgz",
|
||||||
"integrity": "sha512-SJ9PrZkBnnH9dHJDnxk34vKs0GB2dbsioaft6/hPhWJ7AHpwYH83Isnhj0FSRpFkGgpVfJ1lds23ApB2czUDLQ==",
|
"integrity": "sha512-tGzZUTcJCV7tj5Adh/Gn6nR4MycqA3iohq2LEcrarAgRBkU0h0OKd2UzCRkOsOYOuUGaUJb4YmqRqyy2feGGSw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1013,9 +1013,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-x64": {
|
"node_modules/@biomejs/cli-linux-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-VHZRa7CCQBUWKxNwUvHJeuW03WFRgN5NWO//SDGOitc9QIeNyfA42V9zlKm+x82xFSG9Bzi5fi+hbhm9anO8yA==",
|
"integrity": "sha512-xE4iEW/3LqlYj9GFgGrFsFSH51dEEpUbYWBfeOv0q87WkUDxK2o/HhreSb7qMJqck70RVM6Lg96hgedcAYcOkA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1033,9 +1033,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-linux-x64-musl": {
|
"node_modules/@biomejs/cli-linux-x64-musl": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.15.tgz",
|
||||||
"integrity": "sha512-2kI5PrMgW5dcEZYrstLPmUmCwkUwZY39rP4BN93Vxbwcs2O57LDQOktUZZYPvvspN5i0mhGr3TJtF5sU26NUWg==",
|
"integrity": "sha512-IlxUcyxilVGPsE008x13pWdkTbU3nQpP2i9b5UrbOYj6goBkKsRX1XB7yJLcV+O1H9LBchIIm4adOaVLZBX0ZQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1053,9 +1053,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-win32-arm64": {
|
"node_modules/@biomejs/cli-win32-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-pHgAFffmZtaYoxavEsWEYNvcA7NwOIjLyqw2HXyLbt16xYryX0L4fMV2u0G9ag6LNYPIoqWaWqzUcnc6rLGGXg==",
|
"integrity": "sha512-2kPKzhNlm8C+Ru3GcO0Me2ODkCBLrVOUNuyi84RJyWDVKAA4+Kjj3jMjL938lF6BRfvltC4vB2nPY9SvN51Ovg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1070,9 +1070,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@biomejs/cli-win32-x64": {
|
"node_modules/@biomejs/cli-win32-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-oJWmBhoHsnhUKIke+0gXDX0mltJrWHA1UyHsrTlXwX0TL64ilVZAo+TYZm97baecV0esBdpzy3k96q+09JaZUQ==",
|
"integrity": "sha512-yAzh4UqEImV6Hcy0zjUqNfJAsUhoD64FBQCdTG8Md/Z2wQeVP/ZmJ3XRYAs1g8J9fjTFyl2fCtc5FB5til47+g==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -6610,74 +6610,74 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@biomejs/biome": {
|
"@biomejs/biome": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.15.tgz",
|
||||||
"integrity": "sha512-0FabLIjd4M/dm8VFI86RMaLLdgepzbdfiAL2R8cr7V81OYYrP1w7Z73KfAwPK5h9SrEBXTzNG2y+mBwPo9xRnw==",
|
"integrity": "sha512-WZTW4slm/pdkh92K6t/3aEN++44JD1PQ7squ7RCMLI1flHGl43DVOIGXvCjHiZgBMO1V4uYxoFNtqrIA4qGuIQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@biomejs/cli-darwin-arm64": "2.5.14",
|
"@biomejs/cli-darwin-arm64": "2.5.15",
|
||||||
"@biomejs/cli-darwin-x64": "2.5.14",
|
"@biomejs/cli-darwin-x64": "2.5.15",
|
||||||
"@biomejs/cli-linux-arm64": "2.5.14",
|
"@biomejs/cli-linux-arm64": "2.5.15",
|
||||||
"@biomejs/cli-linux-arm64-musl": "2.5.14",
|
"@biomejs/cli-linux-arm64-musl": "2.5.15",
|
||||||
"@biomejs/cli-linux-x64": "2.5.14",
|
"@biomejs/cli-linux-x64": "2.5.15",
|
||||||
"@biomejs/cli-linux-x64-musl": "2.5.14",
|
"@biomejs/cli-linux-x64-musl": "2.5.15",
|
||||||
"@biomejs/cli-win32-arm64": "2.5.14",
|
"@biomejs/cli-win32-arm64": "2.5.15",
|
||||||
"@biomejs/cli-win32-x64": "2.5.14"
|
"@biomejs/cli-win32-x64": "2.5.15"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@biomejs/cli-darwin-arm64": {
|
"@biomejs/cli-darwin-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-UnzaXO65L4tsZimFITFP2M121GyhDcWFrT3pL5ZJ5U4XcS/0L5VHYytVohdCf/gnDUFHgl2I9xnt5bV/J1kxHQ==",
|
"integrity": "sha512-BZVzFhJ/mUvTLMYbc9x6el0o2Uv5zP7bACYyhFb6fSc1giroXm7PL0a5KqMJ9F+/BnkYRjagD/ROSDVOZ6eapg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-darwin-x64": {
|
"@biomejs/cli-darwin-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-kiy8qA16K93J7uvFfWi4LgjqDpnRKyePAna6A0Y4jxyUga35SYpIZ2cNWlhy0lsfgqRenCpfymnJWEZ6mgpRgA==",
|
"integrity": "sha512-V5Kw63V+fVGNFhFrizDxMbGXAzZCh8kYzJpy3GI6gTapWDg7bZK9oYC9CbVgQSEdTnupz0U5Efz8Ev+5vdBBXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-linux-arm64": {
|
"@biomejs/cli-linux-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-vO/9BaU1n30CiFNLx49gMTMtbCAAqlo/EqFoG0BU3deQInTbJrmXSmTQ9e3FoDZIKQnvSLDVNL4lx1ci7y1T1Q==",
|
"integrity": "sha512-XaG7P7eeSLYETD3K9grfB0mQmpLQZjygdbsxekWBJAg4am79fGAtRpfRyNnTvXB2fZFNnJZG3nXm7HBat0+VUw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-linux-arm64-musl": {
|
"@biomejs/cli-linux-arm64-musl": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.15.tgz",
|
||||||
"integrity": "sha512-SJ9PrZkBnnH9dHJDnxk34vKs0GB2dbsioaft6/hPhWJ7AHpwYH83Isnhj0FSRpFkGgpVfJ1lds23ApB2czUDLQ==",
|
"integrity": "sha512-tGzZUTcJCV7tj5Adh/Gn6nR4MycqA3iohq2LEcrarAgRBkU0h0OKd2UzCRkOsOYOuUGaUJb4YmqRqyy2feGGSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-linux-x64": {
|
"@biomejs/cli-linux-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-VHZRa7CCQBUWKxNwUvHJeuW03WFRgN5NWO//SDGOitc9QIeNyfA42V9zlKm+x82xFSG9Bzi5fi+hbhm9anO8yA==",
|
"integrity": "sha512-xE4iEW/3LqlYj9GFgGrFsFSH51dEEpUbYWBfeOv0q87WkUDxK2o/HhreSb7qMJqck70RVM6Lg96hgedcAYcOkA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-linux-x64-musl": {
|
"@biomejs/cli-linux-x64-musl": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.15.tgz",
|
||||||
"integrity": "sha512-2kI5PrMgW5dcEZYrstLPmUmCwkUwZY39rP4BN93Vxbwcs2O57LDQOktUZZYPvvspN5i0mhGr3TJtF5sU26NUWg==",
|
"integrity": "sha512-IlxUcyxilVGPsE008x13pWdkTbU3nQpP2i9b5UrbOYj6goBkKsRX1XB7yJLcV+O1H9LBchIIm4adOaVLZBX0ZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-win32-arm64": {
|
"@biomejs/cli-win32-arm64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.15.tgz",
|
||||||
"integrity": "sha512-pHgAFffmZtaYoxavEsWEYNvcA7NwOIjLyqw2HXyLbt16xYryX0L4fMV2u0G9ag6LNYPIoqWaWqzUcnc6rLGGXg==",
|
"integrity": "sha512-2kPKzhNlm8C+Ru3GcO0Me2ODkCBLrVOUNuyi84RJyWDVKAA4+Kjj3jMjL938lF6BRfvltC4vB2nPY9SvN51Ovg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"@biomejs/cli-win32-x64": {
|
"@biomejs/cli-win32-x64": {
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.15.tgz",
|
||||||
"integrity": "sha512-oJWmBhoHsnhUKIke+0gXDX0mltJrWHA1UyHsrTlXwX0TL64ilVZAo+TYZm97baecV0esBdpzy3k96q+09JaZUQ==",
|
"integrity": "sha512-yAzh4UqEImV6Hcy0zjUqNfJAsUhoD64FBQCdTG8Md/Z2wQeVP/ZmJ3XRYAs1g8J9fjTFyl2fCtc5FB5til47+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@
|
|||||||
"undici": "^8.11.0"
|
"undici": "^8.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.5.14",
|
"@biomejs/biome": "^2.5.15",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/node": "^26.6.2",
|
"@types/node": "^26.6.2",
|
||||||
"@types/semver": "^7.8.0",
|
"@types/semver": "^7.8.0",
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ export async function validateChecksum(
|
|||||||
: (knownChecksum ?? (hasManifestChecksum ? manifestChecksum : undefined));
|
: (knownChecksum ?? (hasManifestChecksum ? manifestChecksum : undefined));
|
||||||
|
|
||||||
if (checksumToUse === undefined) {
|
if (checksumToUse === undefined) {
|
||||||
throw new Error(`No checksum found for ${key} in manifest.`);
|
if (manifestChecksum !== undefined) {
|
||||||
|
throw new Error(`No checksum found for ${key} in manifest.`);
|
||||||
|
}
|
||||||
|
core.debug(`No checksum found for ${key}.`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const checksumSource = hasProvidedChecksum
|
const checksumSource = hasProvidedChecksum
|
||||||
|
|||||||
-72
@@ -1,76 +1,4 @@
|
|||||||
{
|
{
|
||||||
"aarch64-apple-darwin-0.13.12": "d905e1a64548255c3ed1235fc933e5f7d0d5b7351d2b458c715d47577fe1412c",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.12": "7c824762c7e6b38f30b3284876b58aa891373e67b759f9b70e0dfc2b4d2e2765",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.12": "33566e9a9736a658745e843cae59e9d749c46b370ec1a96394a1bbae4cfc64bc",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.12": "a7045ebd5c321a7682c7e4c0eb7e091ac5ce3596967323c5e408962197f34bfd",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.12": "ecc9b6de82f070cf3a393579b07033e3cabd083f8a25fab38093e154f5ff9cae",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.12": "3fce28697e213d9b63e8132ead143d0f739549c09b6c5933e5b752cc158f7403",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.12": "029fa66e7293dcc6bcadcb3f78c6ce126a49e5c3d5824e78321450ab67a8e501",
|
|
||||||
"i686-pc-windows-msvc-0.13.12": "5fa7d60af5e2bbb8e6e2ebae0bea351c3613125f63a71fadf5bd599eceed8d1d",
|
|
||||||
"i686-unknown-linux-gnu-0.13.12": "98903540af249f6f696be945d4af70505f0b6fadae83f3f63af0beeca8391c23",
|
|
||||||
"i686-unknown-linux-musl-0.13.12": "8a71524fdfebfb66c40d14e5ff7ed42654d7827f3c62028f55858b32257389d9",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.12": "f018f4347a357c53a867cfffa6ce8f6738cf6a3717f9f2279d9837eb37935fa1",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.12": "900301c8cfbd172ad3ef0e546faee7d761dd039047e13105696b0147320dba68",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.12": "790f8e93727338f8c18e75a965604dbf2950d149a6d2e55428b8a267721f0f09",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.12": "0ce1ecdcb1abc4359ab9aae7bad3804294a681a56701735e889c0571f322a4b6",
|
|
||||||
"x86_64-apple-darwin-0.13.12": "ed4e96c5b2c69dc1d3f0866ad5e3b659eeb6bd3e0f2dcf60b7c7d8fa39e77e72",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.12": "12c4aa5774d2924cbc8b9b7a6b351951f9dfc5d7f11995742ed558434114bd1d",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.12": "0bc2e0afabc7791518b20545e54bc5dec8c401b4063ce4b5060133a73210f8ee",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.12": "0161ae6528adaf5e9d4520bdbe8d55f88de35a3ee6e1ec2db6da9b0358e859f1",
|
|
||||||
"aarch64-apple-darwin-0.13.11": "616883f2325f29ae6788147da00ad262cadd54eae17c8c79c61f848697deefbd",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.11": "5713e09f307eca35e4dbf01decf0890938286837746995b43c818f2ad9930ab0",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.11": "93abb5e26e6230ed38085027eb0bea73304c157d0313607a662bc92dbdd1b64c",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.11": "8df6512348fef63198c105f57bf413bb87b90ecef431663e1ad838906be38929",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.11": "6a8121c2e27f6a064f1ff2c409efc067d27eb33d8840d507debee46a1b9ca88e",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.11": "ce03fe2f466697b98a93160071a5d2b17786299ee65828991cd32f44d5409272",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.11": "9141c9837f24954d42a09fe1c20c006073e2ac0320d54c1893859e996c597d04",
|
|
||||||
"i686-pc-windows-msvc-0.13.11": "06cc6bedb38929eb50073f93ef47af13c6e1cc83b7b77a66f1020ecd49dde5e9",
|
|
||||||
"i686-unknown-linux-gnu-0.13.11": "5f0c33eeb542975d2b717ca3ae12ac1d97153e52f7e0da98fc0430cfbb3c9220",
|
|
||||||
"i686-unknown-linux-musl-0.13.11": "2ea3656dbba9fb7688da4e062cd74606cd868d360b3661c0493a1b8cee026e4e",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.11": "b820136eec9f2bfb07e7e636913f761362a9c20225243249a1d1957a20b4b839",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.11": "855de3eaf539915580ac47f0782ceae644545fd7cd52e35a4ecf3ba3980475e0",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.11": "f0fcb13d128a65f02bdd21d38e30f17476f44e119e24701a30b90befb34c19c3",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.11": "c349bdffb298217df4f0333011a33d32f0f9da0ce7631b91aef745940d621f58",
|
|
||||||
"x86_64-apple-darwin-0.13.11": "f93134a5a7dd5b7f157e90c7ba1658576f8dabeb30783f24db33d933dae92ac7",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.11": "a3d41202a941be98284f1bd00dd469e9a2450e2207885b1db85b8680ba843b8b",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.11": "302504ac093f11a479d0618c2ebacd08ebeae16eb396b95a306a303a1a5ae6e3",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.11": "f6cdb8acb566d9d6fa1a700ec4ad8de35f2b6a3a8fe20d8f28774a1972ca694f",
|
|
||||||
"aarch64-apple-darwin-0.13.10": "e419bf07533bdbf48795fc793601c834dd79db57a8c49ce8e25cfe3a8639958d",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.10": "f223bcd3fa010174ffeeb885cc1d5334bb81388640c65baa5b8b42b47017337e",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.10": "14590f644805a6234ffe071154340669e38137f38e60aa9629690119704107d2",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.10": "68174084fe40b6300361c5b2038066120dc62c92920c22a0f31f6fc74b066b57",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.10": "804708f73ca25cbb63ec63fe645b7eaa84b5abf05c2035191434e4417d2cc38e",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.10": "ab7a68a76962f7403fe66418c4a005e0b17d822518f7fea9d3c1bd036e8f530f",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.10": "f6980b09607379c9974241da2ae11bde7960010d2f9b7a21099fae67ffbad30a",
|
|
||||||
"i686-pc-windows-msvc-0.13.10": "ea400c4d77a201e300b986387d83a65b26080bd5154b90e339de73395b08ce84",
|
|
||||||
"i686-unknown-linux-gnu-0.13.10": "621ae75ab65facd2c6eec13b73173f726a0aa1ddc8133b4047d1423a6c33e55c",
|
|
||||||
"i686-unknown-linux-musl-0.13.10": "f33b8e6753bc873e047fe58e48edddd42cca82d528648810031dd4b0b44c3170",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.10": "4173e6edf7630a655497969dad32cf7788f6a7b4f0d8d51b654650ea0b16ddb1",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.10": "cad2291ff12d9adee6673be5c5389eecf86d2a92d8d227826fbfe66462aebe5c",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.10": "1f177435625d0e56aafb565f8ffbabb18fa3cf76364f57eec4cc1d606f51df35",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.10": "175449a8d5dca11f3f964afe712c63f0db966da0ea7ecf500b6cb7913c9f1b23",
|
|
||||||
"x86_64-apple-darwin-0.13.10": "153e03197588204c04fc4c81cc4bafbfa4280222a385e4ee36a87aeec0ae63b4",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.10": "297b3881fe1adfb922becc2c1613202abb41dc83ea5ff43d472aa087ca1f8683",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.10": "bf65ac1a0af10f92c522d91ac096c7c0a39657647b155577e7836c2cbbb4526c",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.10": "5597970380083a340b7983af05a84824b4db1c62b7059c796935b7fd6dc95fd2",
|
|
||||||
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
|
|
||||||
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
|
|
||||||
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
|
|
||||||
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
|
|
||||||
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
|
|
||||||
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
|
|
||||||
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
|
|
||||||
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
|
|
||||||
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
|
|
||||||
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
|
|
||||||
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
|
|
||||||
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
|
|
||||||
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
|
|
||||||
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
|
|
||||||
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
|
|
||||||
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
|
|
||||||
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
|
|
||||||
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
|
|
||||||
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
|
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
|
||||||
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
|
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
|
||||||
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
|
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
|
||||||
|
|||||||
@@ -6,41 +6,27 @@ import {
|
|||||||
ASTRAL_MIRROR_PREFIX,
|
ASTRAL_MIRROR_PREFIX,
|
||||||
GITHUB_RELEASES_PREFIX,
|
GITHUB_RELEASES_PREFIX,
|
||||||
TOOL_CACHE_NAME,
|
TOOL_CACHE_NAME,
|
||||||
|
VERSIONS_MANIFEST_URL,
|
||||||
} from "../utils/constants";
|
} from "../utils/constants";
|
||||||
import * as log from "../utils/logging";
|
import * as log from "../utils/logging";
|
||||||
import type { Architecture, Platform } from "../utils/platforms";
|
import type { Architecture, Platform } from "../utils/platforms";
|
||||||
import { validateChecksum } from "./checksum/checksum";
|
import { validateChecksum } from "./checksum/checksum";
|
||||||
import { KNOWN_CHECKSUMS } from "./checksum/known-checksums";
|
import { getArtifact } from "./manifest";
|
||||||
|
|
||||||
export function getIntrinsicChecksum(
|
export { resolveVersion } from "../version/resolve";
|
||||||
key: string,
|
|
||||||
providedChecksum: string,
|
|
||||||
): string {
|
|
||||||
const checksum = providedChecksum || KNOWN_CHECKSUMS[key];
|
|
||||||
if (!checksum) {
|
|
||||||
throw new Error(
|
|
||||||
`No bundled checksum for ${key}. With require-checksums enabled, update setup-uv or provide the checksum input for this archive.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!/^[a-f0-9]{64}$/.test(checksum)) {
|
|
||||||
throw new Error(`Expected a SHA-256 checksum for ${key}.`);
|
|
||||||
}
|
|
||||||
return checksum;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function tryGetFromToolCache(
|
export function tryGetFromToolCache(
|
||||||
arch: Architecture,
|
arch: Architecture,
|
||||||
version: string,
|
version: string,
|
||||||
toolCacheName = TOOL_CACHE_NAME,
|
|
||||||
): { version: string; installedPath: string | undefined } {
|
): { version: string; installedPath: string | undefined } {
|
||||||
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
||||||
const cachedVersions = tc.findAllVersions(toolCacheName, arch);
|
const cachedVersions = tc.findAllVersions(TOOL_CACHE_NAME, arch);
|
||||||
core.debug(`Cached versions: ${cachedVersions}`);
|
core.debug(`Cached versions: ${cachedVersions}`);
|
||||||
let resolvedVersion = tc.evaluateVersions(cachedVersions, version);
|
let resolvedVersion = tc.evaluateVersions(cachedVersions, version);
|
||||||
if (resolvedVersion === "") {
|
if (resolvedVersion === "") {
|
||||||
resolvedVersion = version;
|
resolvedVersion = version;
|
||||||
}
|
}
|
||||||
const installedPath = tc.find(toolCacheName, resolvedVersion, arch);
|
const installedPath = tc.find(TOOL_CACHE_NAME, resolvedVersion, arch);
|
||||||
return { installedPath, version: resolvedVersion };
|
return { installedPath, version: resolvedVersion };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,12 +34,26 @@ export async function downloadVersion(
|
|||||||
platform: Platform,
|
platform: Platform,
|
||||||
arch: Architecture,
|
arch: Architecture,
|
||||||
version: string,
|
version: string,
|
||||||
artifact: { downloadUrl: string; checksum: string },
|
|
||||||
checksum: string | undefined,
|
checksum: string | undefined,
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
|
manifestUrl?: string,
|
||||||
downloadFromAstralMirror = true,
|
downloadFromAstralMirror = true,
|
||||||
toolCacheName = TOOL_CACHE_NAME,
|
|
||||||
): Promise<{ version: string; cachedToolDir: string }> {
|
): Promise<{ version: string; cachedToolDir: string }> {
|
||||||
|
const artifact = await getArtifact(version, arch, platform, manifestUrl);
|
||||||
|
|
||||||
|
if (!artifact) {
|
||||||
|
throw new Error(
|
||||||
|
getMissingArtifactMessage(version, arch, platform, manifestUrl),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom manifests are explicitly selected by the user, so their checksum
|
||||||
|
// takes precedence over the built-in table. For the default manifest, pass
|
||||||
|
// its checksum as a fallback after user input and KNOWN_CHECKSUMS.
|
||||||
|
const resolvedChecksum =
|
||||||
|
manifestUrl === undefined
|
||||||
|
? checksum
|
||||||
|
: resolveChecksum(checksum, artifact.checksum);
|
||||||
const manifestChecksum = artifact.checksum;
|
const manifestChecksum = artifact.checksum;
|
||||||
|
|
||||||
const mirrorUrl = downloadFromAstralMirror
|
const mirrorUrl = downloadFromAstralMirror
|
||||||
@@ -68,10 +68,9 @@ export async function downloadVersion(
|
|||||||
platform,
|
platform,
|
||||||
arch,
|
arch,
|
||||||
version,
|
version,
|
||||||
checksum,
|
resolvedChecksum,
|
||||||
manifestChecksum,
|
manifestChecksum,
|
||||||
githubTokenForUrl(downloadUrl, githubToken),
|
githubTokenForUrl(downloadUrl, githubToken),
|
||||||
toolCacheName,
|
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (mirrorUrl === undefined) {
|
if (mirrorUrl === undefined) {
|
||||||
@@ -88,10 +87,9 @@ export async function downloadVersion(
|
|||||||
platform,
|
platform,
|
||||||
arch,
|
arch,
|
||||||
version,
|
version,
|
||||||
checksum,
|
resolvedChecksum,
|
||||||
manifestChecksum,
|
manifestChecksum,
|
||||||
githubTokenForUrl(artifact.downloadUrl, githubToken),
|
githubTokenForUrl(artifact.downloadUrl, githubToken),
|
||||||
toolCacheName,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +128,6 @@ async function downloadArtifact(
|
|||||||
checksum: string | undefined,
|
checksum: string | undefined,
|
||||||
manifestChecksum: string | undefined,
|
manifestChecksum: string | undefined,
|
||||||
githubToken: string | undefined,
|
githubToken: string | undefined,
|
||||||
toolCacheName: string,
|
|
||||||
): Promise<{ version: string; cachedToolDir: string }> {
|
): Promise<{ version: string; cachedToolDir: string }> {
|
||||||
log.info(`Downloading uv from "${downloadUrl}" ...`);
|
log.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
const downloadPath = await tc.downloadTool(
|
const downloadPath = await tc.downloadTool(
|
||||||
@@ -168,10 +165,37 @@ async function downloadArtifact(
|
|||||||
uvDir = path.join(extractedDir, artifactName);
|
uvDir = path.join(extractedDir, artifactName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachedToolDir = await tc.cacheDir(uvDir, toolCacheName, version, arch);
|
const cachedToolDir = await tc.cacheDir(
|
||||||
|
uvDir,
|
||||||
|
TOOL_CACHE_NAME,
|
||||||
|
version,
|
||||||
|
arch,
|
||||||
|
);
|
||||||
return { cachedToolDir, version };
|
return { cachedToolDir, version };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMissingArtifactMessage(
|
||||||
|
version: string,
|
||||||
|
arch: Architecture,
|
||||||
|
platform: Platform,
|
||||||
|
manifestUrl?: string,
|
||||||
|
): string {
|
||||||
|
if (manifestUrl === undefined) {
|
||||||
|
return `Could not find artifact for version ${version}, arch ${arch}, platform ${platform} in ${VERSIONS_MANIFEST_URL} .`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveChecksum(
|
||||||
|
checksum: string | undefined,
|
||||||
|
manifestChecksum: string,
|
||||||
|
): string {
|
||||||
|
return checksum !== undefined && checksum !== ""
|
||||||
|
? checksum
|
||||||
|
: manifestChecksum;
|
||||||
|
}
|
||||||
|
|
||||||
function getExtension(platform: Platform): string {
|
function getExtension(platform: Platform): string {
|
||||||
return platform === "pc-windows-msvc" ? ".zip" : ".tar.gz";
|
return platform === "pc-windows-msvc" ? ".zip" : ".tar.gz";
|
||||||
}
|
}
|
||||||
+72
-48
@@ -1,8 +1,11 @@
|
|||||||
import { createInterface } from "node:readline";
|
import { createInterface } from "node:readline";
|
||||||
import { Readable } from "node:stream";
|
import { Readable } from "node:stream";
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
import {
|
||||||
|
GITHUB_VERSIONS_MANIFEST_URL,
|
||||||
|
VERSIONS_MANIFEST_URL,
|
||||||
|
} from "../utils/constants";
|
||||||
import { fetch } from "../utils/fetch";
|
import { fetch } from "../utils/fetch";
|
||||||
import type { ManifestSource } from "../utils/inputs";
|
|
||||||
import * as log from "../utils/logging";
|
import * as log from "../utils/logging";
|
||||||
import { selectDefaultVariant } from "./variant-selection";
|
import { selectDefaultVariant } from "./variant-selection";
|
||||||
|
|
||||||
@@ -30,23 +33,22 @@ interface CachedManifest {
|
|||||||
versions: ManifestVersion[];
|
versions: ManifestVersion[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Share cached records for the same source object without keeping that object alive.
|
const cachedManifestData = new Map<string, CachedManifest>();
|
||||||
let cachedManifestData = new WeakMap<ManifestSource, CachedManifest>();
|
|
||||||
export const MANIFEST_FETCH_ATTEMPTS = 3;
|
export const MANIFEST_FETCH_ATTEMPTS = 3;
|
||||||
|
|
||||||
export async function fetchManifest(
|
export async function fetchManifest(
|
||||||
source: ManifestSource,
|
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||||
): Promise<ManifestVersion[]> {
|
): Promise<ManifestVersion[]> {
|
||||||
const cachedManifest = cachedManifestData.get(source);
|
const cachedManifest = cachedManifestData.get(manifestUrl);
|
||||||
if (cachedManifest?.complete === true) {
|
if (cachedManifest?.complete === true) {
|
||||||
core.debug(`Using cached manifest data from ${source.url}`);
|
core.debug(`Using cached manifest data from ${manifestUrl}`);
|
||||||
return cachedManifest.versions;
|
return cachedManifest.versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetchManifestResponse(source);
|
const response = await fetchManifestResponse(manifestUrl);
|
||||||
const body = await response.text();
|
const body = await response.text();
|
||||||
const versions = parseManifest(body, source.url);
|
const versions = parseManifest(body, manifestUrl);
|
||||||
cachedManifestData.set(source, { complete: true, versions });
|
cachedManifestData.set(manifestUrl, { complete: true, versions });
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,32 +81,39 @@ export function parseManifest(
|
|||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFirstVersion(source: ManifestSource): Promise<string> {
|
export async function getLatestVersion(
|
||||||
const version = (await findManifestVersion(source, () => true))?.version;
|
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||||
|
): Promise<string> {
|
||||||
|
const latestVersion =
|
||||||
|
manifestUrl === VERSIONS_MANIFEST_URL
|
||||||
|
? (await findManifestVersion(() => true))?.version
|
||||||
|
: (await fetchManifest(manifestUrl))[0]?.version;
|
||||||
|
|
||||||
if (version === undefined) {
|
if (latestVersion === undefined) {
|
||||||
throw new Error("No versions found in manifest data");
|
throw new Error("No versions found in manifest data");
|
||||||
}
|
}
|
||||||
|
|
||||||
return version;
|
core.debug(`Latest version from manifest: ${latestVersion}`);
|
||||||
|
return latestVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The default manifest is guaranteed to be ordered newest-first:
|
||||||
|
// https://github.com/astral-sh/versions#format
|
||||||
export async function getFirstMatchingVersion(
|
export async function getFirstMatchingVersion(
|
||||||
predicate: (version: string) => boolean,
|
predicate: (version: string) => boolean,
|
||||||
source: ManifestSource,
|
|
||||||
): Promise<string | undefined> {
|
): Promise<string | undefined> {
|
||||||
return (
|
return (
|
||||||
await findManifestVersion(source, (versionData) =>
|
await findManifestVersion((versionData) => predicate(versionData.version))
|
||||||
predicate(versionData.version),
|
|
||||||
)
|
|
||||||
)?.version;
|
)?.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAllVersions(
|
export async function getAllVersions(
|
||||||
source: ManifestSource,
|
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||||
): Promise<string[]> {
|
): Promise<string[]> {
|
||||||
log.info(`Getting available versions from ${source.url} ...`);
|
log.info(
|
||||||
const versions = await fetchManifest(source);
|
`Getting available versions from ${manifestSource(manifestUrl)} ...`,
|
||||||
|
);
|
||||||
|
const versions = await fetchManifest(manifestUrl);
|
||||||
return versions.map((versionData) => versionData.version);
|
return versions.map((versionData) => versionData.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,14 +121,16 @@ export async function getArtifact(
|
|||||||
version: string,
|
version: string,
|
||||||
arch: string,
|
arch: string,
|
||||||
platform: string,
|
platform: string,
|
||||||
source: ManifestSource,
|
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||||
): Promise<ArtifactResult | undefined> {
|
): Promise<ArtifactResult | undefined> {
|
||||||
const versionData = await findManifestVersion(
|
const versionData =
|
||||||
source,
|
manifestUrl === VERSIONS_MANIFEST_URL
|
||||||
(candidate) => candidate.version === version,
|
? await findManifestVersion((candidate) => candidate.version === version)
|
||||||
);
|
: (await fetchManifest(manifestUrl)).find(
|
||||||
|
(candidate) => candidate.version === version,
|
||||||
|
);
|
||||||
if (!versionData) {
|
if (!versionData) {
|
||||||
core.debug(`Version ${version} not found in manifest ${source.url}`);
|
core.debug(`Version ${version} not found in manifest ${manifestUrl}`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,21 +160,26 @@ export async function getArtifact(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearManifestCache(): void {
|
export function clearManifestCache(manifestUrl?: string): void {
|
||||||
cachedManifestData = new WeakMap();
|
if (manifestUrl === undefined) {
|
||||||
|
cachedManifestData.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedManifestData.delete(manifestUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchManifestResponse(source: ManifestSource) {
|
async function fetchManifestResponse(manifestUrl: string) {
|
||||||
try {
|
try {
|
||||||
return await fetchManifestResponseFromUrl(source.url);
|
return await fetchManifestResponseFromUrl(manifestUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (source.fallbackUrl === undefined) {
|
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
log.info(
|
log.info(
|
||||||
`Failed to fetch manifest from ${source.url}, falling back to ${source.fallbackUrl}: ${(error as Error).message}`,
|
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${(error as Error).message}`,
|
||||||
);
|
);
|
||||||
return await fetchManifestResponseFromUrl(source.fallbackUrl);
|
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,25 +214,21 @@ async function fetchManifestResponseFromUrl(manifestUrl: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function findManifestVersion(
|
async function findManifestVersion(
|
||||||
source: ManifestSource,
|
|
||||||
predicate: (versionData: ManifestVersion) => boolean,
|
predicate: (versionData: ManifestVersion) => boolean,
|
||||||
): Promise<ManifestVersion | undefined> {
|
): Promise<ManifestVersion | undefined> {
|
||||||
// The built-in manifests are ordered newest-first:
|
const cachedManifest = cachedManifestData.get(VERSIONS_MANIFEST_URL);
|
||||||
// https://github.com/astral-sh/versions#format
|
|
||||||
if (!source.newestFirst) {
|
|
||||||
return (await fetchManifest(source)).find(predicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cachedManifest = cachedManifestData.get(source);
|
|
||||||
const cachedVersion = cachedManifest?.versions.find(predicate);
|
const cachedVersion = cachedManifest?.versions.find(predicate);
|
||||||
if (cachedVersion !== undefined || cachedManifest?.complete === true) {
|
if (cachedVersion !== undefined || cachedManifest?.complete === true) {
|
||||||
return cachedVersion;
|
return cachedVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetchManifestResponse(source);
|
const response = await fetchManifestResponse(VERSIONS_MANIFEST_URL);
|
||||||
if (response.body === null) {
|
if (response.body === null) {
|
||||||
const versions = parseManifest(await response.text(), source.url);
|
const versions = parseManifest(
|
||||||
cachedManifestData.set(source, {
|
await response.text(),
|
||||||
|
VERSIONS_MANIFEST_URL,
|
||||||
|
);
|
||||||
|
cachedManifestData.set(VERSIONS_MANIFEST_URL, {
|
||||||
complete: true,
|
complete: true,
|
||||||
versions,
|
versions,
|
||||||
});
|
});
|
||||||
@@ -239,10 +251,14 @@ async function findManifestVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (versions.length === 0) {
|
if (versions.length === 0) {
|
||||||
rejectLegacyManifest(record, source.url);
|
rejectLegacyManifest(record, VERSIONS_MANIFEST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const versionData = parseManifestRecord(record, source.url, lineNumber);
|
const versionData = parseManifestRecord(
|
||||||
|
record,
|
||||||
|
VERSIONS_MANIFEST_URL,
|
||||||
|
lineNumber,
|
||||||
|
);
|
||||||
versions.push(versionData);
|
versions.push(versionData);
|
||||||
if (predicate(versionData)) {
|
if (predicate(versionData)) {
|
||||||
matchedVersion = versionData;
|
matchedVersion = versionData;
|
||||||
@@ -259,13 +275,21 @@ async function findManifestVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (versions.length === 0) {
|
if (versions.length === 0) {
|
||||||
throw new Error(`Manifest at ${source.url} is empty.`);
|
throw new Error(`Manifest at ${VERSIONS_MANIFEST_URL} is empty.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
cachedManifestData.set(source, { complete, versions });
|
cachedManifestData.set(VERSIONS_MANIFEST_URL, { complete, versions });
|
||||||
return matchedVersion;
|
return matchedVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function manifestSource(manifestUrl: string): string {
|
||||||
|
if (manifestUrl === VERSIONS_MANIFEST_URL) {
|
||||||
|
return VERSIONS_MANIFEST_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `manifest-file ${manifestUrl}`;
|
||||||
|
}
|
||||||
|
|
||||||
function parseManifestRecord(
|
function parseManifestRecord(
|
||||||
record: string,
|
record: string,
|
||||||
sourceDescription: string,
|
sourceDescription: string,
|
||||||
|
|||||||
+11
-56
@@ -5,15 +5,9 @@ import * as exec from "@actions/exec";
|
|||||||
import { restoreCache } from "./cache/restore-cache";
|
import { restoreCache } from "./cache/restore-cache";
|
||||||
import {
|
import {
|
||||||
downloadVersion,
|
downloadVersion,
|
||||||
getIntrinsicChecksum,
|
|
||||||
tryGetFromToolCache,
|
tryGetFromToolCache,
|
||||||
} from "./download/download-version";
|
} from "./download/download-version";
|
||||||
import { getArtifact } from "./download/manifest";
|
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
||||||
import {
|
|
||||||
STATE_UV_PATH,
|
|
||||||
STATE_UV_VERSION,
|
|
||||||
TOOL_CACHE_NAME,
|
|
||||||
} from "./utils/constants";
|
|
||||||
import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs";
|
import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs";
|
||||||
import * as log from "./utils/logging";
|
import * as log from "./utils/logging";
|
||||||
import {
|
import {
|
||||||
@@ -146,31 +140,14 @@ async function setupUv(
|
|||||||
platform: Platform,
|
platform: Platform,
|
||||||
arch: Architecture,
|
arch: Architecture,
|
||||||
): Promise<{ uvDir: string; version: string }> {
|
): Promise<{ uvDir: string; version: string }> {
|
||||||
const { manifestSource } = inputs;
|
const resolvedVersion = await resolveUvVersion({
|
||||||
const resolvedVersion = await resolveUvVersion(
|
manifestFile: inputs.manifestFile,
|
||||||
{
|
resolutionStrategy: inputs.resolutionStrategy,
|
||||||
resolutionStrategy: inputs.resolutionStrategy,
|
version: inputs.version,
|
||||||
version: inputs.version,
|
versionFile: inputs.versionFile,
|
||||||
versionFile: inputs.versionFile,
|
workingDirectory: inputs.workingDirectory,
|
||||||
workingDirectory: inputs.workingDirectory,
|
});
|
||||||
},
|
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
|
||||||
manifestSource,
|
|
||||||
);
|
|
||||||
let checksum = inputs.checksum;
|
|
||||||
let toolCacheName = TOOL_CACHE_NAME;
|
|
||||||
if (inputs.requireChecksums) {
|
|
||||||
checksum = getIntrinsicChecksum(
|
|
||||||
`${arch}-${platform}-${resolvedVersion}`,
|
|
||||||
inputs.checksum,
|
|
||||||
);
|
|
||||||
// A regular tool-cache entry may have been verified using a manifest checksum.
|
|
||||||
toolCacheName = `${TOOL_CACHE_NAME}-${checksum}`;
|
|
||||||
}
|
|
||||||
const toolCacheResult = tryGetFromToolCache(
|
|
||||||
arch,
|
|
||||||
resolvedVersion,
|
|
||||||
toolCacheName,
|
|
||||||
);
|
|
||||||
if (toolCacheResult.installedPath) {
|
if (toolCacheResult.installedPath) {
|
||||||
log.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
|
log.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
|
||||||
return {
|
return {
|
||||||
@@ -179,36 +156,14 @@ async function setupUv(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const artifact = await getArtifact(
|
|
||||||
resolvedVersion,
|
|
||||||
arch,
|
|
||||||
platform,
|
|
||||||
manifestSource,
|
|
||||||
);
|
|
||||||
if (artifact === undefined) {
|
|
||||||
const target = `version ${resolvedVersion}, arch ${arch}, platform ${platform}`;
|
|
||||||
throw new Error(
|
|
||||||
manifestSource.custom
|
|
||||||
? `manifest-file does not contain ${target}.`
|
|
||||||
: `Could not find artifact for ${target} in ${manifestSource.url} .`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// An explicit manifest's checksum takes precedence over the bundled table,
|
|
||||||
// but never over a checksum input or the checksum required above.
|
|
||||||
if (manifestSource.custom) {
|
|
||||||
checksum = checksum || artifact.checksum;
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadResult = await downloadVersion(
|
const downloadResult = await downloadVersion(
|
||||||
platform,
|
platform,
|
||||||
arch,
|
arch,
|
||||||
resolvedVersion,
|
resolvedVersion,
|
||||||
artifact,
|
inputs.checksum,
|
||||||
checksum,
|
|
||||||
inputs.githubToken,
|
inputs.githubToken,
|
||||||
|
inputs.manifestFile,
|
||||||
inputs.downloadFromAstralMirror,
|
inputs.downloadFromAstralMirror,
|
||||||
toolCacheName,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import {
|
|||||||
} from "./download/checksum/update-known-checksums";
|
} from "./download/checksum/update-known-checksums";
|
||||||
import {
|
import {
|
||||||
fetchManifest,
|
fetchManifest,
|
||||||
getFirstVersion,
|
getLatestVersion,
|
||||||
type ManifestVersion,
|
type ManifestVersion,
|
||||||
} from "./download/manifest";
|
} from "./download/manifest";
|
||||||
import { ASTRAL_MANIFEST } from "./utils/inputs";
|
|
||||||
import * as log from "./utils/logging";
|
import * as log from "./utils/logging";
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
@@ -21,7 +20,7 @@ async function run(): Promise<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestVersion = await getFirstVersion(ASTRAL_MANIFEST);
|
const latestVersion = await getLatestVersion();
|
||||||
const latestKnownVersion = getLatestKnownVersion();
|
const latestKnownVersion = getLatestKnownVersion();
|
||||||
|
|
||||||
if (semver.lte(latestVersion, latestKnownVersion)) {
|
if (semver.lte(latestVersion, latestKnownVersion)) {
|
||||||
@@ -31,7 +30,7 @@ async function run(): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const versions = await fetchManifest(ASTRAL_MANIFEST);
|
const versions = await fetchManifest();
|
||||||
const checksumEntries = extractChecksumsFromManifest(versions);
|
const checksumEntries = extractChecksumsFromManifest(versions);
|
||||||
await updateChecksums(checksumFilePath, checksumEntries);
|
await updateChecksums(checksumFilePath, checksumEntries);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
export const TOOL_CACHE_NAME = "uv";
|
export const TOOL_CACHE_NAME = "uv";
|
||||||
export const STATE_UV_PATH = "uv-path";
|
export const STATE_UV_PATH = "uv-path";
|
||||||
export const STATE_UV_VERSION = "uv-version";
|
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. */
|
/** GitHub Releases URL prefix for uv artifacts. */
|
||||||
export const GITHUB_RELEASES_PREFIX =
|
export const GITHUB_RELEASES_PREFIX =
|
||||||
|
|||||||
+8
-35
@@ -19,30 +19,6 @@ export interface CacheLocalPath {
|
|||||||
|
|
||||||
export type ResolutionStrategy = "highest" | "lowest";
|
export type ResolutionStrategy = "highest" | "lowest";
|
||||||
|
|
||||||
export interface ManifestSource {
|
|
||||||
readonly url: string;
|
|
||||||
readonly newestFirst: boolean;
|
|
||||||
readonly fallbackUrl?: string;
|
|
||||||
readonly custom: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const VERSIONS_MANIFEST_URL =
|
|
||||||
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson";
|
|
||||||
const GITHUB_VERSIONS_MANIFEST_URL =
|
|
||||||
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
|
|
||||||
|
|
||||||
export const ASTRAL_MANIFEST: ManifestSource = {
|
|
||||||
custom: false,
|
|
||||||
fallbackUrl: GITHUB_VERSIONS_MANIFEST_URL,
|
|
||||||
newestFirst: true,
|
|
||||||
url: VERSIONS_MANIFEST_URL,
|
|
||||||
};
|
|
||||||
const GITHUB_MANIFEST: ManifestSource = {
|
|
||||||
custom: false,
|
|
||||||
newestFirst: true,
|
|
||||||
url: GITHUB_VERSIONS_MANIFEST_URL,
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface SetupInputs {
|
export interface SetupInputs {
|
||||||
workingDirectory: string;
|
workingDirectory: string;
|
||||||
version: string;
|
version: string;
|
||||||
@@ -54,7 +30,6 @@ export interface SetupInputs {
|
|||||||
noProject: boolean;
|
noProject: boolean;
|
||||||
venvPath: string;
|
venvPath: string;
|
||||||
checksum: string;
|
checksum: string;
|
||||||
requireChecksums: boolean;
|
|
||||||
enableCache: boolean;
|
enableCache: boolean;
|
||||||
restoreCache: boolean;
|
restoreCache: boolean;
|
||||||
saveCache: boolean;
|
saveCache: boolean;
|
||||||
@@ -69,7 +44,7 @@ export interface SetupInputs {
|
|||||||
toolDir?: string;
|
toolDir?: string;
|
||||||
pythonDir: string;
|
pythonDir: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
manifestSource: ManifestSource;
|
manifestFile?: string;
|
||||||
downloadFromAstralMirror: boolean;
|
downloadFromAstralMirror: boolean;
|
||||||
addProblemMatchers: boolean;
|
addProblemMatchers: boolean;
|
||||||
quiet: boolean;
|
quiet: boolean;
|
||||||
@@ -88,7 +63,6 @@ export function loadInputs(): SetupInputs {
|
|||||||
const noProject = core.getBooleanInput("no-project");
|
const noProject = core.getBooleanInput("no-project");
|
||||||
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
||||||
const checksum = core.getInput("checksum");
|
const checksum = core.getInput("checksum");
|
||||||
const requireChecksums = core.getBooleanInput("require-checksums");
|
|
||||||
const enableCache = getEnableCache();
|
const enableCache = getEnableCache();
|
||||||
const restoreCache = core.getInput("restore-cache") === "true";
|
const restoreCache = core.getInput("restore-cache") === "true";
|
||||||
const saveCache = getSaveCache();
|
const saveCache = getSaveCache();
|
||||||
@@ -108,9 +82,9 @@ export function loadInputs(): SetupInputs {
|
|||||||
const toolDir = getToolDir(workingDirectory);
|
const toolDir = getToolDir(workingDirectory);
|
||||||
const pythonDir = getUvPythonDir();
|
const pythonDir = getUvPythonDir();
|
||||||
const githubToken = core.getInput("github-token");
|
const githubToken = core.getInput("github-token");
|
||||||
|
const manifestFile = getManifestFile();
|
||||||
const downloadFromAstralMirror =
|
const downloadFromAstralMirror =
|
||||||
core.getInput("download-from-astral-mirror") === "true";
|
core.getInput("download-from-astral-mirror") === "true";
|
||||||
const manifestSource = getManifestSource(downloadFromAstralMirror);
|
|
||||||
const addProblemMatchers = core.getInput("add-problem-matchers") === "true";
|
const addProblemMatchers = core.getInput("add-problem-matchers") === "true";
|
||||||
const quiet = core.getInput("quiet") === "true";
|
const quiet = core.getInput("quiet") === "true";
|
||||||
const resolutionStrategy = getResolutionStrategy();
|
const resolutionStrategy = getResolutionStrategy();
|
||||||
@@ -129,14 +103,13 @@ export function loadInputs(): SetupInputs {
|
|||||||
githubToken,
|
githubToken,
|
||||||
ignoreEmptyWorkdir,
|
ignoreEmptyWorkdir,
|
||||||
ignoreNothingToCache,
|
ignoreNothingToCache,
|
||||||
manifestSource,
|
manifestFile,
|
||||||
noProject,
|
noProject,
|
||||||
pruneCache,
|
pruneCache,
|
||||||
pythonArch,
|
pythonArch,
|
||||||
pythonDir,
|
pythonDir,
|
||||||
pythonVersion,
|
pythonVersion,
|
||||||
quiet,
|
quiet,
|
||||||
requireChecksums,
|
|
||||||
resolutionStrategy,
|
resolutionStrategy,
|
||||||
restoreCache,
|
restoreCache,
|
||||||
saveCache,
|
saveCache,
|
||||||
@@ -408,12 +381,12 @@ function resolveRelativePath(
|
|||||||
return hasNegation ? `!${resolvedPath}` : resolvedPath;
|
return hasNegation ? `!${resolvedPath}` : resolvedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getManifestSource(useAstralMirror: boolean): ManifestSource {
|
function getManifestFile(): string | undefined {
|
||||||
const manifestFile = core.getInput("manifest-file");
|
const manifestFileInput = core.getInput("manifest-file");
|
||||||
if (manifestFile !== "") {
|
if (manifestFileInput !== "") {
|
||||||
return { custom: true, newestFirst: false, url: manifestFile };
|
return manifestFileInput;
|
||||||
}
|
}
|
||||||
return useAstralMirror ? ASTRAL_MANIFEST : GITHUB_MANIFEST;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getResolutionStrategy(): ResolutionStrategy {
|
function getResolutionStrategy(): ResolutionStrategy {
|
||||||
|
|||||||
+17
-19
@@ -6,9 +6,10 @@ import { getLatestKnownVersion } from "../download/checksum/known-version";
|
|||||||
import {
|
import {
|
||||||
getAllVersions,
|
getAllVersions,
|
||||||
getFirstMatchingVersion,
|
getFirstMatchingVersion,
|
||||||
getFirstVersion,
|
getLatestVersion,
|
||||||
} from "../download/manifest";
|
} from "../download/manifest";
|
||||||
import type { ManifestSource, ResolutionStrategy } from "../utils/inputs";
|
import { VERSIONS_MANIFEST_URL } from "../utils/constants";
|
||||||
|
import type { ResolutionStrategy } from "../utils/inputs";
|
||||||
import * as log from "../utils/logging";
|
import * as log from "../utils/logging";
|
||||||
import {
|
import {
|
||||||
type ParsedVersionSpecifier,
|
type ParsedVersionSpecifier,
|
||||||
@@ -18,7 +19,7 @@ import type { ResolveUvVersionOptions } from "./types";
|
|||||||
import { resolveVersionRequest } from "./version-request-resolver";
|
import { resolveVersionRequest } from "./version-request-resolver";
|
||||||
|
|
||||||
interface ConcreteVersionResolutionContext {
|
interface ConcreteVersionResolutionContext {
|
||||||
source: ManifestSource;
|
manifestUrl?: string;
|
||||||
parsedSpecifier: ParsedVersionSpecifier;
|
parsedSpecifier: ParsedVersionSpecifier;
|
||||||
resolutionStrategy: ResolutionStrategy;
|
resolutionStrategy: ResolutionStrategy;
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ class LatestVersionResolver implements ConcreteVersionResolver {
|
|||||||
log.info("Found minimum version specifier, using latest version");
|
log.info("Found minimum version specifier, using latest version");
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestVersion = await getFirstVersion(context.source);
|
const latestVersion = await getLatestVersion(context.manifestUrl);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
context.parsedSpecifier.kind === "range" &&
|
context.parsedSpecifier.kind === "range" &&
|
||||||
@@ -90,14 +91,14 @@ class RangeVersionResolver implements ConcreteVersionResolver {
|
|||||||
let resolvedVersion: string | undefined;
|
let resolvedVersion: string | undefined;
|
||||||
if (
|
if (
|
||||||
context.resolutionStrategy === "highest" &&
|
context.resolutionStrategy === "highest" &&
|
||||||
context.source.newestFirst
|
(context.manifestUrl === undefined ||
|
||||||
|
context.manifestUrl === VERSIONS_MANIFEST_URL)
|
||||||
) {
|
) {
|
||||||
resolvedVersion = await findHighestSatisfyingVersion(
|
resolvedVersion = await findHighestSatisfyingVersion(
|
||||||
context.parsedSpecifier.normalized,
|
context.parsedSpecifier.normalized,
|
||||||
context.source,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const availableVersions = await getAllVersions(context.source);
|
const availableVersions = await getAllVersions(context.manifestUrl);
|
||||||
core.debug(`Available versions: ${availableVersions}`);
|
core.debug(`Available versions: ${availableVersions}`);
|
||||||
resolvedVersion =
|
resolvedVersion =
|
||||||
context.resolutionStrategy === "lowest"
|
context.resolutionStrategy === "lowest"
|
||||||
@@ -124,13 +125,12 @@ const CONCRETE_VERSION_RESOLVERS: ConcreteVersionResolver[] = [
|
|||||||
|
|
||||||
export async function resolveUvVersion(
|
export async function resolveUvVersion(
|
||||||
options: ResolveUvVersionOptions,
|
options: ResolveUvVersionOptions,
|
||||||
source: ManifestSource,
|
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const request = resolveVersionRequest(options);
|
const request = resolveVersionRequest(options);
|
||||||
const resolutionStrategy = options.resolutionStrategy ?? "highest";
|
const resolutionStrategy = options.resolutionStrategy ?? "highest";
|
||||||
const version = await resolveVersion(
|
const version = await resolveVersion(
|
||||||
request.specifier,
|
request.specifier,
|
||||||
source,
|
options.manifestFile,
|
||||||
resolutionStrategy,
|
resolutionStrategy,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ export async function resolveUvVersion(
|
|||||||
|
|
||||||
export async function resolveVersion(
|
export async function resolveVersion(
|
||||||
versionInput: string,
|
versionInput: string,
|
||||||
source: ManifestSource,
|
manifestUrl: string | undefined,
|
||||||
resolutionStrategy: ResolutionStrategy = "highest",
|
resolutionStrategy: ResolutionStrategy = "highest",
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
core.debug(`Resolving version: ${versionInput}`);
|
core.debug(`Resolving version: ${versionInput}`);
|
||||||
@@ -149,9 +149,9 @@ export async function resolveVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const context: ConcreteVersionResolutionContext = {
|
const context: ConcreteVersionResolutionContext = {
|
||||||
|
manifestUrl,
|
||||||
parsedSpecifier: parseVersionSpecifier(versionInput),
|
parsedSpecifier: parseVersionSpecifier(versionInput),
|
||||||
resolutionStrategy,
|
resolutionStrategy,
|
||||||
source,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const resolver of CONCRETE_VERSION_RESOLVERS) {
|
for (const resolver of CONCRETE_VERSION_RESOLVERS) {
|
||||||
@@ -166,16 +166,15 @@ export async function resolveVersion(
|
|||||||
|
|
||||||
async function findHighestSatisfyingVersion(
|
async function findHighestSatisfyingVersion(
|
||||||
versionSpecifier: string,
|
versionSpecifier: string,
|
||||||
source: ManifestSource,
|
|
||||||
): Promise<string | undefined> {
|
): Promise<string | undefined> {
|
||||||
// The built-in manifest sources list uv releases in descending order.
|
// This fast path assumes uv releases are semver-monotonic: newer manifest
|
||||||
|
// entries always have higher versions, with no lower-version backports.
|
||||||
const semverRange = isPep440Specifier(versionSpecifier)
|
const semverRange = isPep440Specifier(versionSpecifier)
|
||||||
? null
|
? null
|
||||||
: semver.validRange(versionSpecifier);
|
: semver.validRange(versionSpecifier);
|
||||||
if (semverRange !== null) {
|
if (semverRange !== null) {
|
||||||
const semverMatch = await getFirstMatchingVersion(
|
const semverMatch = await getFirstMatchingVersion((version) =>
|
||||||
(version) => semver.satisfies(version, semverRange),
|
semver.satisfies(version, semverRange),
|
||||||
source,
|
|
||||||
);
|
);
|
||||||
if (semverMatch !== undefined) {
|
if (semverMatch !== undefined) {
|
||||||
core.debug(
|
core.debug(
|
||||||
@@ -185,9 +184,8 @@ async function findHighestSatisfyingVersion(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pep440Match = await getFirstMatchingVersion(
|
const pep440Match = await getFirstMatchingVersion((version) =>
|
||||||
(version) => pep440.satisfies(version, versionSpecifier),
|
pep440.satisfies(version, versionSpecifier),
|
||||||
source,
|
|
||||||
);
|
);
|
||||||
if (pep440Match !== undefined) {
|
if (pep440Match !== undefined) {
|
||||||
core.debug(
|
core.debug(
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export interface ParsedVersionFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolveUvVersionOptions {
|
export interface ResolveUvVersionOptions {
|
||||||
|
manifestFile?: string;
|
||||||
resolutionStrategy?: ResolutionStrategy;
|
resolutionStrategy?: ResolutionStrategy;
|
||||||
version?: string;
|
version?: string;
|
||||||
versionFile?: string;
|
versionFile?: string;
|
||||||
|
|||||||
Reference in new issue
Block a user