mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-09 22:22:41 +00:00
Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fac544c07d | |||
| 7390f777b0 | |||
| 363c64a728 | |||
| c4fcbafce4 | |||
| 8e642c5e62 | |||
| a92cb43098 | |||
| e07f2ac4b7 | |||
| bc4034eedf | |||
| df42d4f6ba | |||
| b9c8c4c7ba | |||
| 80cc27528e | |||
| 818affc359 | |||
| feda7fc6a9 | |||
| 8dc20b2aca | |||
| e7108c6ccc | |||
| 12d13f90bc | |||
| 7470949a2c | |||
| ed07c76224 | |||
| ba17a16c0a | |||
| 853401723d | |||
| 7568f55a9a | |||
| a81585cbb0 | |||
| 88aa608651 | |||
| 00714ea9dc | |||
| c4fec0d78d | |||
| 9d91aa17e1 | |||
| 363818fa0d | |||
| 05143d3dcd | |||
| 2ae9516c03 | |||
| c0c76fcf76 | |||
| dff86cf972 | |||
| c0b7f63f92 | |||
| d854a6dce4 | |||
| 08807647e7 | |||
| 717d6aba0f | |||
| 5a911eb3a3 | |||
| 080c31e04c | |||
| b3e97d2ba1 | |||
| 7dd591db95 | |||
| 1541b77626 | |||
| cdfb2ee6dd | |||
| cb84d12dc6 | |||
| 1912cc65f2 | |||
| a0b52019f1 | |||
| 7b222e12b6 | |||
| 1c15d185f0 | |||
| d7fe1a5a18 | |||
| 16592cddee |
@@ -26,6 +26,7 @@ Use this skill when the user wants to:
|
||||
- Inspect `package.json` before editing.
|
||||
- Run `npm ci --ignore-scripts` before applying updates.
|
||||
- Use `npm install ... --ignore-scripts` for direct dependency changes so `package-lock.json` stays in sync.
|
||||
- When updating `@biomejs/biome`, also update the Biome schema URL version in `biome.json` to match the installed Biome version.
|
||||
7. Run `npm run all`.
|
||||
8. If requested, commit the changed source, lockfile, and generated artifacts, then push and open a PR.
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
source-root: src
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||
uses: github/codeql-action/autobuild@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -73,4 +73,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||
|
||||
@@ -19,6 +19,8 @@ jobs:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: 🚀 Run Release Drafter
|
||||
uses: release-drafter/release-drafter@139054aeaa9adc52ab36ddf67437541f039b88e2 # v7.1.1
|
||||
uses: release-drafter/release-drafter@693d20e7c1ce1a81d3a41962f85914253b518449 # v7.3.1
|
||||
with:
|
||||
commitish: ${{ github.sha }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Release version (e.g., 8.1.0)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
validate-release:
|
||||
name: Validate release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Validate version and draft release
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
TAG: v${{ inputs.version }}
|
||||
run: |
|
||||
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
|
||||
echo "::error::Version must match MAJOR.MINOR.PATCH (e.g., 8.1.0)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_JSON=$(gh release view "$TAG" --json isDraft,targetCommitish 2>&1) || {
|
||||
echo "::error::No release found for $TAG"
|
||||
exit 1
|
||||
}
|
||||
|
||||
IS_DRAFT=$(echo "$RELEASE_JSON" | jq -r '.isDraft')
|
||||
TARGET=$(echo "$RELEASE_JSON" | jq -r '.targetCommitish')
|
||||
|
||||
if [[ "$IS_DRAFT" != "true" ]]; then
|
||||
echo "::error::Release $TAG already exists and is not a draft"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$TARGET" != "$GITHUB_SHA" ]]; then
|
||||
echo "::error::Draft release target ($TARGET) does not match current commit ($GITHUB_SHA)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release-gate:
|
||||
# N.B. This name should not change, it is used for downstream checks.
|
||||
name: release-gate
|
||||
needs:
|
||||
- validate-release
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: release-gate
|
||||
steps:
|
||||
- run: echo "Release approved"
|
||||
|
||||
create-deployment:
|
||||
name: create-deployment
|
||||
needs:
|
||||
- validate-release
|
||||
- release-gate
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: release
|
||||
steps:
|
||||
- run: echo "Release deployment created"
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs:
|
||||
- validate-release
|
||||
- release-gate
|
||||
- create-deployment
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Publish release
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
TAG: v${{ inputs.version }}
|
||||
run: |
|
||||
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
|
||||
echo "::error::Version must match MAJOR.MINOR.PATCH (e.g., 8.1.0)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_JSON=$(gh release view "$TAG" --json isDraft,targetCommitish 2>&1) || {
|
||||
echo "::error::No release found for $TAG"
|
||||
exit 1
|
||||
}
|
||||
|
||||
IS_DRAFT=$(echo "$RELEASE_JSON" | jq -r '.isDraft')
|
||||
TARGET=$(echo "$RELEASE_JSON" | jq -r '.targetCommitish')
|
||||
|
||||
if [[ "$IS_DRAFT" != "true" ]]; then
|
||||
echo "::error::Release $TAG already exists and is not a draft"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$TARGET" != "$GITHUB_SHA" ]]; then
|
||||
echo "::error::Draft release target ($TARGET) does not match current commit ($GITHUB_SHA)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Publishing draft release $TAG"
|
||||
gh release edit "$TAG" --draft=false
|
||||
@@ -25,10 +25,10 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Actionlint
|
||||
uses: eifinger/actionlint-action@7802e0cc3ab3f81cbffb36fb0bf1a3621d994b89 # v1.10.1
|
||||
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
|
||||
- name: Run zizmor
|
||||
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
@@ -430,6 +430,49 @@ jobs:
|
||||
PY
|
||||
shell: bash
|
||||
|
||||
test-activate-environment-no-project:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Create incompatible pyproject.toml
|
||||
run: |
|
||||
cat > pyproject.toml <<'EOF'
|
||||
[project]
|
||||
name = "test-no-project"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"-e file:///${PROJECT_ROOT}/projects/pkg",
|
||||
]
|
||||
EOF
|
||||
shell: bash
|
||||
- name: Install latest version with no-project
|
||||
id: setup-uv
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.13.1t
|
||||
activate-environment: true
|
||||
no-project: true
|
||||
- name: Verify packages can be installed
|
||||
run: uv pip install pip
|
||||
shell: bash
|
||||
- name: Verify output venv is set
|
||||
run: |
|
||||
if [ -z "$UV_VENV" ]; then
|
||||
echo "output venv is not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$UV_VENV" ]; then
|
||||
echo "output venv not point to a directory: $UV_VENV"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
env:
|
||||
UV_VENV: ${{ steps.setup-uv.outputs.venv }}
|
||||
|
||||
test-debian-unstable:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:unstable
|
||||
@@ -818,6 +861,20 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test-download-from-astral-mirror-false:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install with download-from-astral-mirror disabled
|
||||
id: setup-uv
|
||||
uses: ./
|
||||
with:
|
||||
download-from-astral-mirror: false
|
||||
- name: Verify uv is installed
|
||||
run: uv --version
|
||||
|
||||
test-absolute-path:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -1057,6 +1114,7 @@ jobs:
|
||||
- test-python-version
|
||||
- test-activate-environment
|
||||
- test-activate-environment-custom-path
|
||||
- test-activate-environment-no-project
|
||||
- test-debian-unstable
|
||||
- test-musl
|
||||
- test-cache-key-os-version
|
||||
@@ -1075,6 +1133,7 @@ jobs:
|
||||
- test-restore-cache-restore-cache-false
|
||||
- test-no-python-version
|
||||
- test-custom-manifest-file
|
||||
- test-download-from-astral-mirror-false
|
||||
- test-absolute-path
|
||||
- test-relative-path
|
||||
- test-cache-prune-force
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
name: "Update docs"
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
update-docs:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: true
|
||||
- name: Get tag info
|
||||
id: tag-info
|
||||
run: |
|
||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||
COMMIT_SHA=$(git rev-list -n 1 "$TAG_NAME")
|
||||
echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
echo "sha=$COMMIT_SHA" >> "$GITHUB_OUTPUT"
|
||||
- name: Update references in docs
|
||||
run: |
|
||||
OLD_REF=$(grep -oh 'astral-sh/setup-uv@[a-f0-9]\{40\} # v[0-9][^ ]*' README.md docs/*.md | head -1)
|
||||
OLD_SHA=$(echo "$OLD_REF" | sed 's/astral-sh\/setup-uv@\([a-f0-9]*\) # .*/\1/')
|
||||
OLD_VERSION=$(echo "$OLD_REF" | sed 's/astral-sh\/setup-uv@[a-f0-9]* # \(v[^ ]*\)/\1/')
|
||||
echo "Replacing $OLD_SHA # $OLD_VERSION with $NEW_SHA # $NEW_VERSION"
|
||||
find README.md docs/ -type f \( -name "*.md" \) -exec \
|
||||
sed -i "s|$OLD_SHA # $OLD_VERSION|$NEW_SHA # $NEW_VERSION|g" {} +
|
||||
env:
|
||||
NEW_SHA: ${{ steps.tag-info.outputs.sha }}
|
||||
NEW_VERSION: ${{ steps.tag-info.outputs.tag }}
|
||||
- name: Check for changes
|
||||
id: changes-exist
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "changes-exist=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "changes-exist=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Commit and push changes
|
||||
if: ${{ steps.changes-exist.outputs.changes-exist == 'true' }}
|
||||
id: commit-and-push
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git add .
|
||||
git commit -m "docs: update version references to $NEW_VERSION"
|
||||
git push origin HEAD:refs/heads/main
|
||||
env:
|
||||
NEW_VERSION: ${{ steps.tag-info.outputs.tag }}
|
||||
- name: Create Pull Request
|
||||
if: ${{ steps.changes-exist.outputs.changes-exist == 'true' && steps.commit-and-push.outcome != 'success' }}
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
commit-message: "docs: update version references to ${{ steps.tag-info.outputs.tag }}"
|
||||
title: "docs: update version references to ${{ steps.tag-info.outputs.tag }}"
|
||||
body: |
|
||||
Update `uses: astral-sh/setup-uv@...` references in documentation to
|
||||
`${{ steps.tag-info.outputs.sha }} # ${{ steps.tag-info.outputs.tag }}`.
|
||||
base: main
|
||||
labels: "automated-pr,update-docs"
|
||||
branch: update-docs-${{ steps.tag-info.outputs.tag }}
|
||||
delete-branch: true
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: true
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
|
||||
- name: Create Pull Request
|
||||
if: ${{ steps.changes-exist.outputs.changes-exist == 'true' && steps.commit-and-push.outcome != 'success' }}
|
||||
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
commit-message: "chore: update known checksums"
|
||||
title:
|
||||
|
||||
@@ -7,7 +7,7 @@ This repository is a TypeScript-based GitHub Action for installing `uv` in GitHu
|
||||
1. `npm ci --ignore-scripts`
|
||||
2. `npm run all`
|
||||
- `npm run check` uses Biome (not ESLint/Prettier) and rewrites files in place.
|
||||
- User-facing changes are usually multi-file changes. If you add or change inputs, outputs, or behavior, update `action.yml`, the implementation in `src/`, tests in `__tests__/`, relevant docs/README, and then re-package.
|
||||
- User-facing changes are usually multi-file changes. If you add or change inputs, outputs, or behavior, update `action.yml`, `action-types.yml`, the implementation in `src/`, tests in `__tests__/`, relevant docs/README, and then re-package.
|
||||
- The easiest areas to regress are version resolution and caching. When touching them, add or update tests for precedence, cache invalidation, and cross-platform path behavior.
|
||||
- Workflow edits have extra CI-only checks (`actionlint` and `zizmor`); `npm run all` does not cover them.
|
||||
- Source is authored with bundler-friendly TypeScript, but published action artifacts in `dist/` are bundled as CommonJS for maximum GitHub Actions runtime compatibility with `@actions/*` dependencies.
|
||||
|
||||
@@ -26,7 +26,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
```
|
||||
|
||||
If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
|
||||
@@ -42,7 +42,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
|
||||
```yaml
|
||||
- name: Install uv with all available options
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
# The version of uv to install (default: searches for version in config files, then latest)
|
||||
version: ""
|
||||
@@ -62,6 +62,9 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
# Custom path for the virtual environment when using activate-environment (default: .venv in the working directory)
|
||||
venv-path: ""
|
||||
|
||||
# Pass --no-project when creating the venv with activate-environment.
|
||||
no-project: "false"
|
||||
|
||||
# The directory to execute all commands in and look for files such as pyproject.toml
|
||||
working-directory: ""
|
||||
|
||||
@@ -117,8 +120,14 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
# URL to a custom manifest file in the astral-sh/versions format
|
||||
manifest-file: ""
|
||||
|
||||
# Download uv from the Astral mirror instead of directly from GitHub Releases
|
||||
download-from-astral-mirror: "true"
|
||||
|
||||
# Add problem matchers
|
||||
add-problem-matchers: "true"
|
||||
|
||||
# Suppress info-level log output. Only warnings and errors are shown
|
||||
quiet: "false"
|
||||
```
|
||||
|
||||
### Outputs
|
||||
@@ -139,7 +148,7 @@ This will override any python version specifications in `pyproject.toml` and `.p
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv and set the python version to 3.13t
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
python-version: 3.13t
|
||||
- run: uv pip install --python=3.13t pip
|
||||
@@ -157,7 +166,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install the latest version of uv and set the python version
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Test with python ${{ matrix.python-version }}
|
||||
@@ -174,7 +183,7 @@ It also controls where [the venv gets created](#activate-environment), unless `v
|
||||
|
||||
```yaml
|
||||
- name: Install uv based on the config files in the working-directory
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
working-directory: my/subproject/dir
|
||||
```
|
||||
@@ -216,7 +225,7 @@ For example:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@main
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Test
|
||||
@@ -228,7 +237,7 @@ To install a specific version of Python, use
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Install Python 3.12
|
||||
@@ -247,7 +256,7 @@ output:
|
||||
uses: actions/checkout@main
|
||||
- name: Install the default version of uv
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
- name: Print the installed version
|
||||
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
||||
```
|
||||
|
||||
@@ -95,6 +95,35 @@ describe("download-version", () => {
|
||||
expect(mockGetAllVersions).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it("treats == exact pins as explicit versions", async () => {
|
||||
const version = await resolveVersion("==0.9.26", undefined);
|
||||
|
||||
expect(version).toBe("0.9.26");
|
||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||
expect(mockGetLatestVersion).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses latest for minimum-only ranges when using the highest strategy", async () => {
|
||||
mockGetLatestVersion.mockResolvedValue("0.9.26");
|
||||
|
||||
const version = await resolveVersion(">=0.9.0", undefined, "highest");
|
||||
|
||||
expect(version).toBe("0.9.26");
|
||||
expect(mockGetLatestVersion).toHaveBeenCalledTimes(1);
|
||||
expect(mockGetLatestVersion).toHaveBeenCalledWith(undefined);
|
||||
expect(mockGetAllVersions).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses the lowest compatible version when requested", async () => {
|
||||
mockGetAllVersions.mockResolvedValue(["0.9.26", "0.9.25"]);
|
||||
|
||||
const version = await resolveVersion("^0.9.0", undefined, "lowest");
|
||||
|
||||
expect(version).toBe("0.9.25");
|
||||
expect(mockGetAllVersions).toHaveBeenCalledTimes(1);
|
||||
expect(mockGetAllVersions).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it("uses manifest-file when provided", async () => {
|
||||
mockGetAllVersions.mockResolvedValue(["0.9.26", "0.9.25"]);
|
||||
|
||||
@@ -194,7 +223,7 @@ describe("download-version", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("does not rewrite non-GitHub URLs", async () => {
|
||||
it("does not send the token to non-GitHub URLs from the default manifest", async () => {
|
||||
mockGetArtifact.mockResolvedValue({
|
||||
archiveFormat: "tar.gz",
|
||||
checksum: "abc123",
|
||||
@@ -212,8 +241,30 @@ describe("download-version", () => {
|
||||
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 () => {
|
||||
@@ -325,6 +376,32 @@ describe("download-version", () => {
|
||||
"0.9.26",
|
||||
);
|
||||
});
|
||||
|
||||
it("skips the Astral mirror when downloadFromAstralMirror is false", 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",
|
||||
undefined,
|
||||
false,
|
||||
);
|
||||
|
||||
expect(mockDownloadTool).toHaveBeenCalledWith(
|
||||
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
undefined,
|
||||
"token",
|
||||
);
|
||||
expect(mockDownloadTool).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("rewriteToMirror", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from "@jest/globals";
|
||||
import { getUvVersionFromFile } from "../../src/version/resolve";
|
||||
import { getUvVersionFromFile } from "../../src/version/file-parser";
|
||||
|
||||
test("ignores dependencies starting with uv", async () => {
|
||||
const parsedVersion = getUvVersionFromFile(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from "@jest/globals";
|
||||
import { getUvVersionFromFile } from "../../src/version/resolve";
|
||||
import { getUvVersionFromFile } from "../../src/version/file-parser";
|
||||
|
||||
test("ignores dependencies starting with uv", async () => {
|
||||
const parsedVersion = getUvVersionFromFile(
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "@jest/globals";
|
||||
import { resolveVersionRequest } from "../../src/version/version-request-resolver";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
function createTempProject(files: Record<string, string> = {}): string {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "setup-uv-version-test-"));
|
||||
tempDirs.push(dir);
|
||||
|
||||
for (const [relativePath, content] of Object.entries(files)) {
|
||||
const filePath = path.join(dir, relativePath);
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
fs.writeFileSync(filePath, content);
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const dir of tempDirs.splice(0)) {
|
||||
fs.rmSync(dir, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe("resolveVersionRequest", () => {
|
||||
it("prefers explicit input over version-file and workspace config", () => {
|
||||
const workingDirectory = createTempProject({
|
||||
".tool-versions": "uv 0.4.0\n",
|
||||
"pyproject.toml": `[tool.uv]\nrequired-version = "==0.5.14"\n`,
|
||||
"uv.toml": `required-version = "==0.5.15"\n`,
|
||||
});
|
||||
|
||||
const request = resolveVersionRequest({
|
||||
version: "==0.6.0",
|
||||
versionFile: path.join(workingDirectory, ".tool-versions"),
|
||||
workingDirectory,
|
||||
});
|
||||
|
||||
expect(request).toEqual({
|
||||
source: "input",
|
||||
specifier: "0.6.0",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses .tool-versions when it is passed via version-file", () => {
|
||||
const workingDirectory = createTempProject({
|
||||
".tool-versions": "uv 0.5.15\n",
|
||||
});
|
||||
|
||||
const request = resolveVersionRequest({
|
||||
versionFile: path.join(workingDirectory, ".tool-versions"),
|
||||
workingDirectory,
|
||||
});
|
||||
|
||||
expect(request).toEqual({
|
||||
format: ".tool-versions",
|
||||
source: "version-file",
|
||||
sourcePath: path.join(workingDirectory, ".tool-versions"),
|
||||
specifier: "0.5.15",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses requirements.txt when it is passed via version-file", () => {
|
||||
const workingDirectory = createTempProject({
|
||||
"requirements.txt": "uv==0.6.17\nuvicorn==0.35.0\n",
|
||||
});
|
||||
|
||||
const request = resolveVersionRequest({
|
||||
versionFile: path.join(workingDirectory, "requirements.txt"),
|
||||
workingDirectory,
|
||||
});
|
||||
|
||||
expect(request).toEqual({
|
||||
format: "requirements",
|
||||
source: "version-file",
|
||||
sourcePath: path.join(workingDirectory, "requirements.txt"),
|
||||
specifier: "0.6.17",
|
||||
});
|
||||
});
|
||||
|
||||
it("prefers uv.toml over pyproject.toml during workspace discovery", () => {
|
||||
const workingDirectory = createTempProject({
|
||||
"pyproject.toml": `[tool.uv]\nrequired-version = "==0.5.14"\n`,
|
||||
"uv.toml": `required-version = "==0.5.15"\n`,
|
||||
});
|
||||
|
||||
const request = resolveVersionRequest({ workingDirectory });
|
||||
|
||||
expect(request).toEqual({
|
||||
format: "uv.toml",
|
||||
source: "uv.toml",
|
||||
sourcePath: path.join(workingDirectory, "uv.toml"),
|
||||
specifier: "0.5.15",
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to latest when no version source is found", () => {
|
||||
const workingDirectory = createTempProject({});
|
||||
|
||||
const request = resolveVersionRequest({ workingDirectory });
|
||||
|
||||
expect(request).toEqual({
|
||||
source: "default",
|
||||
specifier: "latest",
|
||||
});
|
||||
});
|
||||
|
||||
it("throws when version-file does not resolve a version", () => {
|
||||
const workingDirectory = createTempProject({
|
||||
"requirements.txt": "uvicorn==0.35.0\n",
|
||||
});
|
||||
|
||||
expect(() =>
|
||||
resolveVersionRequest({
|
||||
versionFile: path.join(workingDirectory, "requirements.txt"),
|
||||
workingDirectory,
|
||||
}),
|
||||
).toThrow(
|
||||
`Could not determine uv version from file: ${path.join(workingDirectory, "requirements.txt")}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -11,6 +11,8 @@ inputs:
|
||||
type: boolean
|
||||
venv-path:
|
||||
type: string
|
||||
no-project:
|
||||
type: boolean
|
||||
working-directory:
|
||||
type: string
|
||||
checksum:
|
||||
@@ -50,8 +52,12 @@ inputs:
|
||||
type: string
|
||||
manifest-file:
|
||||
type: string
|
||||
download-from-astral-mirror:
|
||||
type: boolean
|
||||
add-problem-matchers:
|
||||
type: boolean
|
||||
quiet:
|
||||
type: boolean
|
||||
resolution-strategy:
|
||||
type: enum
|
||||
allowed-values:
|
||||
|
||||
@@ -18,6 +18,9 @@ inputs:
|
||||
venv-path:
|
||||
description: "Custom path for the virtual environment when using activate-environment. Defaults to '.venv' in the working directory."
|
||||
default: ""
|
||||
no-project:
|
||||
description: "Pass --no-project when creating the venv with activate-environment."
|
||||
default: "false"
|
||||
working-directory:
|
||||
description: "The directory to execute all commands in and look for files such as pyproject.toml"
|
||||
default: ${{ github.workspace }}
|
||||
@@ -77,9 +80,15 @@ inputs:
|
||||
manifest-file:
|
||||
description: "URL to a custom manifest file in the astral-sh/versions format."
|
||||
required: false
|
||||
download-from-astral-mirror:
|
||||
description: "Download uv from the Astral mirror instead of directly from GitHub Releases."
|
||||
default: "true"
|
||||
add-problem-matchers:
|
||||
description: "Add problem matchers."
|
||||
default: "true"
|
||||
quiet:
|
||||
description: "Suppress info-level log output. Only warnings and errors are shown."
|
||||
default: "false"
|
||||
resolution-strategy:
|
||||
description: "Resolution strategy to use when resolving version ranges. 'highest' uses the latest compatible version, 'lowest' uses the oldest compatible version."
|
||||
default: "highest"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
|
||||
"assist": {
|
||||
"actions": {
|
||||
"source": {
|
||||
|
||||
+196
-150
@@ -133,7 +133,7 @@ var require_tunnel = __commonJS({
|
||||
connectOptions.headers = connectOptions.headers || {};
|
||||
connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64");
|
||||
}
|
||||
debug2("making CONNECT request");
|
||||
debug3("making CONNECT request");
|
||||
var connectReq = self2.request(connectOptions);
|
||||
connectReq.useChunkedEncodingByDefault = false;
|
||||
connectReq.once("response", onResponse);
|
||||
@@ -153,7 +153,7 @@ var require_tunnel = __commonJS({
|
||||
connectReq.removeAllListeners();
|
||||
socket.removeAllListeners();
|
||||
if (res.statusCode !== 200) {
|
||||
debug2(
|
||||
debug3(
|
||||
"tunneling socket could not be established, statusCode=%d",
|
||||
res.statusCode
|
||||
);
|
||||
@@ -165,7 +165,7 @@ var require_tunnel = __commonJS({
|
||||
return;
|
||||
}
|
||||
if (head.length > 0) {
|
||||
debug2("got illegal response body from proxy");
|
||||
debug3("got illegal response body from proxy");
|
||||
socket.destroy();
|
||||
var error2 = new Error("got illegal response body from proxy");
|
||||
error2.code = "ECONNRESET";
|
||||
@@ -173,13 +173,13 @@ var require_tunnel = __commonJS({
|
||||
self2.removeSocket(placeholder);
|
||||
return;
|
||||
}
|
||||
debug2("tunneling connection has established");
|
||||
debug3("tunneling connection has established");
|
||||
self2.sockets[self2.sockets.indexOf(placeholder)] = socket;
|
||||
return cb(socket);
|
||||
}
|
||||
function onError(cause) {
|
||||
connectReq.removeAllListeners();
|
||||
debug2(
|
||||
debug3(
|
||||
"tunneling socket could not be established, cause=%s\n",
|
||||
cause.message,
|
||||
cause.stack
|
||||
@@ -241,9 +241,9 @@ var require_tunnel = __commonJS({
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var debug2;
|
||||
var debug3;
|
||||
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
||||
debug2 = function() {
|
||||
debug3 = function() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (typeof args[0] === "string") {
|
||||
args[0] = "TUNNEL: " + args[0];
|
||||
@@ -253,10 +253,10 @@ var require_tunnel = __commonJS({
|
||||
console.error.apply(console, args);
|
||||
};
|
||||
} else {
|
||||
debug2 = function() {
|
||||
debug3 = function() {
|
||||
};
|
||||
}
|
||||
exports2.debug = debug2;
|
||||
exports2.debug = debug3;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18936,7 +18936,7 @@ var require_minimatch = __commonJS({
|
||||
}
|
||||
this.parseNegate();
|
||||
var set = this.globSet = this.braceExpand();
|
||||
if (options.debug) this.debug = function debug2() {
|
||||
if (options.debug) this.debug = function debug3() {
|
||||
console.error.apply(console, arguments);
|
||||
};
|
||||
this.debug(this.pattern, set);
|
||||
@@ -19414,9 +19414,9 @@ var require_constants6 = __commonJS({
|
||||
var require_debug = __commonJS({
|
||||
"node_modules/@actions/cache/node_modules/semver/internal/debug.js"(exports2, module2) {
|
||||
"use strict";
|
||||
var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
||||
var debug3 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
||||
};
|
||||
module2.exports = debug2;
|
||||
module2.exports = debug3;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19429,7 +19429,7 @@ var require_re = __commonJS({
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_LENGTH
|
||||
} = require_constants6();
|
||||
var debug2 = require_debug();
|
||||
var debug3 = require_debug();
|
||||
exports2 = module2.exports = {};
|
||||
var re = exports2.re = [];
|
||||
var safeRe = exports2.safeRe = [];
|
||||
@@ -19452,7 +19452,7 @@ var require_re = __commonJS({
|
||||
var createToken = (name, value, isGlobal) => {
|
||||
const safe = makeSafeRegex(value);
|
||||
const index = R++;
|
||||
debug2(name, index, value);
|
||||
debug3(name, index, value);
|
||||
t[name] = index;
|
||||
src[index] = value;
|
||||
safeSrc[index] = safe;
|
||||
@@ -19556,7 +19556,7 @@ var require_identifiers = __commonJS({
|
||||
var require_semver = __commonJS({
|
||||
"node_modules/@actions/cache/node_modules/semver/classes/semver.js"(exports2, module2) {
|
||||
"use strict";
|
||||
var debug2 = require_debug();
|
||||
var debug3 = require_debug();
|
||||
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants6();
|
||||
var { safeRe: re, t } = require_re();
|
||||
var parseOptions = require_parse_options();
|
||||
@@ -19578,7 +19578,7 @@ var require_semver = __commonJS({
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
);
|
||||
}
|
||||
debug2("SemVer", version3, options);
|
||||
debug3("SemVer", version3, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
this.includePrerelease = !!options.includePrerelease;
|
||||
@@ -19626,7 +19626,7 @@ var require_semver = __commonJS({
|
||||
return this.version;
|
||||
}
|
||||
compare(other) {
|
||||
debug2("SemVer.compare", this.version, this.options, other);
|
||||
debug3("SemVer.compare", this.version, this.options, other);
|
||||
if (!(other instanceof _SemVer)) {
|
||||
if (typeof other === "string" && other === this.version) {
|
||||
return 0;
|
||||
@@ -19677,7 +19677,7 @@ var require_semver = __commonJS({
|
||||
do {
|
||||
const a = this.prerelease[i];
|
||||
const b = other.prerelease[i];
|
||||
debug2("prerelease compare", i, a, b);
|
||||
debug3("prerelease compare", i, a, b);
|
||||
if (a === void 0 && b === void 0) {
|
||||
return 0;
|
||||
} else if (b === void 0) {
|
||||
@@ -19699,7 +19699,7 @@ var require_semver = __commonJS({
|
||||
do {
|
||||
const a = this.build[i];
|
||||
const b = other.build[i];
|
||||
debug2("build compare", i, a, b);
|
||||
debug3("build compare", i, a, b);
|
||||
if (a === void 0 && b === void 0) {
|
||||
return 0;
|
||||
} else if (b === void 0) {
|
||||
@@ -20327,21 +20327,21 @@ var require_range = __commonJS({
|
||||
const loose = this.options.loose;
|
||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
||||
range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
|
||||
debug2("hyphen replace", range2);
|
||||
debug3("hyphen replace", range2);
|
||||
range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
||||
debug2("comparator trim", range2);
|
||||
debug3("comparator trim", range2);
|
||||
range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace);
|
||||
debug2("tilde trim", range2);
|
||||
debug3("tilde trim", range2);
|
||||
range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace);
|
||||
debug2("caret trim", range2);
|
||||
debug3("caret trim", range2);
|
||||
let rangeList = range2.split(" ").map((comp26) => parseComparator(comp26, this.options)).join(" ").split(/\s+/).map((comp26) => replaceGTE0(comp26, this.options));
|
||||
if (loose) {
|
||||
rangeList = rangeList.filter((comp26) => {
|
||||
debug2("loose invalid filter", comp26, this.options);
|
||||
debug3("loose invalid filter", comp26, this.options);
|
||||
return !!comp26.match(re[t.COMPARATORLOOSE]);
|
||||
});
|
||||
}
|
||||
debug2("range list", rangeList);
|
||||
debug3("range list", rangeList);
|
||||
const rangeMap = /* @__PURE__ */ new Map();
|
||||
const comparators = rangeList.map((comp26) => new Comparator(comp26, this.options));
|
||||
for (const comp26 of comparators) {
|
||||
@@ -20396,7 +20396,7 @@ var require_range = __commonJS({
|
||||
var cache = new LRU();
|
||||
var parseOptions = require_parse_options();
|
||||
var Comparator = require_comparator();
|
||||
var debug2 = require_debug();
|
||||
var debug3 = require_debug();
|
||||
var SemVer = require_semver();
|
||||
var {
|
||||
safeRe: re,
|
||||
@@ -20422,15 +20422,15 @@ var require_range = __commonJS({
|
||||
};
|
||||
var parseComparator = (comp26, options) => {
|
||||
comp26 = comp26.replace(re[t.BUILD], "");
|
||||
debug2("comp", comp26, options);
|
||||
debug3("comp", comp26, options);
|
||||
comp26 = replaceCarets(comp26, options);
|
||||
debug2("caret", comp26);
|
||||
debug3("caret", comp26);
|
||||
comp26 = replaceTildes(comp26, options);
|
||||
debug2("tildes", comp26);
|
||||
debug3("tildes", comp26);
|
||||
comp26 = replaceXRanges(comp26, options);
|
||||
debug2("xrange", comp26);
|
||||
debug3("xrange", comp26);
|
||||
comp26 = replaceStars(comp26, options);
|
||||
debug2("stars", comp26);
|
||||
debug3("stars", comp26);
|
||||
return comp26;
|
||||
};
|
||||
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
||||
@@ -20440,7 +20440,7 @@ var require_range = __commonJS({
|
||||
var replaceTilde = (comp26, options) => {
|
||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
||||
return comp26.replace(r, (_, M, m, p, pr) => {
|
||||
debug2("tilde", comp26, _, M, m, p, pr);
|
||||
debug3("tilde", comp26, _, M, m, p, pr);
|
||||
let ret;
|
||||
if (isX(M)) {
|
||||
ret = "";
|
||||
@@ -20449,12 +20449,12 @@ var require_range = __commonJS({
|
||||
} else if (isX(p)) {
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
||||
} else if (pr) {
|
||||
debug2("replaceTilde pr", pr);
|
||||
debug3("replaceTilde pr", pr);
|
||||
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
||||
}
|
||||
debug2("tilde return", ret);
|
||||
debug3("tilde return", ret);
|
||||
return ret;
|
||||
});
|
||||
};
|
||||
@@ -20462,11 +20462,11 @@ var require_range = __commonJS({
|
||||
return comp26.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
||||
};
|
||||
var replaceCaret = (comp26, options) => {
|
||||
debug2("caret", comp26, options);
|
||||
debug3("caret", comp26, options);
|
||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
||||
const z = options.includePrerelease ? "-0" : "";
|
||||
return comp26.replace(r, (_, M, m, p, pr) => {
|
||||
debug2("caret", comp26, _, M, m, p, pr);
|
||||
debug3("caret", comp26, _, M, m, p, pr);
|
||||
let ret;
|
||||
if (isX(M)) {
|
||||
ret = "";
|
||||
@@ -20479,7 +20479,7 @@ var require_range = __commonJS({
|
||||
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
||||
}
|
||||
} else if (pr) {
|
||||
debug2("replaceCaret pr", pr);
|
||||
debug3("replaceCaret pr", pr);
|
||||
if (M === "0") {
|
||||
if (m === "0") {
|
||||
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
||||
@@ -20490,7 +20490,7 @@ var require_range = __commonJS({
|
||||
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
||||
}
|
||||
} else {
|
||||
debug2("no pr");
|
||||
debug3("no pr");
|
||||
if (M === "0") {
|
||||
if (m === "0") {
|
||||
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
||||
@@ -20501,19 +20501,19 @@ var require_range = __commonJS({
|
||||
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
||||
}
|
||||
}
|
||||
debug2("caret return", ret);
|
||||
debug3("caret return", ret);
|
||||
return ret;
|
||||
});
|
||||
};
|
||||
var replaceXRanges = (comp26, options) => {
|
||||
debug2("replaceXRanges", comp26, options);
|
||||
debug3("replaceXRanges", comp26, options);
|
||||
return comp26.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
||||
};
|
||||
var replaceXRange = (comp26, options) => {
|
||||
comp26 = comp26.trim();
|
||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
||||
return comp26.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||
debug2("xRange", comp26, ret, gtlt, M, m, p, pr);
|
||||
debug3("xRange", comp26, ret, gtlt, M, m, p, pr);
|
||||
const xM = isX(M);
|
||||
const xm = xM || isX(m);
|
||||
const xp = xm || isX(p);
|
||||
@@ -20560,16 +20560,16 @@ var require_range = __commonJS({
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
||||
}
|
||||
debug2("xRange return", ret);
|
||||
debug3("xRange return", ret);
|
||||
return ret;
|
||||
});
|
||||
};
|
||||
var replaceStars = (comp26, options) => {
|
||||
debug2("replaceStars", comp26, options);
|
||||
debug3("replaceStars", comp26, options);
|
||||
return comp26.trim().replace(re[t.STAR], "");
|
||||
};
|
||||
var replaceGTE0 = (comp26, options) => {
|
||||
debug2("replaceGTE0", comp26, options);
|
||||
debug3("replaceGTE0", comp26, options);
|
||||
return comp26.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
||||
};
|
||||
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
||||
@@ -20607,7 +20607,7 @@ var require_range = __commonJS({
|
||||
}
|
||||
if (version3.prerelease.length && !options.includePrerelease) {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
debug2(set[i].semver);
|
||||
debug3(set[i].semver);
|
||||
if (set[i].semver === Comparator.ANY) {
|
||||
continue;
|
||||
}
|
||||
@@ -20644,7 +20644,7 @@ var require_comparator = __commonJS({
|
||||
}
|
||||
}
|
||||
comp26 = comp26.trim().split(/\s+/).join(" ");
|
||||
debug2("comparator", comp26, options);
|
||||
debug3("comparator", comp26, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
this.parse(comp26);
|
||||
@@ -20653,7 +20653,7 @@ var require_comparator = __commonJS({
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version;
|
||||
}
|
||||
debug2("comp", this);
|
||||
debug3("comp", this);
|
||||
}
|
||||
parse(comp26) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
||||
@@ -20675,7 +20675,7 @@ var require_comparator = __commonJS({
|
||||
return this.value;
|
||||
}
|
||||
test(version3) {
|
||||
debug2("Comparator.test", version3, this.options.loose);
|
||||
debug3("Comparator.test", version3, this.options.loose);
|
||||
if (this.semver === ANY || version3 === ANY) {
|
||||
return true;
|
||||
}
|
||||
@@ -20732,7 +20732,7 @@ var require_comparator = __commonJS({
|
||||
var parseOptions = require_parse_options();
|
||||
var { safeRe: re, t } = require_re();
|
||||
var cmp = require_cmp();
|
||||
var debug2 = require_debug();
|
||||
var debug3 = require_debug();
|
||||
var SemVer = require_semver();
|
||||
var Range = require_range();
|
||||
}
|
||||
@@ -21456,11 +21456,11 @@ var require_common = __commonJS({
|
||||
let enableOverride = null;
|
||||
let namespacesCache;
|
||||
let enabledCache;
|
||||
function debug2(...args) {
|
||||
if (!debug2.enabled) {
|
||||
function debug3(...args) {
|
||||
if (!debug3.enabled) {
|
||||
return;
|
||||
}
|
||||
const self2 = debug2;
|
||||
const self2 = debug3;
|
||||
const curr = Number(/* @__PURE__ */ new Date());
|
||||
const ms = curr - (prevTime || curr);
|
||||
self2.diff = ms;
|
||||
@@ -21490,12 +21490,12 @@ var require_common = __commonJS({
|
||||
const logFn = self2.log || createDebug.log;
|
||||
logFn.apply(self2, args);
|
||||
}
|
||||
debug2.namespace = namespace;
|
||||
debug2.useColors = createDebug.useColors();
|
||||
debug2.color = createDebug.selectColor(namespace);
|
||||
debug2.extend = extend2;
|
||||
debug2.destroy = createDebug.destroy;
|
||||
Object.defineProperty(debug2, "enabled", {
|
||||
debug3.namespace = namespace;
|
||||
debug3.useColors = createDebug.useColors();
|
||||
debug3.color = createDebug.selectColor(namespace);
|
||||
debug3.extend = extend2;
|
||||
debug3.destroy = createDebug.destroy;
|
||||
Object.defineProperty(debug3, "enabled", {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get: () => {
|
||||
@@ -21513,9 +21513,9 @@ var require_common = __commonJS({
|
||||
}
|
||||
});
|
||||
if (typeof createDebug.init === "function") {
|
||||
createDebug.init(debug2);
|
||||
createDebug.init(debug3);
|
||||
}
|
||||
return debug2;
|
||||
return debug3;
|
||||
}
|
||||
function extend2(namespace, delimiter3) {
|
||||
const newDebug = createDebug(this.namespace + (typeof delimiter3 === "undefined" ? ":" : delimiter3) + namespace);
|
||||
@@ -22025,11 +22025,11 @@ var require_node = __commonJS({
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
function init(debug2) {
|
||||
debug2.inspectOpts = {};
|
||||
function init(debug3) {
|
||||
debug3.inspectOpts = {};
|
||||
const keys = Object.keys(exports2.inspectOpts);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
debug2.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
|
||||
debug3.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
module2.exports = require_common()(exports2);
|
||||
@@ -22292,7 +22292,7 @@ var require_parse_proxy_response = __commonJS({
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.parseProxyResponse = void 0;
|
||||
var debug_1 = __importDefault(require_src());
|
||||
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
||||
var debug3 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
||||
function parseProxyResponse(socket) {
|
||||
return new Promise((resolve2, reject) => {
|
||||
let buffersLength = 0;
|
||||
@@ -22311,12 +22311,12 @@ var require_parse_proxy_response = __commonJS({
|
||||
}
|
||||
function onend() {
|
||||
cleanup();
|
||||
debug2("onend");
|
||||
debug3("onend");
|
||||
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
||||
}
|
||||
function onerror(err) {
|
||||
cleanup();
|
||||
debug2("onerror %o", err);
|
||||
debug3("onerror %o", err);
|
||||
reject(err);
|
||||
}
|
||||
function ondata(b) {
|
||||
@@ -22325,7 +22325,7 @@ var require_parse_proxy_response = __commonJS({
|
||||
const buffered = Buffer.concat(buffers, buffersLength);
|
||||
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
||||
if (endOfHeaders === -1) {
|
||||
debug2("have not received end of HTTP headers yet...");
|
||||
debug3("have not received end of HTTP headers yet...");
|
||||
read();
|
||||
return;
|
||||
}
|
||||
@@ -22358,7 +22358,7 @@ var require_parse_proxy_response = __commonJS({
|
||||
headers[key] = value;
|
||||
}
|
||||
}
|
||||
debug2("got proxy server response: %o %o", firstLine, headers);
|
||||
debug3("got proxy server response: %o %o", firstLine, headers);
|
||||
cleanup();
|
||||
resolve2({
|
||||
connect: {
|
||||
@@ -22421,7 +22421,7 @@ var require_dist2 = __commonJS({
|
||||
var agent_base_1 = require_dist();
|
||||
var url_1 = require("url");
|
||||
var parse_proxy_response_1 = require_parse_proxy_response();
|
||||
var debug2 = (0, debug_1.default)("https-proxy-agent");
|
||||
var debug3 = (0, debug_1.default)("https-proxy-agent");
|
||||
var setServernameFromNonIpHost = (options) => {
|
||||
if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
|
||||
return {
|
||||
@@ -22437,7 +22437,7 @@ var require_dist2 = __commonJS({
|
||||
this.options = { path: void 0 };
|
||||
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
||||
this.proxyHeaders = opts?.headers ?? {};
|
||||
debug2("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
||||
debug3("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
||||
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
||||
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
||||
this.connectOpts = {
|
||||
@@ -22459,10 +22459,10 @@ var require_dist2 = __commonJS({
|
||||
}
|
||||
let socket;
|
||||
if (proxy.protocol === "https:") {
|
||||
debug2("Creating `tls.Socket`: %o", this.connectOpts);
|
||||
debug3("Creating `tls.Socket`: %o", this.connectOpts);
|
||||
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
||||
} else {
|
||||
debug2("Creating `net.Socket`: %o", this.connectOpts);
|
||||
debug3("Creating `net.Socket`: %o", this.connectOpts);
|
||||
socket = net.connect(this.connectOpts);
|
||||
}
|
||||
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
||||
@@ -22490,7 +22490,7 @@ var require_dist2 = __commonJS({
|
||||
if (connect.statusCode === 200) {
|
||||
req.once("socket", resume);
|
||||
if (opts.secureEndpoint) {
|
||||
debug2("Upgrading socket connection to TLS");
|
||||
debug3("Upgrading socket connection to TLS");
|
||||
return tls.connect({
|
||||
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
||||
socket
|
||||
@@ -22502,7 +22502,7 @@ var require_dist2 = __commonJS({
|
||||
const fakeSocket = new net.Socket({ writable: false });
|
||||
fakeSocket.readable = true;
|
||||
req.once("socket", (s) => {
|
||||
debug2("Replaying proxy buffer for failed request");
|
||||
debug3("Replaying proxy buffer for failed request");
|
||||
(0, assert_1.default)(s.listenerCount("data") > 0);
|
||||
s.push(buffered);
|
||||
s.push(null);
|
||||
@@ -22570,13 +22570,13 @@ var require_dist3 = __commonJS({
|
||||
var events_1 = require("events");
|
||||
var agent_base_1 = require_dist();
|
||||
var url_1 = require("url");
|
||||
var debug2 = (0, debug_1.default)("http-proxy-agent");
|
||||
var debug3 = (0, debug_1.default)("http-proxy-agent");
|
||||
var HttpProxyAgent2 = class extends agent_base_1.Agent {
|
||||
constructor(proxy, opts) {
|
||||
super(opts);
|
||||
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
||||
this.proxyHeaders = opts?.headers ?? {};
|
||||
debug2("Creating new HttpProxyAgent instance: %o", this.proxy.href);
|
||||
debug3("Creating new HttpProxyAgent instance: %o", this.proxy.href);
|
||||
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
||||
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
||||
this.connectOpts = {
|
||||
@@ -22622,21 +22622,21 @@ var require_dist3 = __commonJS({
|
||||
}
|
||||
let first;
|
||||
let endOfHeaders;
|
||||
debug2("Regenerating stored HTTP header string for request");
|
||||
debug3("Regenerating stored HTTP header string for request");
|
||||
req._implicitHeader();
|
||||
if (req.outputData && req.outputData.length > 0) {
|
||||
debug2("Patching connection write() output buffer with updated header");
|
||||
debug3("Patching connection write() output buffer with updated header");
|
||||
first = req.outputData[0].data;
|
||||
endOfHeaders = first.indexOf("\r\n\r\n") + 4;
|
||||
req.outputData[0].data = req._header + first.substring(endOfHeaders);
|
||||
debug2("Output buffer: %o", req.outputData[0].data);
|
||||
debug3("Output buffer: %o", req.outputData[0].data);
|
||||
}
|
||||
let socket;
|
||||
if (this.proxy.protocol === "https:") {
|
||||
debug2("Creating `tls.Socket`: %o", this.connectOpts);
|
||||
debug3("Creating `tls.Socket`: %o", this.connectOpts);
|
||||
socket = tls.connect(this.connectOpts);
|
||||
} else {
|
||||
debug2("Creating `net.Socket`: %o", this.connectOpts);
|
||||
debug3("Creating `net.Socket`: %o", this.connectOpts);
|
||||
socket = net.connect(this.connectOpts);
|
||||
}
|
||||
await (0, events_1.once)(socket, "connect");
|
||||
@@ -24039,9 +24039,9 @@ var require_reflection_type_check = __commonJS({
|
||||
var reflection_info_1 = require_reflection_info();
|
||||
var oneof_1 = require_oneof();
|
||||
var ReflectionTypeCheck = class {
|
||||
constructor(info2) {
|
||||
constructor(info3) {
|
||||
var _a;
|
||||
this.fields = (_a = info2.fields) !== null && _a !== void 0 ? _a : [];
|
||||
this.fields = (_a = info3.fields) !== null && _a !== void 0 ? _a : [];
|
||||
}
|
||||
prepare() {
|
||||
if (this.data)
|
||||
@@ -24287,8 +24287,8 @@ var require_reflection_json_reader = __commonJS({
|
||||
var assert_1 = require_assert();
|
||||
var reflection_long_convert_1 = require_reflection_long_convert();
|
||||
var ReflectionJsonReader = class {
|
||||
constructor(info2) {
|
||||
this.info = info2;
|
||||
constructor(info3) {
|
||||
this.info = info3;
|
||||
}
|
||||
prepare() {
|
||||
var _a;
|
||||
@@ -24584,9 +24584,9 @@ var require_reflection_json_writer = __commonJS({
|
||||
var reflection_info_1 = require_reflection_info();
|
||||
var assert_1 = require_assert();
|
||||
var ReflectionJsonWriter = class {
|
||||
constructor(info2) {
|
||||
constructor(info3) {
|
||||
var _a;
|
||||
this.fields = (_a = info2.fields) !== null && _a !== void 0 ? _a : [];
|
||||
this.fields = (_a = info3.fields) !== null && _a !== void 0 ? _a : [];
|
||||
}
|
||||
/**
|
||||
* Converts the message to a JSON object, based on the field descriptors.
|
||||
@@ -24839,8 +24839,8 @@ var require_reflection_binary_reader = __commonJS({
|
||||
var reflection_long_convert_1 = require_reflection_long_convert();
|
||||
var reflection_scalar_default_1 = require_reflection_scalar_default();
|
||||
var ReflectionBinaryReader = class {
|
||||
constructor(info2) {
|
||||
this.info = info2;
|
||||
constructor(info3) {
|
||||
this.info = info3;
|
||||
}
|
||||
prepare() {
|
||||
var _a;
|
||||
@@ -25013,8 +25013,8 @@ var require_reflection_binary_writer = __commonJS({
|
||||
var assert_1 = require_assert();
|
||||
var pb_long_1 = require_pb_long();
|
||||
var ReflectionBinaryWriter = class {
|
||||
constructor(info2) {
|
||||
this.info = info2;
|
||||
constructor(info3) {
|
||||
this.info = info3;
|
||||
}
|
||||
prepare() {
|
||||
if (!this.fields) {
|
||||
@@ -25264,9 +25264,9 @@ var require_reflection_merge_partial = __commonJS({
|
||||
"use strict";
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.reflectionMergePartial = void 0;
|
||||
function reflectionMergePartial4(info2, target, source) {
|
||||
function reflectionMergePartial4(info3, target, source) {
|
||||
let fieldValue, input = source, output;
|
||||
for (let field of info2.fields) {
|
||||
for (let field of info3.fields) {
|
||||
let name = field.localName;
|
||||
if (field.oneof) {
|
||||
const group = input[field.oneof];
|
||||
@@ -25335,12 +25335,12 @@ var require_reflection_equals = __commonJS({
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.reflectionEquals = void 0;
|
||||
var reflection_info_1 = require_reflection_info();
|
||||
function reflectionEquals(info2, a, b) {
|
||||
function reflectionEquals(info3, a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
if (!a || !b)
|
||||
return false;
|
||||
for (let field of info2.fields) {
|
||||
for (let field of info3.fields) {
|
||||
let localName = field.localName;
|
||||
let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
|
||||
let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
|
||||
@@ -28045,12 +28045,12 @@ var HttpClient = class {
|
||||
throw new Error("Client has already been disposed.");
|
||||
}
|
||||
const parsedUrl = new URL(requestUrl);
|
||||
let info2 = this._prepareRequest(verb, parsedUrl, headers);
|
||||
let info3 = this._prepareRequest(verb, parsedUrl, headers);
|
||||
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1;
|
||||
let numTries = 0;
|
||||
let response;
|
||||
do {
|
||||
response = yield this.requestRaw(info2, data);
|
||||
response = yield this.requestRaw(info3, data);
|
||||
if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {
|
||||
let authenticationHandler;
|
||||
for (const handler of this.handlers) {
|
||||
@@ -28060,7 +28060,7 @@ var HttpClient = class {
|
||||
}
|
||||
}
|
||||
if (authenticationHandler) {
|
||||
return authenticationHandler.handleAuthentication(this, info2, data);
|
||||
return authenticationHandler.handleAuthentication(this, info3, data);
|
||||
} else {
|
||||
return response;
|
||||
}
|
||||
@@ -28083,8 +28083,8 @@ var HttpClient = class {
|
||||
}
|
||||
}
|
||||
}
|
||||
info2 = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||
response = yield this.requestRaw(info2, data);
|
||||
info3 = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||
response = yield this.requestRaw(info3, data);
|
||||
redirectsRemaining--;
|
||||
}
|
||||
if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) {
|
||||
@@ -28113,7 +28113,7 @@ var HttpClient = class {
|
||||
* @param info
|
||||
* @param data
|
||||
*/
|
||||
requestRaw(info2, data) {
|
||||
requestRaw(info3, data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise((resolve2, reject) => {
|
||||
function callbackForResult(err, res) {
|
||||
@@ -28125,7 +28125,7 @@ var HttpClient = class {
|
||||
resolve2(res);
|
||||
}
|
||||
}
|
||||
this.requestRawWithCallback(info2, data, callbackForResult);
|
||||
this.requestRawWithCallback(info3, data, callbackForResult);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -28135,12 +28135,12 @@ var HttpClient = class {
|
||||
* @param data
|
||||
* @param onResult
|
||||
*/
|
||||
requestRawWithCallback(info2, data, onResult) {
|
||||
requestRawWithCallback(info3, data, onResult) {
|
||||
if (typeof data === "string") {
|
||||
if (!info2.options.headers) {
|
||||
info2.options.headers = {};
|
||||
if (!info3.options.headers) {
|
||||
info3.options.headers = {};
|
||||
}
|
||||
info2.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8");
|
||||
info3.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8");
|
||||
}
|
||||
let callbackCalled = false;
|
||||
function handleResult(err, res) {
|
||||
@@ -28149,7 +28149,7 @@ var HttpClient = class {
|
||||
onResult(err, res);
|
||||
}
|
||||
}
|
||||
const req = info2.httpModule.request(info2.options, (msg) => {
|
||||
const req = info3.httpModule.request(info3.options, (msg) => {
|
||||
const res = new HttpClientResponse(msg);
|
||||
handleResult(void 0, res);
|
||||
});
|
||||
@@ -28161,7 +28161,7 @@ var HttpClient = class {
|
||||
if (socket) {
|
||||
socket.end();
|
||||
}
|
||||
handleResult(new Error(`Request timeout: ${info2.options.path}`));
|
||||
handleResult(new Error(`Request timeout: ${info3.options.path}`));
|
||||
});
|
||||
req.on("error", function(err) {
|
||||
handleResult(err);
|
||||
@@ -28197,27 +28197,27 @@ var HttpClient = class {
|
||||
return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
|
||||
}
|
||||
_prepareRequest(method, requestUrl, headers) {
|
||||
const info2 = {};
|
||||
info2.parsedUrl = requestUrl;
|
||||
const usingSsl = info2.parsedUrl.protocol === "https:";
|
||||
info2.httpModule = usingSsl ? https : http;
|
||||
const info3 = {};
|
||||
info3.parsedUrl = requestUrl;
|
||||
const usingSsl = info3.parsedUrl.protocol === "https:";
|
||||
info3.httpModule = usingSsl ? https : http;
|
||||
const defaultPort = usingSsl ? 443 : 80;
|
||||
info2.options = {};
|
||||
info2.options.host = info2.parsedUrl.hostname;
|
||||
info2.options.port = info2.parsedUrl.port ? parseInt(info2.parsedUrl.port) : defaultPort;
|
||||
info2.options.path = (info2.parsedUrl.pathname || "") + (info2.parsedUrl.search || "");
|
||||
info2.options.method = method;
|
||||
info2.options.headers = this._mergeHeaders(headers);
|
||||
info3.options = {};
|
||||
info3.options.host = info3.parsedUrl.hostname;
|
||||
info3.options.port = info3.parsedUrl.port ? parseInt(info3.parsedUrl.port) : defaultPort;
|
||||
info3.options.path = (info3.parsedUrl.pathname || "") + (info3.parsedUrl.search || "");
|
||||
info3.options.method = method;
|
||||
info3.options.headers = this._mergeHeaders(headers);
|
||||
if (this.userAgent != null) {
|
||||
info2.options.headers["user-agent"] = this.userAgent;
|
||||
info3.options.headers["user-agent"] = this.userAgent;
|
||||
}
|
||||
info2.options.agent = this._getAgent(info2.parsedUrl);
|
||||
info3.options.agent = this._getAgent(info3.parsedUrl);
|
||||
if (this.handlers) {
|
||||
for (const handler of this.handlers) {
|
||||
handler.prepareRequest(info2.options);
|
||||
handler.prepareRequest(info3.options);
|
||||
}
|
||||
}
|
||||
return info2;
|
||||
return info3;
|
||||
}
|
||||
_mergeHeaders(headers) {
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
@@ -30601,14 +30601,14 @@ function disable() {
|
||||
return result;
|
||||
}
|
||||
function createDebugger(namespace) {
|
||||
const newDebugger = Object.assign(debug2, {
|
||||
const newDebugger = Object.assign(debug3, {
|
||||
enabled: enabled(namespace),
|
||||
destroy,
|
||||
log: debugObj.log,
|
||||
namespace,
|
||||
extend
|
||||
});
|
||||
function debug2(...args) {
|
||||
function debug3(...args) {
|
||||
if (!newDebugger.enabled) {
|
||||
return;
|
||||
}
|
||||
@@ -34098,12 +34098,12 @@ function getOperationRequestInfo(request) {
|
||||
if (hasOriginalRequest(request)) {
|
||||
return getOperationRequestInfo(request[originalRequestSymbol]);
|
||||
}
|
||||
let info2 = state2.operationRequestMap.get(request);
|
||||
if (!info2) {
|
||||
info2 = {};
|
||||
state2.operationRequestMap.set(request, info2);
|
||||
let info3 = state2.operationRequestMap.get(request);
|
||||
if (!info3) {
|
||||
info3 = {};
|
||||
state2.operationRequestMap.set(request, info3);
|
||||
}
|
||||
return info2;
|
||||
return info3;
|
||||
}
|
||||
|
||||
// node_modules/@azure/core-client/dist/esm/deserializationPolicy.js
|
||||
@@ -62241,6 +62241,21 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
||||
// src/save-cache.ts
|
||||
var pep440 = __toESM(require_pep440(), 1);
|
||||
|
||||
// src/utils/logging.ts
|
||||
var quiet;
|
||||
function isQuiet() {
|
||||
if (quiet === void 0) {
|
||||
quiet = typeof getInput === "function" && getInput("quiet") === "true";
|
||||
}
|
||||
return quiet;
|
||||
}
|
||||
function info2(msg) {
|
||||
if (!isQuiet()) {
|
||||
info(msg);
|
||||
}
|
||||
}
|
||||
var warning2 = warning;
|
||||
|
||||
// src/cache/restore-cache.ts
|
||||
var STATE_CACHE_KEY = "cache-key";
|
||||
var STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
@@ -62327,9 +62342,14 @@ function skipComment(str, ptr) {
|
||||
}
|
||||
function skipVoid(str, ptr, banNewLines, banComments) {
|
||||
let c;
|
||||
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
||||
ptr++;
|
||||
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
||||
while (1) {
|
||||
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
||||
ptr++;
|
||||
if (banComments || c !== "#")
|
||||
break;
|
||||
ptr = skipComment(str, ptr);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
function skipUntil(str, ptr, sep7, end, banNewLines = false) {
|
||||
if (!end) {
|
||||
@@ -62947,6 +62967,12 @@ function getConfigValueFromTomlFile(filePath, key) {
|
||||
return void 0;
|
||||
}
|
||||
const fileContent = import_node_fs2.default.readFileSync(filePath, "utf-8");
|
||||
return getConfigValueFromTomlContent(filePath, fileContent, key);
|
||||
}
|
||||
function getConfigValueFromTomlContent(filePath, fileContent, key) {
|
||||
if (!filePath.endsWith(".toml")) {
|
||||
return void 0;
|
||||
}
|
||||
if (filePath.endsWith("pyproject.toml")) {
|
||||
const tomlContent2 = parse2(fileContent);
|
||||
return tomlContent2?.tool?.uv?.[key];
|
||||
@@ -62962,6 +62988,7 @@ function loadInputs() {
|
||||
const versionFile = getVersionFile(workingDirectory);
|
||||
const pythonVersion = getInput("python-version");
|
||||
const activateEnvironment = getBooleanInput("activate-environment");
|
||||
const noProject = getBooleanInput("no-project");
|
||||
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
||||
const checksum = getInput("checksum");
|
||||
const enableCache = getEnableCache();
|
||||
@@ -62983,7 +63010,9 @@ function loadInputs() {
|
||||
const pythonDir = getUvPythonDir();
|
||||
const githubToken = getInput("github-token");
|
||||
const manifestFile = getManifestFile();
|
||||
const downloadFromAstralMirror = getInput("download-from-astral-mirror") === "true";
|
||||
const addProblemMatchers = getInput("add-problem-matchers") === "true";
|
||||
const quiet2 = getInput("quiet") === "true";
|
||||
const resolutionStrategy = getResolutionStrategy();
|
||||
return {
|
||||
activateEnvironment,
|
||||
@@ -62993,14 +63022,17 @@ function loadInputs() {
|
||||
cachePython,
|
||||
cacheSuffix,
|
||||
checksum,
|
||||
downloadFromAstralMirror,
|
||||
enableCache,
|
||||
githubToken,
|
||||
ignoreEmptyWorkdir,
|
||||
ignoreNothingToCache,
|
||||
manifestFile,
|
||||
noProject,
|
||||
pruneCache: pruneCache2,
|
||||
pythonDir,
|
||||
pythonVersion,
|
||||
quiet: quiet2,
|
||||
resolutionStrategy,
|
||||
restoreCache: restoreCache2,
|
||||
saveCache: saveCache4,
|
||||
@@ -63024,7 +63056,7 @@ function getVenvPath(workingDirectory, activateEnvironment) {
|
||||
const venvPathInput = getInput("venv-path");
|
||||
if (venvPathInput !== "") {
|
||||
if (!activateEnvironment) {
|
||||
warning("venv-path is only used when activate-environment is true");
|
||||
warning2("venv-path is only used when activate-environment is true");
|
||||
}
|
||||
const tildeExpanded = expandTilde(venvPathInput);
|
||||
return normalizePath(resolveRelativePath(workingDirectory, tildeExpanded));
|
||||
@@ -63087,7 +63119,7 @@ function getCacheLocalPath(workingDirectory, versionFile, enableCache) {
|
||||
return { path: cacheDirFromConfig, source: 1 /* Config */ };
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR !== void 0) {
|
||||
info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
info2(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
return { path: process.env.UV_CACHE_DIR, source: 2 /* Env */ };
|
||||
}
|
||||
if (enableCache) {
|
||||
@@ -63120,12 +63152,12 @@ function getCacheDirFromConfig(workingDirectory, versionFile) {
|
||||
try {
|
||||
const cacheDir = getConfigValueFromTomlFile(resolvedPath, "cache-dir");
|
||||
if (cacheDir !== void 0) {
|
||||
info(`Found cache-dir in ${resolvedPath}: ${cacheDir}`);
|
||||
info2(`Found cache-dir in ${resolvedPath}: ${cacheDir}`);
|
||||
return cacheDir;
|
||||
}
|
||||
} catch (err) {
|
||||
const message = err.message;
|
||||
warning(`Error while parsing ${filePath}: ${message}`);
|
||||
warning2(`Error while parsing ${filePath}: ${message}`);
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
@@ -63133,7 +63165,7 @@ function getCacheDirFromConfig(workingDirectory, versionFile) {
|
||||
}
|
||||
function getUvPythonDir() {
|
||||
if (process.env.UV_PYTHON_INSTALL_DIR !== void 0) {
|
||||
info(
|
||||
info2(
|
||||
`UV_PYTHON_INSTALL_DIR is already set to ${process.env.UV_PYTHON_INSTALL_DIR}`
|
||||
);
|
||||
return process.env.UV_PYTHON_INSTALL_DIR;
|
||||
@@ -63203,6 +63235,22 @@ function getResolutionStrategy() {
|
||||
}
|
||||
|
||||
// src/save-cache.ts
|
||||
function formatUnexpectedFailure(error2) {
|
||||
if (error2 instanceof Error) {
|
||||
return error2.stack ?? error2.message;
|
||||
}
|
||||
return String(error2);
|
||||
}
|
||||
function failUnexpectedly(event, error2) {
|
||||
setFailed(`${event}: ${formatUnexpectedFailure(error2)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
process.on("uncaughtException", (error2) => {
|
||||
failUnexpectedly("Uncaught exception", error2);
|
||||
});
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
failUnexpectedly("Unhandled promise rejection", reason);
|
||||
});
|
||||
async function run() {
|
||||
try {
|
||||
const inputs = loadInputs();
|
||||
@@ -63210,9 +63258,9 @@ async function run() {
|
||||
if (inputs.saveCache) {
|
||||
await saveCache3(inputs);
|
||||
} else {
|
||||
info("save-cache is false. Skipping save cache step.");
|
||||
info2("save-cache is false. Skipping save cache step.");
|
||||
}
|
||||
await new Promise((resolve2) => setTimeout(resolve2, 50));
|
||||
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
||||
process.exit(0);
|
||||
}
|
||||
} catch (error2) {
|
||||
@@ -63224,11 +63272,11 @@ async function saveCache3(inputs) {
|
||||
const cacheKey = getState(STATE_CACHE_KEY);
|
||||
const matchedKey = getState(STATE_CACHE_MATCHED_KEY);
|
||||
if (!cacheKey) {
|
||||
warning("Error retrieving cache key from state.");
|
||||
warning2("Error retrieving cache key from state.");
|
||||
return;
|
||||
}
|
||||
if (matchedKey === cacheKey) {
|
||||
info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
info2(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
} else {
|
||||
if (inputs.pruneCache) {
|
||||
await pruneCache();
|
||||
@@ -63236,7 +63284,7 @@ async function saveCache3(inputs) {
|
||||
const actualCachePath = getUvCachePath(inputs);
|
||||
if (!fs7.existsSync(actualCachePath)) {
|
||||
if (inputs.ignoreNothingToCache) {
|
||||
info(
|
||||
info2(
|
||||
"No cacheable uv cache paths were found. Ignoring because ignore-nothing-to-cache is enabled."
|
||||
);
|
||||
} else {
|
||||
@@ -63255,7 +63303,7 @@ async function saveCache3(inputs) {
|
||||
}
|
||||
if (inputs.cachePython) {
|
||||
if (!fs7.existsSync(inputs.pythonDir)) {
|
||||
warning(
|
||||
warning2(
|
||||
`Python cache path ${inputs.pythonDir} does not exist on disk. Skipping Python cache save because no managed Python installation was found. If you want uv to install managed Python instead of using a system interpreter, set UV_PYTHON_PREFERENCE=only-managed.`
|
||||
);
|
||||
return;
|
||||
@@ -63278,7 +63326,7 @@ async function pruneCache() {
|
||||
if (forceSupported) {
|
||||
execArgs.push("--force");
|
||||
}
|
||||
info("Pruning cache...");
|
||||
info2("Pruning cache...");
|
||||
const uvPath = getState(STATE_UV_PATH);
|
||||
await exec(uvPath, execArgs, options);
|
||||
}
|
||||
@@ -63289,7 +63337,7 @@ function getUvCachePath(inputs) {
|
||||
);
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR && process.env.UV_CACHE_DIR !== inputs.cacheLocalPath.path) {
|
||||
warning(
|
||||
warning2(
|
||||
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${inputs.cacheLocalPath.path}".`
|
||||
);
|
||||
return process.env.UV_CACHE_DIR;
|
||||
@@ -63299,14 +63347,12 @@ function getUvCachePath(inputs) {
|
||||
async function saveCacheToKey(cacheKey, cachePath, stateKey, cacheName) {
|
||||
const matchedKey = getState(stateKey);
|
||||
if (matchedKey === cacheKey) {
|
||||
info(
|
||||
`${cacheName} hit occurred on key ${cacheKey}, not saving cache.`
|
||||
);
|
||||
info2(`${cacheName} hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
info(`Including ${cacheName} path: ${cachePath}`);
|
||||
info2(`Including ${cacheName} path: ${cachePath}`);
|
||||
await saveCache2([cachePath], cacheKey);
|
||||
info(`${cacheName} saved with key: ${cacheKey}`);
|
||||
info2(`${cacheName} saved with key: ${cacheKey}`);
|
||||
}
|
||||
run();
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
|
||||
+5241
-3933
File diff suppressed because one or more lines are too long
+2650
-1590
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@ This document covers advanced options for configuring which version of uv to ins
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: "latest"
|
||||
```
|
||||
@@ -15,7 +15,7 @@ This document covers advanced options for configuring which version of uv to ins
|
||||
|
||||
```yaml
|
||||
- name: Install a specific version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: "0.4.4"
|
||||
```
|
||||
@@ -28,21 +28,21 @@ to install the latest version that satisfies the range.
|
||||
|
||||
```yaml
|
||||
- name: Install a semver range of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: ">=0.4.0"
|
||||
```
|
||||
|
||||
```yaml
|
||||
- name: Pinning a minor version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: "0.4.x"
|
||||
```
|
||||
|
||||
```yaml
|
||||
- name: Install a pep440-specifier-satisfying version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: ">=0.4.25,<0.5"
|
||||
```
|
||||
@@ -54,7 +54,7 @@ You can change this behavior using the `resolution-strategy` input:
|
||||
|
||||
```yaml
|
||||
- name: Install the lowest compatible version of uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: ">=0.4.0"
|
||||
resolution-strategy: "lowest"
|
||||
@@ -76,7 +76,7 @@ uv defined as a dependency in `pyproject.toml` or `requirements.txt`.
|
||||
|
||||
```yaml
|
||||
- name: Install uv based on the version defined in pyproject.toml
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version-file: "pyproject.toml"
|
||||
```
|
||||
|
||||
+18
-13
@@ -23,7 +23,7 @@ The computed cache key is available as the `cache-key` output:
|
||||
```yaml
|
||||
- name: Setup uv
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Print cache key
|
||||
@@ -50,7 +50,7 @@ You can optionally define a custom cache key suffix.
|
||||
```yaml
|
||||
- name: Enable caching and define a custom cache key suffix
|
||||
id: setup-uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-suffix: "optional-suffix"
|
||||
@@ -89,7 +89,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define a cache dependency glob
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "**/pyproject.toml"
|
||||
@@ -97,7 +97,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define a list of cache dependency globs
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: |
|
||||
@@ -107,7 +107,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Define an absolute cache dependency glob
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
|
||||
@@ -115,7 +115,7 @@ changes. If you use relative paths, they are relative to the working directory.
|
||||
|
||||
```yaml
|
||||
- name: Never invalidate the cache
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: ""
|
||||
@@ -128,7 +128,7 @@ By default, the cache will be restored.
|
||||
|
||||
```yaml
|
||||
- name: Don't restore an existing cache
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
restore-cache: false
|
||||
@@ -142,7 +142,7 @@ By default, the cache will be saved.
|
||||
|
||||
```yaml
|
||||
- name: Don't save the cache after the run
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
save-cache: false
|
||||
@@ -168,7 +168,7 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
|
||||
|
||||
```yaml
|
||||
- name: Define a custom uv cache path
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
cache-local-path: "/path/to/cache"
|
||||
```
|
||||
@@ -187,7 +187,7 @@ input.
|
||||
|
||||
```yaml
|
||||
- name: Don't prune the cache before saving it
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
prune-cache: false
|
||||
@@ -205,7 +205,7 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
|
||||
|
||||
```yaml
|
||||
- name: Cache Python installs
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-python: true
|
||||
@@ -213,12 +213,17 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
|
||||
|
||||
## Ignore nothing to cache
|
||||
|
||||
By default, the action will fail if caching is enabled but there is nothing to upload (the uv cache directory does not exist).
|
||||
By default, the action will fail if caching is enabled but there is nothing to upload (the uv cache directory does not exist) with an error like
|
||||
|
||||
```console
|
||||
Error: Cache path /home/runner/.cache/uv does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.
|
||||
```
|
||||
|
||||
If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
|
||||
|
||||
```yaml
|
||||
- name: Ignore nothing to cache
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
enable-cache: true
|
||||
ignore-nothing-to-cache: true
|
||||
|
||||
@@ -10,7 +10,7 @@ are automatically verified by this action. The sha256 hashes can be found on the
|
||||
|
||||
```yaml
|
||||
- name: Install a specific version and validate the checksum
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
version: "0.3.1"
|
||||
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
||||
@@ -39,7 +39,7 @@ The `archive_format` field is currently ignored.
|
||||
|
||||
```yaml
|
||||
- name: Use a custom manifest file
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
manifest-file: "https://example.com/my-custom-manifest.ndjson"
|
||||
```
|
||||
@@ -58,7 +58,7 @@ You can disable this by setting the `add-problem-matchers` input to `false`.
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv without problem matchers
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
add-problem-matchers: false
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ This allows directly using it in later steps:
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv and activate the environment
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
- run: uv pip install pip
|
||||
@@ -20,7 +20,7 @@ By default, the venv is created at `.venv` inside the `working-directory`.
|
||||
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
|
||||
|
||||
```yaml
|
||||
- uses: astral-sh/setup-uv@v7
|
||||
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
venv-path: ${{ runner.temp }}/custom-venv
|
||||
@@ -51,7 +51,7 @@ are not sufficient, you can provide a custom GitHub token with the necessary per
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom GitHub token
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
```
|
||||
@@ -69,7 +69,7 @@ input:
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom tool dir
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
tool-dir: "/path/to/tool/dir"
|
||||
```
|
||||
@@ -88,7 +88,7 @@ If you want to change this behaviour (especially on self-hosted runners) you can
|
||||
|
||||
```yaml
|
||||
- name: Install the latest version of uv with a custom tool bin dir
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
tool-bin-dir: "/path/to/tool-bin/dir"
|
||||
```
|
||||
@@ -105,7 +105,7 @@ This action supports expanding the `~` character to the user's home directory fo
|
||||
|
||||
```yaml
|
||||
- name: Expand the tilde character
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
cache-local-path: "~/path/to/cache"
|
||||
tool-dir: "~/path/to/tool/dir"
|
||||
@@ -122,7 +122,7 @@ If you want to ignore this, set the `ignore-empty-workdir` input to `true`.
|
||||
|
||||
```yaml
|
||||
- name: Ignore empty workdir
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
ignore-empty-workdir: true
|
||||
```
|
||||
@@ -145,7 +145,7 @@ This action sets several environment variables that influence uv's behavior and
|
||||
|
||||
```yaml
|
||||
- name: Example using environment variables
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
tool-dir: "/custom/tool/dir"
|
||||
|
||||
Generated
+325
-325
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -35,19 +35,19 @@
|
||||
"@actions/io": "^3.0.2",
|
||||
"@actions/tool-cache": "^4.0.0",
|
||||
"@renovatebot/pep440": "^4.2.2",
|
||||
"smol-toml": "^1.6.0",
|
||||
"undici": "^7.24.2"
|
||||
"smol-toml": "^1.6.1",
|
||||
"undici": "^8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.4.7",
|
||||
"@biomejs/biome": "^2.4.15",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^25.5.0",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"esbuild": "^0.27.4",
|
||||
"esbuild": "^0.28.0",
|
||||
"jest": "^30.3.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"ts-jest": "^29.4.6",
|
||||
"ts-jest": "^29.4.11",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+8
-7
@@ -2,6 +2,7 @@ import * as cache from "@actions/cache";
|
||||
import * as core from "@actions/core";
|
||||
import { hashFiles } from "../hash/hash-files";
|
||||
import type { SetupInputs } from "../utils/inputs";
|
||||
import * as log from "../utils/logging";
|
||||
import { getArch, getOSNameVersion, getPlatform } from "../utils/platforms";
|
||||
|
||||
export const STATE_CACHE_KEY = "cache-key";
|
||||
@@ -19,7 +20,7 @@ export async function restoreCache(
|
||||
core.setOutput("cache-key", cacheKey);
|
||||
|
||||
if (!inputs.restoreCache) {
|
||||
core.info("restore-cache is false. Skipping restore cache step.");
|
||||
log.info("restore-cache is false. Skipping restore cache step.");
|
||||
core.setOutput("python-cache-hit", false);
|
||||
return;
|
||||
}
|
||||
@@ -55,7 +56,7 @@ async function restoreCacheFromKey(
|
||||
stateKey: string,
|
||||
outputKey: string,
|
||||
): Promise<void> {
|
||||
core.info(
|
||||
log.info(
|
||||
`Trying to restore cache from GitHub Actions cache with key: ${cacheKey}`,
|
||||
);
|
||||
let matchedKey: string | undefined;
|
||||
@@ -63,7 +64,7 @@ async function restoreCacheFromKey(
|
||||
matchedKey = await cache.restoreCache([cachePath], cacheKey);
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
core.warning(message);
|
||||
log.warning(message);
|
||||
core.setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
@@ -77,7 +78,7 @@ async function computeKeys(
|
||||
): Promise<string> {
|
||||
let cacheDependencyPathHash = "-";
|
||||
if (inputs.cacheDependencyGlob !== "") {
|
||||
core.info(
|
||||
log.info(
|
||||
`Searching files using cache dependency glob: ${inputs.cacheDependencyGlob.split("\n").join(",")}`,
|
||||
);
|
||||
cacheDependencyPathHash += await hashFiles(
|
||||
@@ -85,7 +86,7 @@ async function computeKeys(
|
||||
true,
|
||||
);
|
||||
if (cacheDependencyPathHash === "-") {
|
||||
core.warning(
|
||||
log.warning(
|
||||
`No file matched to [${inputs.cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`,
|
||||
);
|
||||
}
|
||||
@@ -109,12 +110,12 @@ function handleMatchResult(
|
||||
outputKey: string,
|
||||
): void {
|
||||
if (!matchedKey) {
|
||||
core.info(`No GitHub Actions cache found for key: ${primaryKey}`);
|
||||
log.info(`No GitHub Actions cache found for key: ${primaryKey}`);
|
||||
core.setOutput(outputKey, false);
|
||||
return;
|
||||
}
|
||||
|
||||
core.saveState(stateKey, matchedKey);
|
||||
core.info(`cache restored from GitHub Actions cache with key: ${matchedKey}`);
|
||||
log.info(`cache restored from GitHub Actions cache with key: ${matchedKey}`);
|
||||
core.setOutput(outputKey, true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,581 @@
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
||||
"aarch64-apple-darwin-0.11.18":
|
||||
"1a7adf8dadae3b55853115d13a8bf564d219597ad13824b93b213706933863e5",
|
||||
"aarch64-pc-windows-msvc-0.11.18":
|
||||
"0689e1a40d36b387522d2b1b865cd98a15ddd4a7507e256ad93be6f6a335fec1",
|
||||
"aarch64-unknown-linux-gnu-0.11.18":
|
||||
"0f03c6648df1c159557f4222c0f37250f84733fb88d6fc3c16770e17c177a8c9",
|
||||
"aarch64-unknown-linux-musl-0.11.18":
|
||||
"6d895725333680bf7633ad635baff8e49dc45d3b52e00b2b3adf6ced41f2ebe2",
|
||||
"arm-unknown-linux-musleabihf-0.11.18":
|
||||
"c4fe354b28c489fa6649531808076c43eb3a34122df49b0a3005bb75dbf101c3",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.18":
|
||||
"a70a8b1124dc1fabcce9f2bbe6591c72a05d49df74125d1c327b5745f2becbb6",
|
||||
"armv7-unknown-linux-musleabihf-0.11.18":
|
||||
"f8b6f4df3ff9d142a25892be575ade438672a8353ad71997f7db88e9b9a1062d",
|
||||
"i686-pc-windows-msvc-0.11.18":
|
||||
"7505112a7bf72f50391c50f2aa07950b95b3c43c7d9fd4da5626876407d15dda",
|
||||
"i686-unknown-linux-gnu-0.11.18":
|
||||
"5f3df0d62af1d174a06b82a6faf1a5e9a1f729b87d11c7d9cd87d4241e04f23d",
|
||||
"i686-unknown-linux-musl-0.11.18":
|
||||
"4237cfcd03fb8767a7ec713ab3db14381d83bbd0bf5ccc88cd6f28ac8c2c616f",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.18":
|
||||
"fc8f46a198e540ca2d89fd9480da0648d673ff3e25b4048c82ca5c292a478052",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.18":
|
||||
"cdb0555db7828bbd1dc24e55171b8ac3dbbc24fe17b6a7387783cd4d543a1538",
|
||||
"riscv64gc-unknown-linux-musl-0.11.18":
|
||||
"3d5b533080bb593c82b281b8d289e29d51b97c0994655099845752e948181fe2",
|
||||
"s390x-unknown-linux-gnu-0.11.18":
|
||||
"7a91aa963680f2fe14ebf89291cf8eafcff634eccdeb6d301e0252b282171818",
|
||||
"x86_64-apple-darwin-0.11.18":
|
||||
"00a61e3db99b53c927a7e6c4ccdccb898aa3253d07928822211e9dc570a25661",
|
||||
"x86_64-pc-windows-msvc-0.11.18":
|
||||
"bf8e0021336b7c77bd80a078b612125f385b08f541437edaea8c8ca9e574db0d",
|
||||
"x86_64-unknown-linux-gnu-0.11.18":
|
||||
"588f3e360f69ce02b6982aa99f2240e803933a6b7e176ac01617830adf955add",
|
||||
"x86_64-unknown-linux-musl-0.11.18":
|
||||
"a095a969fc8357f42e35652e0554525a47a29010ddb814bd82650c2ffa7d6d62",
|
||||
"aarch64-apple-darwin-0.11.17":
|
||||
"2a162f6b90ff3691a2f9cae1622e066a3ce592e110f66670cdcc841324b28226",
|
||||
"aarch64-pc-windows-msvc-0.11.17":
|
||||
"f4463aa9671c6d153d32f2a9b272389675a711a9bca806c4ab4a3c7559b045c2",
|
||||
"aarch64-unknown-linux-gnu-0.11.17":
|
||||
"de008880a903ac2c5654647dc19a75c0d6652313c977a2bc5ce05e1e3a93429e",
|
||||
"aarch64-unknown-linux-musl-0.11.17":
|
||||
"9e5eaf16ffad968fc689f18c2733ace914ed417d4e5572e92d807fd51a90228c",
|
||||
"arm-unknown-linux-musleabihf-0.11.17":
|
||||
"201c7d727423095aa4ba39cc79b16cac2465720d4348270a3977824009526179",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.17":
|
||||
"c941377b20fdd4b101376a9c8ce37c209d36655697815a32658a7cbcb3212409",
|
||||
"armv7-unknown-linux-musleabihf-0.11.17":
|
||||
"12606cc40d15c5ab5fd06e434c8ee1b0ef7e3ca3cd4d5b2b135a16dd1a45fed2",
|
||||
"i686-pc-windows-msvc-0.11.17":
|
||||
"be48cd9aa35c8615eff3dba6a24e214edf00885150eacde032a258399131c59d",
|
||||
"i686-unknown-linux-gnu-0.11.17":
|
||||
"89f859f3bfaf3a74733aef671e6a4ade36173623d4539d3559e11caa2c722718",
|
||||
"i686-unknown-linux-musl-0.11.17":
|
||||
"8d2ecb44951b80861570f4a7f732c9f16f3b342450eeb0bd2eef876b10395400",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.17":
|
||||
"714c7b292c805231edbfc77ca14b29e6e469342236ef1cfb58fe7d6f8fed48a4",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.17":
|
||||
"f8bece740520b35f69c82653da77912b38a29a5634a6e0ce7d83122a485c6a6f",
|
||||
"riscv64gc-unknown-linux-musl-0.11.17":
|
||||
"ae07b4e9c2bea3dcba2e3267e9e4229e45de63c15e74eee7fac7ccf9df6e04cd",
|
||||
"s390x-unknown-linux-gnu-0.11.17":
|
||||
"10ec2070644dda19ab9c8dcc3d6f3bbf4b09ad6665b8a8be067d7fdb5a58b56c",
|
||||
"x86_64-apple-darwin-0.11.17":
|
||||
"6c66e41eaf4d15abeda58d3f268161b6e3f742d98390341b174a7cfc1b48841d",
|
||||
"x86_64-pc-windows-msvc-0.11.17":
|
||||
"35fc29e03e62f3cda769bc12773f3cb70ce305d0d36c0d8bd0c117dd0b3fcd14",
|
||||
"x86_64-unknown-linux-gnu-0.11.17":
|
||||
"0017ccecaeb4d431d7f93b583ebff0c5c38e00eb734fcf13d05f72ca419125fe",
|
||||
"x86_64-unknown-linux-musl-0.11.17":
|
||||
"4231a429d4e0f7c1937d8916658c08a7706cd7872afebeb87203a18c2e0dc28e",
|
||||
"aarch64-apple-darwin-0.11.16":
|
||||
"2b25be1af546be330b340b0a76b99f989daa6d92678fdffb87438e661e9d88fb",
|
||||
"aarch64-pc-windows-msvc-0.11.16":
|
||||
"e4f8e70eb21f0f4efd2eeb159ab289f9a16057d59881a4475758be4ce39bc8c5",
|
||||
"aarch64-unknown-linux-gnu-0.11.16":
|
||||
"8c9d0f0ee98166ae6ab198747519ba6f25db29d185bd2ae5960ecebc91a5c22a",
|
||||
"aarch64-unknown-linux-musl-0.11.16":
|
||||
"ac022d96411143b9a2dd75ea711fa8dd4cd14538bf248f2e5df3c10a80f7f6a4",
|
||||
"arm-unknown-linux-musleabihf-0.11.16":
|
||||
"cdd60c84597690139e3696461d1278bf4dcd598cd44e3896a98aa75aa59965bf",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.16":
|
||||
"71cf33cb511c9fe28ae261c0b4789e1fd9bb84d1bc68828db647b77305a15185",
|
||||
"armv7-unknown-linux-musleabihf-0.11.16":
|
||||
"f24fca34326c5b8f7ddc0001a40e5454bc8091ca67f9ce931ffdaef4ea4815e8",
|
||||
"i686-pc-windows-msvc-0.11.16":
|
||||
"7417090298bf202395b9b3d6eefb9230332d8d6c94a5616e531148a0b041c8e2",
|
||||
"i686-unknown-linux-gnu-0.11.16":
|
||||
"0d1e427cd3fcc042e85dfc75f6d95e076dff9b930241686969d6706afda21375",
|
||||
"i686-unknown-linux-musl-0.11.16":
|
||||
"d5e611deffd3f5fd637b2dc89dbe252342ce4a38c8970e63add8029afe2b5629",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.16":
|
||||
"8a3b09ce14d14a75dbbf051cdb78a314fb579e78fb3a02e1ee833c4cb5f6e81e",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.16":
|
||||
"0314895f159ce97bcedac00a4b97fa7e53c16fee911a6a2d9f0b69ee6461b7d5",
|
||||
"riscv64gc-unknown-linux-musl-0.11.16":
|
||||
"8a1aef4261011143f56c964eeaed5e06fa0cb95ff3005386381c610c91784feb",
|
||||
"s390x-unknown-linux-gnu-0.11.16":
|
||||
"d161e914ad552aed83478fe9766061844297dadfa77a43e56285a147bde0021e",
|
||||
"x86_64-apple-darwin-0.11.16":
|
||||
"6b91ae3de155f51bd1f5b74814821c79f016a176561f252cd9ddfb976939af2e",
|
||||
"x86_64-pc-windows-msvc-0.11.16":
|
||||
"dd9d6d6554bfab265bfa98aa8e8a406c5c3a7b97582f93de1f4d48d9154a0395",
|
||||
"x86_64-unknown-linux-gnu-0.11.16":
|
||||
"74947fe2c03315cf07e82ab3acc703eddef01aba4d5232a98e4c6825ec116131",
|
||||
"x86_64-unknown-linux-musl-0.11.16":
|
||||
"1bc4be1be0a000f893b0d1db97906cf392b63fa22fda9a0ecf33d0d4bbb4bc9a",
|
||||
"aarch64-apple-darwin-0.11.15":
|
||||
"7e5b336108f8576eda1939920ca0a805b4a9a3c3d3eb2f6140e38b7092fbe4f3",
|
||||
"aarch64-pc-windows-msvc-0.11.15":
|
||||
"9eac2d68f3a66326c3e1fc97ef28bd54f1d13136ec092c2f0a8173ae12aaaf1e",
|
||||
"aarch64-unknown-linux-gnu-0.11.15":
|
||||
"21a7dd1a03ea17ac0366887455dab15d215b31dba0870dcd65d3714e22f46c81",
|
||||
"aarch64-unknown-linux-musl-0.11.15":
|
||||
"6505075cec3f551fad4fe9026922967ff9c895c9f513c97682b24e7a1c9becd3",
|
||||
"arm-unknown-linux-musleabihf-0.11.15":
|
||||
"f9206848d617b7beec37c346624ad961d8d4110606990653ebbfc4c62b1f1741",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.15":
|
||||
"eb6a12e3e80e1474c1018edc9541bbe71cdf2248fa17b583dcbcc7bb391ad0c0",
|
||||
"armv7-unknown-linux-musleabihf-0.11.15":
|
||||
"a40ee3c41443341846137afc5c7f29be766a9a677bd70c7ff91cbb4273e5383c",
|
||||
"i686-pc-windows-msvc-0.11.15":
|
||||
"6a9431f0044a1ff59fd6920f6f982b691acf336b6e26ac8cd40a02b5ab839cd1",
|
||||
"i686-unknown-linux-gnu-0.11.15":
|
||||
"557e329e76072b513e47bcd8b50ca4bad07ec87cb325cbfc05e6069847af06c4",
|
||||
"i686-unknown-linux-musl-0.11.15":
|
||||
"69490ca5580958cdee3353b54357925913ec0540dc8e09819294b9e5b6d48556",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.15":
|
||||
"6be3637ef86cdee3f5fcfbc66681ecbf6d57c6a123398a1bdd09786d65a06016",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.15":
|
||||
"a43e22243e3f3b1fb136a0998b730367fe2589ea98ce6cd4f0d7d20b9f77fb5b",
|
||||
"riscv64gc-unknown-linux-musl-0.11.15":
|
||||
"2256c9b625d67a55986adda62b09782b5547e28a79fba472e7e93ac3ec0af258",
|
||||
"s390x-unknown-linux-gnu-0.11.15":
|
||||
"df2b69ed893ce00e242d8cfe5b9fdc7b7a42d578df487d09aa624563a9801578",
|
||||
"x86_64-apple-darwin-0.11.15":
|
||||
"42bca7cc879d117ed7139a0e26de8cab0b6f033ad439a32144f324d1f8580d8c",
|
||||
"x86_64-pc-windows-msvc-0.11.15":
|
||||
"04b98d414a9000e25e5e0e7c9f53749e66b790cdaffc582829e6f58c544ee11c",
|
||||
"x86_64-unknown-linux-gnu-0.11.15":
|
||||
"b03e572f010bea94a4a52d42671ba72981e12894f71576181a1d26ff68546da7",
|
||||
"x86_64-unknown-linux-musl-0.11.15":
|
||||
"200ccf2f351849c5d6698714e7e7eb9ead1e8c097dbdbb43730e1a4e059ceb87",
|
||||
"aarch64-apple-darwin-0.11.14":
|
||||
"4333af5c0730d94323a7819bbdf87ce92dd07fc857d67fff0059e0fca31b5c02",
|
||||
"aarch64-pc-windows-msvc-0.11.14":
|
||||
"d66c76ba912ba66fed011e0189dfbc4527dd9e620a2b5d5d5ecd2ad8936601b8",
|
||||
"aarch64-unknown-linux-gnu-0.11.14":
|
||||
"c4958f729e216f1610632574ed927b8cf0af1bd02cb88cb30d948571727aee43",
|
||||
"aarch64-unknown-linux-musl-0.11.14":
|
||||
"d7d3966e46915c5f6932692aaf152a2473eecb1d2517ca4f8e88a07484b380b6",
|
||||
"arm-unknown-linux-musleabihf-0.11.14":
|
||||
"31b07fa8bc5bbc8f22064fc1d4238b53c663bdb4812cbfead0b43719571aec03",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.14":
|
||||
"2aca3925d7ad91d2e02a0f9cf75974ebd077ec5cb939a5eb66aba096d5666819",
|
||||
"armv7-unknown-linux-musleabihf-0.11.14":
|
||||
"988d79544bbf55ebeaf6521d3cbf46957bcfbab998d22092ea860580639e2f30",
|
||||
"i686-pc-windows-msvc-0.11.14":
|
||||
"579408a1134ec3c45dd7b94187978b98b15df4e0c49ebf05c52565e3858d9f2a",
|
||||
"i686-unknown-linux-gnu-0.11.14":
|
||||
"8c93880c54dc7a632f602b7627d4338d80011ecf32e340fd2f67129df5325dc7",
|
||||
"i686-unknown-linux-musl-0.11.14":
|
||||
"c84acf1036767797a7be97a3315122b9565a78bf90b5733741b1abeefa58387f",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.14":
|
||||
"d2da5ba5911b86dfec96f0737b7d1053ed78c0c65e51585db03fb4969b2a3825",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.14":
|
||||
"55731359293842826cd82d5fbd826a6bce542c3fec458214604e308b352560ed",
|
||||
"riscv64gc-unknown-linux-musl-0.11.14":
|
||||
"86b053903d29a2d04441e4cbd05a8f690b8ec56f8959d27f15df13efffb5879b",
|
||||
"s390x-unknown-linux-gnu-0.11.14":
|
||||
"cc7b233541a76dd484516a39c06d9d14100d1048708483e6f49ee20b6cc5761b",
|
||||
"x86_64-apple-darwin-0.11.14":
|
||||
"9836c1440b0bd6aa5f81793648a339bd01d593b7b8f575de3b855dae4ab64654",
|
||||
"x86_64-pc-windows-msvc-0.11.14":
|
||||
"52ba5d19409aaa688a8a1a6ec8dfb6a4817230d20186e75f4006105c3e39a846",
|
||||
"x86_64-unknown-linux-gnu-0.11.14":
|
||||
"f3b623eb0e6141a7053d571d59a0bdc341e0f238ea8f5f0b4815ddbec9a2a296",
|
||||
"x86_64-unknown-linux-musl-0.11.14":
|
||||
"077d36f45a0cc6d440b653b2d5c53e7731121e99e54b0221267eec5d1cae76ce",
|
||||
"aarch64-apple-darwin-0.11.13":
|
||||
"196a58aa24da89144187670df7c407358028984537fbc2f8f2d8f7a2604980df",
|
||||
"aarch64-pc-windows-msvc-0.11.13":
|
||||
"07c3c997020430a9f287fc05ff4c63fd5744eec49df5392a34731ed1a0971f2e",
|
||||
"aarch64-unknown-linux-gnu-0.11.13":
|
||||
"12366407dc1fdba5179b10bd69c11ebfc2eff25791366089c0b2f5701056efc5",
|
||||
"aarch64-unknown-linux-musl-0.11.13":
|
||||
"bea8a97b1b3ed41491e075c1f474e7f0249582aa3f62849c4e874b5f34ddc95e",
|
||||
"arm-unknown-linux-musleabihf-0.11.13":
|
||||
"ee282adf170eb845821309ca6038fdd87a93dd25326f96efe6ea58a1b66a9064",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.13":
|
||||
"4761e38e3d5ca62e87ef13bc35ba169e6ebd126472482095405367b31be88945",
|
||||
"armv7-unknown-linux-musleabihf-0.11.13":
|
||||
"d54342a96dda65339b4f7b9e6bb7a27b81aeeffca14e5dfa7911d00fe4a3ead9",
|
||||
"i686-pc-windows-msvc-0.11.13":
|
||||
"a9b2d96a118a401c7dc5b717752a074b6324ddc9b36dcb2b60466a4e2912a3ba",
|
||||
"i686-unknown-linux-gnu-0.11.13":
|
||||
"630774d3fd255a219a6eef58f004201737c60f4b282777fb99e599cd90567fe4",
|
||||
"i686-unknown-linux-musl-0.11.13":
|
||||
"52cb28c81ca43ea5184f944c31555981cb29c03c2497fa848541af5ee4d8448f",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.13":
|
||||
"7f302104ea18a01381fe58434b593f887c4f10bc523ad50781de408fbec54354",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.13":
|
||||
"3264ce97b34d5c8d37c1e67821a74960ca89237e001253309a3cda25fb416040",
|
||||
"riscv64gc-unknown-linux-musl-0.11.13":
|
||||
"44f23b8e59fd8628fb68383e4cbdf78c3cff02ed86d3dcea5605ebd7757ca363",
|
||||
"s390x-unknown-linux-gnu-0.11.13":
|
||||
"e0e5e0a652650900d97f6a660bae526601033d9d071ca5dd9ca735442161ebed",
|
||||
"x86_64-apple-darwin-0.11.13":
|
||||
"99aad3f4956f5b92efd83eca6d87bf03e10688899487ad541f904c9c25c61dc1",
|
||||
"x86_64-pc-windows-msvc-0.11.13":
|
||||
"0953ac2ef4fbe47ad469bfa80b658a577a02c4d73a2fb9c4c7c70dda432efded",
|
||||
"x86_64-unknown-linux-gnu-0.11.13":
|
||||
"f830ea3d38ae1492acf53cb7f2cd0f81d6ae22b42d2d7310a6c7d42c451e1a43",
|
||||
"x86_64-unknown-linux-musl-0.11.13":
|
||||
"5635afc285df86ce6f05f3f22335f9548b0026e58531904482c9670a1c1c65d9",
|
||||
"aarch64-apple-darwin-0.11.12":
|
||||
"bb7c6ef869ec00cd1452f4884acf23d00b153c356ba9197ae99a1bc1ceadb7f3",
|
||||
"aarch64-pc-windows-msvc-0.11.12":
|
||||
"393de1abc2f663cb9dd24405c7a7b31119e2a734609a233d9b89415821f39bf9",
|
||||
"aarch64-unknown-linux-gnu-0.11.12":
|
||||
"d6e3e5183e71bbd40400da3d2913743cefb98835d8312a5e7908c33865597515",
|
||||
"aarch64-unknown-linux-musl-0.11.12":
|
||||
"b70e87f15f12d750d218042c4ed36e41de0757eab249d332ee2e242e4174b5d5",
|
||||
"arm-unknown-linux-musleabihf-0.11.12":
|
||||
"c1991e652c345395eff3e43aaa0f2ce5d7f0c7ed0dd5a72dcb0a3c109289ac11",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.12":
|
||||
"432e6a96ecc976861dc884d96ac3aa3cc305abc3bb49d3204544477d4a290c64",
|
||||
"armv7-unknown-linux-musleabihf-0.11.12":
|
||||
"a8855302bad162af78c8fa53f402128a3496b7806dc7201252e7f123eefed8b9",
|
||||
"i686-pc-windows-msvc-0.11.12":
|
||||
"98efe2a4cb9529724639aac488c43b28753e738b0f4c679d3e2dea150e5a9b20",
|
||||
"i686-unknown-linux-gnu-0.11.12":
|
||||
"22dbbbcd9088ad3ddefce9be142ce2b127b3950718222413e3890f7fbf4a567d",
|
||||
"i686-unknown-linux-musl-0.11.12":
|
||||
"fc5ff3fef5facf01a664f0942f372988804bda1bb8c7f9e9642d9d29398cf129",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.12":
|
||||
"36619f91357b240648caed6557fe893922c7986319c070f4feb225e8f3180b49",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.12":
|
||||
"9bdcac006731a2094ad002d93c4fe84a259484e4d35566e29fcb76962961cef9",
|
||||
"riscv64gc-unknown-linux-musl-0.11.12":
|
||||
"80012ba0aa3b21561c96edda003add87d9111daf3425e5cc3243957ca76ba396",
|
||||
"s390x-unknown-linux-gnu-0.11.12":
|
||||
"c9ae09f73066fb9c48beaec2ab4ad2407ce94354c5224e2982196577d6bf4581",
|
||||
"x86_64-apple-darwin-0.11.12":
|
||||
"32fb217e6181384bf6534b31adcc66cd552eff98643c4bb35832be8552486912",
|
||||
"x86_64-pc-windows-msvc-0.11.12":
|
||||
"e46956a6b088a0382101c797eef945c1b03826e629e968d434cf838d42d85b6b",
|
||||
"x86_64-unknown-linux-gnu-0.11.12":
|
||||
"9acdecddacba550ee616c02bb4616d894352022550c5977524556fd5077ce1d4",
|
||||
"x86_64-unknown-linux-musl-0.11.12":
|
||||
"591a7557f5ba7e51565f338dd4c50cebc12820ec2ebb8403a4304685f8d53ab9",
|
||||
"aarch64-apple-darwin-0.11.11":
|
||||
"3a185bf8f46a7b7c8b910d111825907b1638d0ae503cb3c333ae205772354046",
|
||||
"aarch64-pc-windows-msvc-0.11.11":
|
||||
"3d8f05de7ed9de885299565f78832a13e443be51de86260f25edb7cfd0fa05f6",
|
||||
"aarch64-unknown-linux-gnu-0.11.11":
|
||||
"155fe4d3b3cb4bfce118ab4b1380f71515ae874d13d9858171b4f9c26e16684d",
|
||||
"aarch64-unknown-linux-musl-0.11.11":
|
||||
"0fc9a49b3900f77ffaccf3ff69a70ddbc1d479e70ac5d8fd6416a7577b03c5a1",
|
||||
"arm-unknown-linux-musleabihf-0.11.11":
|
||||
"ef98cbcd50a62d063958740194497a44fc1dc07867b6fe001db1ab2e621f1f2e",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.11":
|
||||
"c102609d34c06bdec87896d738a0e91df21f71faf21ae4379c7a1d7c961879e1",
|
||||
"armv7-unknown-linux-musleabihf-0.11.11":
|
||||
"6660651927263c587769697572f4843ac6ea91b2b2d24be1b9c8465e87d05b46",
|
||||
"i686-pc-windows-msvc-0.11.11":
|
||||
"c230fccbe5737e1a54a2f77ff3116c88fbee21c9b437323907618931b767410e",
|
||||
"i686-unknown-linux-gnu-0.11.11":
|
||||
"4be5e9901e87f90a9eb5ee11a08a8df2f637df76f3a2dcb11778991b7db9d9a2",
|
||||
"i686-unknown-linux-musl-0.11.11":
|
||||
"d2ded13fbaf59f5f1d3363c47a7cafb73cb7454db1e16cea13365bc28c75522d",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.11":
|
||||
"5348415c8606e5efac5cb293d83d2ae71e43a2dcabf677c6a4cac965c1982c74",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.11":
|
||||
"0eadf068918b960e7bf62eda83613c08d99f0d002b8d475d3383993191554d04",
|
||||
"riscv64gc-unknown-linux-musl-0.11.11":
|
||||
"0ee27ce77e32496bc46e01f1cbb730d13647cbca41934a5871bf2fe5fdc5ba39",
|
||||
"s390x-unknown-linux-gnu-0.11.11":
|
||||
"f19c950a93b1f5af4108267743f3de61346250b35c60cc552fb4187b534af770",
|
||||
"x86_64-apple-darwin-0.11.11":
|
||||
"57a1a8085b4088fbcbd5080c0c30723ba6d0692c89cd071c08a4209e8da602d1",
|
||||
"x86_64-pc-windows-msvc-0.11.11":
|
||||
"2f75a0db2c3530b6b3c24434dc38137f61ff1f4e5f2d7b4ddc5bcd142cf58b65",
|
||||
"x86_64-unknown-linux-gnu-0.11.11":
|
||||
"a767848254391855c96df271e9ca8b7f72dd172d310460447853d25d907b9ae0",
|
||||
"x86_64-unknown-linux-musl-0.11.11":
|
||||
"80521f18ba83109acd17e0730bd8ff898c3426aa62252c627d63418b353e788a",
|
||||
"aarch64-apple-darwin-0.11.10":
|
||||
"e93d6af7dfff7071edd16342ba9eeccfc28d8a7deaa5707efeecf63a63a74453",
|
||||
"aarch64-pc-windows-msvc-0.11.10":
|
||||
"3d5878cfc55106083ada1e41cccdde477413701eb9d34767e8ad973bb0863de6",
|
||||
"aarch64-unknown-linux-gnu-0.11.10":
|
||||
"91d5f4583539640765662ef86edcf3bf4db07439b622c7bed50c961240162046",
|
||||
"aarch64-unknown-linux-musl-0.11.10":
|
||||
"14c21bef6b54d268c6583d851095a543e6cb03a8e4bdca9a44ab91532b14cbc2",
|
||||
"arm-unknown-linux-musleabihf-0.11.10":
|
||||
"bea66b5dcfb3460a9a2c399033b071ec4a825ff3bf27c3fedc666dcbdc2354dd",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.10":
|
||||
"ba259f6c14b5653f1b36400fb8c7862e499a4537201edda76991f2b044014fdb",
|
||||
"armv7-unknown-linux-musleabihf-0.11.10":
|
||||
"9d6e2ea60fae542e2bd9b36f44672e99fd941f7da0898533bc274329b001a055",
|
||||
"i686-pc-windows-msvc-0.11.10":
|
||||
"d56ad43d355d6c40fee4009d0fb7e6710416ce9b25bebf12a4127e51b3595b3c",
|
||||
"i686-unknown-linux-gnu-0.11.10":
|
||||
"ade0a830fd0b4b67c373c8ed1e46e5af2e312032ebbe15438beddeb5b1e4d8f3",
|
||||
"i686-unknown-linux-musl-0.11.10":
|
||||
"fb2ba8c938247f82908acf6ad41a19935b36d0fe7bbe6945ac1ba1f6044756fc",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.10":
|
||||
"dfe5b338e2ebc1e5a2850a17bce35edb8e47550c221d9245c007eaf3003cb6ed",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.10":
|
||||
"0c8776a0814bf7e32e025d13c733c3a800171a16fba77d1c21e6f10be6a28d8b",
|
||||
"riscv64gc-unknown-linux-musl-0.11.10":
|
||||
"8ae35c10dfcae262dee07c93a3d8d10c2ce597d4a152ba1a2f1385395a286ec3",
|
||||
"s390x-unknown-linux-gnu-0.11.10":
|
||||
"66dfdc5a216a9fbd7c2541a66f753544dddbcbb2f7a597c9bbc91d10af534c7d",
|
||||
"x86_64-apple-darwin-0.11.10":
|
||||
"8fd091211089973f528e147166e3af683ab4ecebd4312a55d0d17d87adbde67a",
|
||||
"x86_64-pc-windows-msvc-0.11.10":
|
||||
"7a0c424c7bc55a74751f13592235953ebbe182fa00355f7ae3fb7ab734a51638",
|
||||
"x86_64-unknown-linux-gnu-0.11.10":
|
||||
"077e1a0777bcf516e02f4ef245e269c8d1baa780438e4c50e09c5c997f85538a",
|
||||
"x86_64-unknown-linux-musl-0.11.10":
|
||||
"e3e78e7698d72c133c5ce851a6d60ee83afdc4c0edced382af9fd1f8e11d0105",
|
||||
"aarch64-apple-darwin-0.11.9":
|
||||
"7d02e5f206dcfb555284f8f6b8547890f0b8eb8987f44e9a0a2378cd23338733",
|
||||
"aarch64-pc-windows-msvc-0.11.9":
|
||||
"93de7822f6214c704ec15db1b4d33eabd3709a0303ec068723d9f5f5aa99e9e7",
|
||||
"aarch64-unknown-linux-gnu-0.11.9":
|
||||
"6d22be8d0d675668f657cee802a1344ea7941403f59eb2a6645ef316f69b4309",
|
||||
"aarch64-unknown-linux-musl-0.11.9":
|
||||
"31abb258d8ec2196993b82e746365717a86e3d3d55502b4c60f384540bf16306",
|
||||
"arm-unknown-linux-musleabihf-0.11.9":
|
||||
"60fd2f75fa0a927ce0373a9289e9490351be3142b00fb0e8da082ed652c7f23c",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.9":
|
||||
"074f216882a79506f56f65413932dba9032ca6100285a562c48965688857970e",
|
||||
"armv7-unknown-linux-musleabihf-0.11.9":
|
||||
"0ebca62577232bab2c152fdd0fa81f78a28f8fd1f4f09689347759332aae996d",
|
||||
"i686-pc-windows-msvc-0.11.9":
|
||||
"9dbb9bf746f00dd379e7e1bd544a5e1b48a5f36408f75a7f8c6c89a7a5e5506a",
|
||||
"i686-unknown-linux-gnu-0.11.9":
|
||||
"84418c97aeadbbdb0b80090c43e29149c3d5c4a70c76ecffb738cd4a05d515d2",
|
||||
"i686-unknown-linux-musl-0.11.9":
|
||||
"f724d184888a52714229584536a3219f0c2fa416944fd476b52c7f597d9b3625",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.9":
|
||||
"cbcdb1b6ee99ca69a572b75544dab484cd34e29109962f5945bb95ccd85d0d52",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.9":
|
||||
"a825d1e6b62ca69971c50e6e356ebe478f7616a7873d9f7d7e17fb3efacabef2",
|
||||
"riscv64gc-unknown-linux-musl-0.11.9":
|
||||
"486b67c16381bb75d74daa86c091b36273cde617e0a2678e0b685b89047a6e6f",
|
||||
"s390x-unknown-linux-gnu-0.11.9":
|
||||
"caa3a59d49003d52c841625885bd60c87a957ed6173070af59c2ef7b4845b727",
|
||||
"x86_64-apple-darwin-0.11.9":
|
||||
"a974a0226ac5d3706ebaf660d3587b0dfb93ef9cf1fd146f97d40cd4ad69db98",
|
||||
"x86_64-pc-windows-msvc-0.11.9":
|
||||
"facbf9637c373761a96fa63c537d6c46581d357a65af01eacfd8c6319e6fb14e",
|
||||
"x86_64-unknown-linux-gnu-0.11.9":
|
||||
"5c43f82077ff0cd5aec588286cbabd89913e4d045bd4e8aa60b20b3ecffc36e3",
|
||||
"x86_64-unknown-linux-musl-0.11.9":
|
||||
"ac3e5051edbf30613b0f90d1c18d4807fea6b246f37490799fee0c1284a658b2",
|
||||
"aarch64-apple-darwin-0.11.8":
|
||||
"c729adb365114e844dd7f9316313a7ed6443b89bb5681d409eebac78b0bd06c8",
|
||||
"aarch64-pc-windows-msvc-0.11.8":
|
||||
"bb48716e74e4998993f15bc57a55e4d0d73ccbd27a66d7cbed37605f7c67d747",
|
||||
"aarch64-unknown-linux-gnu-0.11.8":
|
||||
"eee8dd658d20e5ac85fec9c2326b6cbc9d83a1eef09ef07433e58698ac849591",
|
||||
"aarch64-unknown-linux-musl-0.11.8":
|
||||
"29418befb64f926a2dba3473e8e69acd00b36fb845d85344ef11321a993ad8f5",
|
||||
"arm-unknown-linux-musleabihf-0.11.8":
|
||||
"858f50a1164e9d2e3d1641a5f9d81a8b098025bd4f40011882df4f6b7d6ee393",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.8":
|
||||
"b0674ede45b797362f34af0a75d6391e844992ae92a9c181a353e3892af4c325",
|
||||
"armv7-unknown-linux-musleabihf-0.11.8":
|
||||
"eda6e549a1d3bea67de6550e84b05d75e5538350bf50ba229840ec92063f153e",
|
||||
"i686-pc-windows-msvc-0.11.8":
|
||||
"59520c34c3c29a901bb490d4bec55a8e1d46c75d2fbad238871e18de733b4201",
|
||||
"i686-unknown-linux-gnu-0.11.8":
|
||||
"4a82441b70adc3886a4f9c29a1070f104ed73c7e68d14cfa6d6343a8ce0c4ccc",
|
||||
"i686-unknown-linux-musl-0.11.8":
|
||||
"56b8e8874ba09194c580583697c09cbe6c31626e5bb4cfb1f8bfbf4998a8d6c6",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.8":
|
||||
"7b66bcc99237d19fb25d8b1bcbc1f973f735027d49e7cb9ffa22cd539fefccbc",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.8":
|
||||
"dd43289c567fda3ca59ec714ffca09125f1149289448667f36a4bb7c29c859be",
|
||||
"riscv64gc-unknown-linux-musl-0.11.8":
|
||||
"c06b5bbbfecb258f869b18168abb46ef974a76c786fa9350923b1cf38d1661a0",
|
||||
"s390x-unknown-linux-gnu-0.11.8":
|
||||
"068eb3f47d0760d50cd2e0fc59cc2c09eb12a4ec8bb12c269f3aef706bf4dc1a",
|
||||
"x86_64-apple-darwin-0.11.8":
|
||||
"c59d73bf34b58bc8e33a11629f7a255c11789fd00f03cd3e68ab2d1603645de9",
|
||||
"x86_64-pc-windows-msvc-0.11.8":
|
||||
"c84629a56e0706b69a47ea35862208af827cb6fbfa1d0ca763c52c67594637e8",
|
||||
"x86_64-unknown-linux-gnu-0.11.8":
|
||||
"56dd1b66701ecb62fe896abb919444e4b83c5e8645cca953e6ddd496ff8a0feb",
|
||||
"x86_64-unknown-linux-musl-0.11.8":
|
||||
"de82507d12e31cfc86c1c776238f7c248e48e40d996dedc812d64fdd31c6ed12",
|
||||
"aarch64-apple-darwin-0.11.7":
|
||||
"66e37d91f839e12481d7b932a1eccbfe732560f42c1cfb89faddfa2454534ba8",
|
||||
"aarch64-pc-windows-msvc-0.11.7":
|
||||
"1387e1c94e15196351196b79fce4c1e6f4b30f19cdaaf9ff85fbd6b046018aa2",
|
||||
"aarch64-unknown-linux-gnu-0.11.7":
|
||||
"f2ee1cde9aabb4c6e43bd3f341dadaf42189a54e001e521346dc31547310e284",
|
||||
"aarch64-unknown-linux-musl-0.11.7":
|
||||
"46647dc16cbb7d6700f762fdd7a67d220abe18570914732bc310adc91308d272",
|
||||
"arm-unknown-linux-musleabihf-0.11.7":
|
||||
"238974610607541ccdb3b8f4ad161d4f2a4b018d749dc9d358b0965d9a1ddd0f",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.7":
|
||||
"7aa9ddc128f58c0e667227feb84e0aac3bb65301604c5f6f2ab0f442aaaafd99",
|
||||
"armv7-unknown-linux-musleabihf-0.11.7":
|
||||
"77a237761579125b822d604973a2d4afb62b10a8f066db4f793906deec66b017",
|
||||
"i686-pc-windows-msvc-0.11.7":
|
||||
"04652b46b1be90a753e686b839e109a79af3d032ba96d3616c162dffdbe89e5c",
|
||||
"i686-unknown-linux-gnu-0.11.7":
|
||||
"9c77e5b5f2ad4151c6dc29db5511af549e205dbd6e836e544c80ebfadd7a07ec",
|
||||
"i686-unknown-linux-musl-0.11.7":
|
||||
"b067ce3e92d04425bc11b84dc350f97447d3e8dffafccb7ebebde54a56bfc619",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.7":
|
||||
"6ac23c519d1b06297e1e8753c96911fadee5abab4ca35b8c17da30e3e927d8ac",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.7":
|
||||
"2052356c7388d26dc4dfcf2d44e28b3f800785371f37c5f37d179181fe377659",
|
||||
"riscv64gc-unknown-linux-musl-0.11.7":
|
||||
"219a25e413efb62c8ef3efb3593f1f01d9a3c22d1facf3b9c0d80b7caf3a5e56",
|
||||
"s390x-unknown-linux-gnu-0.11.7":
|
||||
"760152aa9e769712d52b6c65a8d7b86ed3aac25a24892cf5998a522d84942f9e",
|
||||
"x86_64-apple-darwin-0.11.7":
|
||||
"0a4bc8fcde4974ea3560be21772aeecab600a6f43fa6e58169f9fa7b3b71d302",
|
||||
"x86_64-pc-windows-msvc-0.11.7":
|
||||
"fe0c7815acf4fc45f8a5eff58ed3cf7ae2e15c3cf1dceadbd10c816ec1690cc1",
|
||||
"x86_64-unknown-linux-gnu-0.11.7":
|
||||
"6681d691eb7f9c00ac6a3af54252f7ab29ae72f0c8f95bdc7f9d1401c23ea868",
|
||||
"x86_64-unknown-linux-musl-0.11.7":
|
||||
"64ddb5f1087649e3f75aa50d139aa4f36ddde728a5295a141e0fa9697bfb7b0f",
|
||||
"aarch64-apple-darwin-0.11.6":
|
||||
"4b69a4e366ec38cd5f305707de95e12951181c448679a00dce2a78868dfc9f5b",
|
||||
"aarch64-pc-windows-msvc-0.11.6":
|
||||
"bee7b25a7a999f17291810242b47565c3ef2b9205651a0fd02a086f261a7e167",
|
||||
"aarch64-unknown-linux-gnu-0.11.6":
|
||||
"d5be4bf7015ea000378cb3c3aba53ba81a8673458ace9c7fa25a0be005b74802",
|
||||
"aarch64-unknown-linux-musl-0.11.6":
|
||||
"d14ebd6f200047264152daaf97b8bd36c7885a5033e9e8bba8366cb0049c0d00",
|
||||
"arm-unknown-linux-musleabihf-0.11.6":
|
||||
"4410a9489e0a29ce8f86fc8604b75a3dd821e9e52734282cbb413b4e19c5c70a",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.6":
|
||||
"9758d49c200c211ccb2c9cbf43877102031c3457e80b6c3cb9da1e4c00119d2a",
|
||||
"armv7-unknown-linux-musleabihf-0.11.6":
|
||||
"0677423d98cea5011d346d7d4a33a53360b99a51a04df4b45f67d43a8308c831",
|
||||
"i686-pc-windows-msvc-0.11.6":
|
||||
"c5569da150166363389a719553d87f99e0c29e542b2c31bc8bd4aeeb8eb83d99",
|
||||
"i686-unknown-linux-gnu-0.11.6":
|
||||
"b4bf8d78478b573c1816b17ec86da7ade14242cd68ac092c1701c5b4a75dc228",
|
||||
"i686-unknown-linux-musl-0.11.6":
|
||||
"ca31705d93f48313d5ffdc23da165e680c6c5389d9a2cc62b85a1ed495e0331f",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.6":
|
||||
"153397d3d82e45e68fb1f4a40ee9898245ec8ed86fd03fcaacaf6e793316acf7",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.6":
|
||||
"0e3ead8667b51b07b5fb9d114bcd1914a5fe3159e6959a584dc2f89c6724e123",
|
||||
"riscv64gc-unknown-linux-musl-0.11.6":
|
||||
"87d5932bffef3b7b9cba4a2a042f95edf75cd34555fc80cfa98cc5a4426635f9",
|
||||
"s390x-unknown-linux-gnu-0.11.6":
|
||||
"6e3d4338da2db2c63326721f1eb3b4f32d9bde24aeff11208d397e1aeba8678e",
|
||||
"x86_64-apple-darwin-0.11.6":
|
||||
"8e0ed5035eaa28c7c8cd2a46b5b9a05bfff1ef01dbdc090a010eb8fdf193a457",
|
||||
"x86_64-pc-windows-msvc-0.11.6":
|
||||
"99aa60edd017a256dbf378f372d1cff3292dbc6696e0ea01716d9158d773ab77",
|
||||
"x86_64-unknown-linux-gnu-0.11.6":
|
||||
"0c6bab77a67a445dc849ed5e8ee8d3cb333b6e2eba863643ce1e228075f27943",
|
||||
"x86_64-unknown-linux-musl-0.11.6":
|
||||
"aa342a53abe42364093506d7704214d2cdca30b916843e520bc67759a5d20132",
|
||||
"aarch64-apple-darwin-0.11.5":
|
||||
"470993e87503874c7c48861daa308b48a7c367e117235bbecf19368b9fdd35b2",
|
||||
"aarch64-pc-windows-msvc-0.11.5":
|
||||
"9b9b99a985cccf249225aaad76412823e9d9736d605dc2252151172a7f6ab3db",
|
||||
"aarch64-unknown-linux-gnu-0.11.5":
|
||||
"3e9b525d686ae4f3682412bce21536366a5c79616a41055530319c501c883169",
|
||||
"aarch64-unknown-linux-musl-0.11.5":
|
||||
"d73860013061c62d6a89f3370527d4c407214038af331147773ae2fd8f6394c1",
|
||||
"arm-unknown-linux-musleabihf-0.11.5":
|
||||
"dcfb4dc15f46eae90ac6d64e7dfc91d8bc0b16816f53b9f8d58ccc8a1220dbb8",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.5":
|
||||
"818d86386fb57ca4182f39df25dd6160e97300d5ba362bc44e25d8adc904776c",
|
||||
"armv7-unknown-linux-musleabihf-0.11.5":
|
||||
"2cae8baae2c1b42249e656e16f5fe733189b0760ee93995be024f9cc5e72eb19",
|
||||
"i686-pc-windows-msvc-0.11.5":
|
||||
"2057ccf3dba9ed23755df92318a08ab221e9e088385c667292acc09d9cc477c6",
|
||||
"i686-unknown-linux-gnu-0.11.5":
|
||||
"2d340e2e5b3354ee7208bb8f2bbf4d2347d7ffdf2af733c21bee98746e34076d",
|
||||
"i686-unknown-linux-musl-0.11.5":
|
||||
"ffe2bc9e0c4fdc18f69b7c5bc016a03fa17028d42620ab2b024ad5bb22cd3f3d",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.5":
|
||||
"c4dabaaa36a13989ab04389263064ca5c27093eb2e7c851ab62d50b6312d9800",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.5":
|
||||
"6ae3ec3cf1aab72604bc6aa8486faf4b473066422c49d9c42ea8366ff3039de4",
|
||||
"riscv64gc-unknown-linux-musl-0.11.5":
|
||||
"d4686fb144563a40e791fc3f010a91e57fdce9cac7a03b8a14a972c25be4464c",
|
||||
"s390x-unknown-linux-gnu-0.11.5":
|
||||
"1309f1e462462dab2da6a55c37012a228d1c06a55c5b43f8ef901ba1599d9e12",
|
||||
"x86_64-apple-darwin-0.11.5":
|
||||
"b8964bed538143f9016d807e421e28f0237a29589851fc79e8159751ac64779a",
|
||||
"x86_64-pc-windows-msvc-0.11.5":
|
||||
"3fa5b6ea9de9256a035e0471f5ef0bb5d95344659723d6eb063e27c76431515d",
|
||||
"x86_64-unknown-linux-gnu-0.11.5":
|
||||
"0d87793f733f327849ebf9cf51b576cfb08328e22af73061405e4bec96ae84d1",
|
||||
"x86_64-unknown-linux-musl-0.11.5":
|
||||
"ee8a52743ce3979e52872b49c5e58ffa541048cb95132142bff23fe5608d73ea",
|
||||
"aarch64-apple-darwin-0.11.4":
|
||||
"9b9cb6c6f58c3246dbf3351ed4e97c500bc3266f5f237d2fd620b66e1c31dc56",
|
||||
"aarch64-pc-windows-msvc-0.11.4":
|
||||
"708b1c210109e50ff520bcd9b6d29cbd8cee584bb55e84d3d1941bf75ab0893d",
|
||||
"aarch64-unknown-linux-gnu-0.11.4":
|
||||
"f5aa91bba0b98d85a4e5262e2847f9ab2273c754f6374dff62b37ef18c65a2e7",
|
||||
"aarch64-unknown-linux-musl-0.11.4":
|
||||
"a02ec7667d7bb1d33cdb7e1de22f7e4242967e3df7e350bac6212515e3bce8ac",
|
||||
"arm-unknown-linux-musleabihf-0.11.4":
|
||||
"5bbc59d8c3d5fdade88fca47e4c18298e44a367e178e97e11466b22e992edae2",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.4":
|
||||
"9d2299155b65988643a55777c638408a0df8e65f606933d1e44691ada72ff106",
|
||||
"armv7-unknown-linux-musleabihf-0.11.4":
|
||||
"43b1e02f8f4b27fd1d085fb14a246638bb607af32408cb13c5c3b3fb47db027f",
|
||||
"i686-pc-windows-msvc-0.11.4":
|
||||
"661588b3607e6d5bb78551f596772a0d04a930ce128189c90800d07f6fca1998",
|
||||
"i686-unknown-linux-gnu-0.11.4":
|
||||
"4248773a2574c3b697588655d7bf14f97baa744c3e156585230e5c711befa6ff",
|
||||
"i686-unknown-linux-musl-0.11.4":
|
||||
"0323c08c1e7455cdf65c89296eda28bad9051cb09d16ea3ce1d0bf718143449e",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.4":
|
||||
"3ddb764538a5dcb4967d7375fde193ce5391e37ddd4d1242012d04cf3848479f",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.4":
|
||||
"93db93607a824d677c47003ee828936913cfdeb2c871bb34cd79c3ec4481e2b1",
|
||||
"riscv64gc-unknown-linux-musl-0.11.4":
|
||||
"78f0d7f92244ce3d7a7a0df5fab2495450bcb18600b59acf1755e77cafed2300",
|
||||
"s390x-unknown-linux-gnu-0.11.4":
|
||||
"07361e1fb32e870841a27d3d7b0b20c4a81e0cc25eeb8b9115425bfd227d2d05",
|
||||
"x86_64-apple-darwin-0.11.4":
|
||||
"c326edaf3fd492f53d1c58777f3459c0d87bf9dae8d89e80aec4b0da6622dcf3",
|
||||
"x86_64-pc-windows-msvc-0.11.4":
|
||||
"26d84455a40b0272b2ab4785cad298ff2c89cd0765b482e9f85b5a1bd880a863",
|
||||
"x86_64-unknown-linux-gnu-0.11.4":
|
||||
"12f9a192bb32d70470aa22cbd2a193d1323a3f58f6ac5f9e3866aaca760c98c6",
|
||||
"x86_64-unknown-linux-musl-0.11.4":
|
||||
"36ce1c5d8997db9b6a24d0f41646d5509b6d1d8b9448c7325f8248a6ea5d4b00",
|
||||
"aarch64-apple-darwin-0.11.3":
|
||||
"2bc3d0c7bf2bd08325b1e170abac6f7e5b3346e1d4eab3370d17cefec934996f",
|
||||
"aarch64-pc-windows-msvc-0.11.3":
|
||||
"e99c56f9ab5e1e1ddcaea3e2389990c94baf38e0d7cb2148de08baf2d3261d49",
|
||||
"aarch64-unknown-linux-gnu-0.11.3":
|
||||
"711382e3158433f06b11d99afb440f4416359fc3c84558886d8ed8826a921bff",
|
||||
"aarch64-unknown-linux-musl-0.11.3":
|
||||
"8ecec82cb9a744d5fabff6d16d7777218a7730f699d2aa0d2f751c17858e2efa",
|
||||
"arm-unknown-linux-musleabihf-0.11.3":
|
||||
"3d021046a94ad11f12b9d83f36442a1a28e92e7149c3f79ba2951c96653dafac",
|
||||
"armv7-unknown-linux-gnueabihf-0.11.3":
|
||||
"13c9a0f5f624275ccd36db2896607f4fee3585f420734b16f6c66d70e32aa458",
|
||||
"armv7-unknown-linux-musleabihf-0.11.3":
|
||||
"260a88e2f00daab0363a745fde036a7881002d7a81094388f31925acb284110b",
|
||||
"i686-pc-windows-msvc-0.11.3":
|
||||
"036fa39fa5ea3cb86c127324924b913b5858e8d91c4cb413edacfc3123001696",
|
||||
"i686-unknown-linux-gnu-0.11.3":
|
||||
"b9410c8dae2fa0d4939af5b0ee7272d5591bd55890e8274dcf7f1aea84bfe043",
|
||||
"i686-unknown-linux-musl-0.11.3":
|
||||
"afe533fd409105e753d844490c65a4375e75bfb3812e49122684f996bed9e90a",
|
||||
"powerpc64le-unknown-linux-gnu-0.11.3":
|
||||
"5cdcadf4d50a5354312bc8ef37c2a6cfab4e2f13ccdf8380d3012b927b4ded95",
|
||||
"riscv64gc-unknown-linux-gnu-0.11.3":
|
||||
"8271e07ed9695870f4b0ae5ec722e3ae08fff280068f08bc6a8ca76c67d7fefa",
|
||||
"riscv64gc-unknown-linux-musl-0.11.3":
|
||||
"b750fc8393ced9939448849b05e94de6bf1e998bb7030c4ebe744b47b372bce9",
|
||||
"s390x-unknown-linux-gnu-0.11.3":
|
||||
"6dc4f555a5f6515f7fddb281422d2a8a3943853dae5de837bbb5d996d7576c71",
|
||||
"x86_64-apple-darwin-0.11.3":
|
||||
"b0e05e0b43a000fdc2132ee3f3400ba5dee427bc2337d3ec4eb8cf4f3d5722af",
|
||||
"x86_64-pc-windows-msvc-0.11.3":
|
||||
"ae681c0aaec7cc96af184648cb88d73f8393ed60fa5880abdd6bdb910f9b227c",
|
||||
"x86_64-unknown-linux-gnu-0.11.3":
|
||||
"c0f3236f146e55472663cfbcc9be3042a9f1092275bbe3fe2a56a6cbfd3da5ce",
|
||||
"x86_64-unknown-linux-musl-0.11.3":
|
||||
"8b40cf16b849634b81a530a3d0a0bcae5f24996ef9ae782976fd69b6266d3b8e",
|
||||
"aarch64-apple-darwin-0.11.2":
|
||||
"4beaa9550f93ef7f0fc02f7c28c9c48cd61fe30db00f5ac8947e0a425c3fb282",
|
||||
"aarch64-pc-windows-msvc-0.11.2":
|
||||
|
||||
@@ -2,17 +2,18 @@ import { promises as fs } from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import * as core from "@actions/core";
|
||||
import * as tc from "@actions/tool-cache";
|
||||
import * as pep440 from "@renovatebot/pep440";
|
||||
import * as semver from "semver";
|
||||
import {
|
||||
ASTRAL_MIRROR_PREFIX,
|
||||
GITHUB_RELEASES_PREFIX,
|
||||
TOOL_CACHE_NAME,
|
||||
VERSIONS_MANIFEST_URL,
|
||||
} from "../utils/constants";
|
||||
import * as log from "../utils/logging";
|
||||
import type { Architecture, Platform } from "../utils/platforms";
|
||||
import { validateChecksum } from "./checksum/checksum";
|
||||
import { getAllVersions, getArtifact, getLatestVersion } from "./manifest";
|
||||
import { getArtifact } from "./manifest";
|
||||
|
||||
export { resolveVersion } from "../version/resolve";
|
||||
|
||||
export function tryGetFromToolCache(
|
||||
arch: Architecture,
|
||||
@@ -36,6 +37,7 @@ export async function downloadVersion(
|
||||
checksum: string | undefined,
|
||||
githubToken: string,
|
||||
manifestUrl?: string,
|
||||
downloadFromAstralMirror = true,
|
||||
): Promise<{ version: string; cachedToolDir: string }> {
|
||||
const artifact = await getArtifact(version, arch, platform, manifestUrl);
|
||||
|
||||
@@ -52,10 +54,10 @@ export async function downloadVersion(
|
||||
? checksum
|
||||
: resolveChecksum(checksum, artifact.checksum);
|
||||
|
||||
const mirrorUrl = rewriteToMirror(artifact.downloadUrl);
|
||||
const mirrorUrl = downloadFromAstralMirror
|
||||
? rewriteToMirror(artifact.downloadUrl)
|
||||
: undefined;
|
||||
const downloadUrl = mirrorUrl ?? artifact.downloadUrl;
|
||||
// Don't send the GitHub token to the Astral mirror.
|
||||
const downloadToken = mirrorUrl !== undefined ? undefined : githubToken;
|
||||
|
||||
try {
|
||||
return await downloadArtifact(
|
||||
@@ -65,14 +67,14 @@ export async function downloadVersion(
|
||||
arch,
|
||||
version,
|
||||
resolvedChecksum,
|
||||
downloadToken,
|
||||
githubTokenForUrl(downloadUrl, githubToken),
|
||||
);
|
||||
} catch (err) {
|
||||
if (mirrorUrl === undefined) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
core.warning(
|
||||
log.warning(
|
||||
`Failed to download from mirror, falling back to GitHub Releases: ${(err as Error).message}`,
|
||||
);
|
||||
|
||||
@@ -83,7 +85,7 @@ export async function downloadVersion(
|
||||
arch,
|
||||
version,
|
||||
resolvedChecksum,
|
||||
githubToken,
|
||||
githubTokenForUrl(artifact.downloadUrl, githubToken),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -100,6 +102,19 @@ export function rewriteToMirror(url: string): string | undefined {
|
||||
return ASTRAL_MIRROR_PREFIX + url.slice(GITHUB_RELEASES_PREFIX.length);
|
||||
}
|
||||
|
||||
function githubTokenForUrl(
|
||||
downloadUrl: string,
|
||||
githubToken: string,
|
||||
): string | undefined {
|
||||
try {
|
||||
return new URL(downloadUrl).origin === "https://github.com"
|
||||
? githubToken
|
||||
: undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadArtifact(
|
||||
downloadUrl: string,
|
||||
artifactName: string,
|
||||
@@ -109,7 +124,7 @@ async function downloadArtifact(
|
||||
checksum: string | undefined,
|
||||
githubToken: string | undefined,
|
||||
): Promise<{ version: string; cachedToolDir: string }> {
|
||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||
log.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||
const downloadPath = await tc.downloadTool(
|
||||
downloadUrl,
|
||||
undefined,
|
||||
@@ -125,7 +140,7 @@ async function downloadArtifact(
|
||||
// so this may fail if another tar, like gnu tar, ends up being used.
|
||||
uvDir = await tc.extractTar(downloadPath, undefined, "x");
|
||||
} catch (err) {
|
||||
core.info(
|
||||
log.info(
|
||||
`Extracting with tar failed, falling back to zip extraction: ${(err as Error).message}`,
|
||||
);
|
||||
const extension = getExtension(platform);
|
||||
@@ -172,102 +187,3 @@ function resolveChecksum(
|
||||
function getExtension(platform: Platform): string {
|
||||
return platform === "pc-windows-msvc" ? ".zip" : ".tar.gz";
|
||||
}
|
||||
|
||||
export async function resolveVersion(
|
||||
versionInput: string,
|
||||
manifestUrl: string | undefined,
|
||||
resolutionStrategy: "highest" | "lowest" = "highest",
|
||||
): Promise<string> {
|
||||
core.debug(`Resolving version: ${versionInput}`);
|
||||
const isSimpleMinimumVersionSpecifier =
|
||||
versionInput.includes(">") && !versionInput.includes(",");
|
||||
const resolveVersionSpecifierToLatest =
|
||||
isSimpleMinimumVersionSpecifier && resolutionStrategy === "highest";
|
||||
|
||||
if (resolveVersionSpecifierToLatest) {
|
||||
core.info("Found minimum version specifier, using latest version");
|
||||
}
|
||||
|
||||
const version =
|
||||
versionInput === "latest" || resolveVersionSpecifierToLatest
|
||||
? await getLatestVersion(manifestUrl)
|
||||
: versionInput;
|
||||
|
||||
if (tc.isExplicitVersion(version)) {
|
||||
core.debug(`Version ${version} is an explicit version.`);
|
||||
if (
|
||||
resolveVersionSpecifierToLatest &&
|
||||
!pep440.satisfies(version, versionInput)
|
||||
) {
|
||||
throw new Error(`No version found for ${versionInput}`);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
const availableVersions = await getAvailableVersions(manifestUrl);
|
||||
core.debug(`Available versions: ${availableVersions}`);
|
||||
const resolvedVersion =
|
||||
resolutionStrategy === "lowest"
|
||||
? minSatisfying(availableVersions, version)
|
||||
: maxSatisfying(availableVersions, version);
|
||||
|
||||
if (resolvedVersion === undefined) {
|
||||
throw new Error(`No version found for ${version}`);
|
||||
}
|
||||
|
||||
return resolvedVersion;
|
||||
}
|
||||
|
||||
async function getAvailableVersions(
|
||||
manifestUrl: string | undefined,
|
||||
): Promise<string[]> {
|
||||
if (manifestUrl !== undefined) {
|
||||
core.info(
|
||||
`Getting available versions from manifest-file ${manifestUrl} ...`,
|
||||
);
|
||||
} else {
|
||||
core.info(`Getting available versions from ${VERSIONS_MANIFEST_URL} ...`);
|
||||
}
|
||||
|
||||
return await getAllVersions(manifestUrl);
|
||||
}
|
||||
|
||||
function maxSatisfying(
|
||||
versions: string[],
|
||||
version: string,
|
||||
): string | undefined {
|
||||
const maxSemver = tc.evaluateVersions(versions, version);
|
||||
if (maxSemver !== "") {
|
||||
core.debug(`Found a version that satisfies the semver range: ${maxSemver}`);
|
||||
return maxSemver;
|
||||
}
|
||||
const maxPep440 = pep440.maxSatisfying(versions, version);
|
||||
if (maxPep440 !== null) {
|
||||
core.debug(
|
||||
`Found a version that satisfies the pep440 specifier: ${maxPep440}`,
|
||||
);
|
||||
return maxPep440;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function minSatisfying(
|
||||
versions: string[],
|
||||
version: string,
|
||||
): string | undefined {
|
||||
// For semver, we need to use a different approach since tc.evaluateVersions only returns max
|
||||
// Let's use semver directly for min satisfying
|
||||
const minSemver = semver.minSatisfying(versions, version);
|
||||
if (minSemver !== null) {
|
||||
core.debug(`Found a version that satisfies the semver range: ${minSemver}`);
|
||||
return minSemver;
|
||||
}
|
||||
const minPep440 = pep440.minSatisfying(versions, version);
|
||||
if (minPep440 !== null) {
|
||||
core.debug(
|
||||
`Found a version that satisfies the pep440 specifier: ${minPep440}`,
|
||||
);
|
||||
return minPep440;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as core from "@actions/core";
|
||||
import { VERSIONS_MANIFEST_URL } from "../utils/constants";
|
||||
import { fetch } from "../utils/fetch";
|
||||
import * as log from "../utils/logging";
|
||||
import { selectDefaultVariant } from "./variant-selection";
|
||||
|
||||
export interface ManifestArtifact {
|
||||
@@ -33,7 +34,7 @@ export async function fetchManifest(
|
||||
return cachedVersions;
|
||||
}
|
||||
|
||||
core.info(`Fetching manifest data from ${manifestUrl} ...`);
|
||||
log.info(`Fetching manifest data from ${manifestUrl} ...`);
|
||||
const response = await fetch(manifestUrl, {});
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
@@ -111,6 +112,9 @@ export async function getLatestVersion(
|
||||
export async function getAllVersions(
|
||||
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||
): Promise<string[]> {
|
||||
log.info(
|
||||
`Getting available versions from ${manifestSource(manifestUrl)} ...`,
|
||||
);
|
||||
const versions = await fetchManifest(manifestUrl);
|
||||
return versions.map((versionData) => versionData.version);
|
||||
}
|
||||
@@ -165,6 +169,14 @@ export function clearManifestCache(manifestUrl?: string): void {
|
||||
cachedManifestData.delete(manifestUrl);
|
||||
}
|
||||
|
||||
function manifestSource(manifestUrl: string): string {
|
||||
if (manifestUrl === VERSIONS_MANIFEST_URL) {
|
||||
return VERSIONS_MANIFEST_URL;
|
||||
}
|
||||
|
||||
return `manifest-file ${manifestUrl}`;
|
||||
}
|
||||
|
||||
function isManifestVersion(value: unknown): value is ManifestVersion {
|
||||
if (!isRecord(value)) {
|
||||
return false;
|
||||
|
||||
@@ -2,8 +2,8 @@ import * as crypto from "node:crypto";
|
||||
import * as fs from "node:fs";
|
||||
import * as stream from "node:stream";
|
||||
import * as util from "node:util";
|
||||
import * as core from "@actions/core";
|
||||
import { create } from "@actions/glob";
|
||||
import * as log from "../utils/logging";
|
||||
|
||||
/**
|
||||
* Hashes files matching the given glob pattern.
|
||||
@@ -19,7 +19,7 @@ export async function hashFiles(
|
||||
): Promise<string> {
|
||||
const globber = await create(pattern);
|
||||
let hasMatch = false;
|
||||
const writeDelegate = verbose ? core.info : core.debug;
|
||||
const writeDelegate = verbose ? log.info : log.debug;
|
||||
const result = crypto.createHash("sha256");
|
||||
let count = 0;
|
||||
for await (const file of globber.globGenerator()) {
|
||||
|
||||
+33
-14
@@ -10,6 +10,27 @@ import {
|
||||
} from "./cache/restore-cache";
|
||||
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
||||
import { loadInputs, type SetupInputs } from "./utils/inputs";
|
||||
import * as log from "./utils/logging";
|
||||
|
||||
function formatUnexpectedFailure(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.stack ?? error.message;
|
||||
}
|
||||
return String(error);
|
||||
}
|
||||
|
||||
function failUnexpectedly(event: string, error: unknown): never {
|
||||
core.setFailed(`${event}: ${formatUnexpectedFailure(error)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.on("uncaughtException", (error) => {
|
||||
failUnexpectedly("Uncaught exception", error);
|
||||
});
|
||||
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
failUnexpectedly("Unhandled promise rejection", reason);
|
||||
});
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -18,10 +39,10 @@ export async function run(): Promise<void> {
|
||||
if (inputs.saveCache) {
|
||||
await saveCache(inputs);
|
||||
} else {
|
||||
core.info("save-cache is false. Skipping save cache step.");
|
||||
log.info("save-cache is false. Skipping save cache step.");
|
||||
}
|
||||
// https://github.com/nodejs/node/issues/56645#issuecomment-3077594952
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
// https://github.com/nodejs/node/issues/56645#issuecomment-3924958861
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
@@ -41,11 +62,11 @@ async function saveCache(inputs: SetupInputs): Promise<void> {
|
||||
const matchedKey = core.getState(STATE_CACHE_MATCHED_KEY);
|
||||
|
||||
if (!cacheKey) {
|
||||
core.warning("Error retrieving cache key from state.");
|
||||
log.warning("Error retrieving cache key from state.");
|
||||
return;
|
||||
}
|
||||
if (matchedKey === cacheKey) {
|
||||
core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
log.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
} else {
|
||||
if (inputs.pruneCache) {
|
||||
await pruneCache();
|
||||
@@ -54,7 +75,7 @@ async function saveCache(inputs: SetupInputs): Promise<void> {
|
||||
const actualCachePath = getUvCachePath(inputs);
|
||||
if (!fs.existsSync(actualCachePath)) {
|
||||
if (inputs.ignoreNothingToCache) {
|
||||
core.info(
|
||||
log.info(
|
||||
"No cacheable uv cache paths were found. Ignoring because ignore-nothing-to-cache is enabled.",
|
||||
);
|
||||
} else {
|
||||
@@ -74,7 +95,7 @@ async function saveCache(inputs: SetupInputs): Promise<void> {
|
||||
|
||||
if (inputs.cachePython) {
|
||||
if (!fs.existsSync(inputs.pythonDir)) {
|
||||
core.warning(
|
||||
log.warning(
|
||||
`Python cache path ${inputs.pythonDir} does not exist on disk. Skipping Python cache save because no managed Python installation was found. If you want uv to install managed Python instead of using a system interpreter, set UV_PYTHON_PREFERENCE=only-managed.`,
|
||||
);
|
||||
return;
|
||||
@@ -101,7 +122,7 @@ async function pruneCache(): Promise<void> {
|
||||
execArgs.push("--force");
|
||||
}
|
||||
|
||||
core.info("Pruning cache...");
|
||||
log.info("Pruning cache...");
|
||||
const uvPath = core.getState(STATE_UV_PATH);
|
||||
await exec.exec(uvPath, execArgs, options);
|
||||
}
|
||||
@@ -116,7 +137,7 @@ function getUvCachePath(inputs: SetupInputs): string {
|
||||
process.env.UV_CACHE_DIR &&
|
||||
process.env.UV_CACHE_DIR !== inputs.cacheLocalPath.path
|
||||
) {
|
||||
core.warning(
|
||||
log.warning(
|
||||
`The environment variable UV_CACHE_DIR has been changed to "${process.env.UV_CACHE_DIR}", by an action or step running after astral-sh/setup-uv. This can lead to unexpected behavior. If you expected this to happen set the cache-local-path input to "${process.env.UV_CACHE_DIR}" instead of "${inputs.cacheLocalPath.path}".`,
|
||||
);
|
||||
return process.env.UV_CACHE_DIR;
|
||||
@@ -133,15 +154,13 @@ async function saveCacheToKey(
|
||||
const matchedKey = core.getState(stateKey);
|
||||
|
||||
if (matchedKey === cacheKey) {
|
||||
core.info(
|
||||
`${cacheName} hit occurred on key ${cacheKey}, not saving cache.`,
|
||||
);
|
||||
log.info(`${cacheName} hit occurred on key ${cacheKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
|
||||
core.info(`Including ${cacheName} path: ${cachePath}`);
|
||||
log.info(`Including ${cacheName} path: ${cachePath}`);
|
||||
await cache.saveCache([cachePath], cacheKey);
|
||||
core.info(`${cacheName} saved with key: ${cacheKey}`);
|
||||
log.info(`${cacheName} saved with key: ${cacheKey}`);
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
+59
-67
@@ -5,21 +5,41 @@ import * as exec from "@actions/exec";
|
||||
import { restoreCache } from "./cache/restore-cache";
|
||||
import {
|
||||
downloadVersion,
|
||||
resolveVersion,
|
||||
tryGetFromToolCache,
|
||||
} from "./download/download-version";
|
||||
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
||||
import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs";
|
||||
import * as log from "./utils/logging";
|
||||
import {
|
||||
type Architecture,
|
||||
getArch,
|
||||
getPlatform,
|
||||
type Platform,
|
||||
} from "./utils/platforms";
|
||||
import { getUvVersionFromFile } from "./version/resolve";
|
||||
import { resolveUvVersion } from "./version/resolve";
|
||||
|
||||
const sourceDir = __dirname;
|
||||
|
||||
function formatUnexpectedFailure(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.stack ?? error.message;
|
||||
}
|
||||
return String(error);
|
||||
}
|
||||
|
||||
function failUnexpectedly(event: string, error: unknown): never {
|
||||
core.setFailed(`${event}: ${formatUnexpectedFailure(error)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.on("uncaughtException", (error) => {
|
||||
failUnexpectedly("Uncaught exception", error);
|
||||
});
|
||||
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
failUnexpectedly("Unhandled promise rejection", reason);
|
||||
});
|
||||
|
||||
async function getPythonVersion(inputs: SetupInputs): Promise<string> {
|
||||
if (inputs.pythonVersion !== "") {
|
||||
return inputs.pythonVersion;
|
||||
@@ -77,7 +97,7 @@ async function run(): Promise<void> {
|
||||
|
||||
core.setOutput("uv-version", setupResult.version);
|
||||
core.saveState(STATE_UV_VERSION, setupResult.version);
|
||||
core.info(`Successfully installed uv version ${setupResult.version}`);
|
||||
log.info(`Successfully installed uv version ${setupResult.version}`);
|
||||
|
||||
const detectedPythonVersion = await getPythonVersion(inputs);
|
||||
core.setOutput("python-version", detectedPythonVersion);
|
||||
@@ -85,8 +105,8 @@ async function run(): Promise<void> {
|
||||
if (inputs.enableCache) {
|
||||
await restoreCache(inputs, detectedPythonVersion);
|
||||
}
|
||||
// https://github.com/nodejs/node/issues/56645#issuecomment-3077594952
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
// https://github.com/nodejs/node/issues/56645#issuecomment-3924958861
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
core.setFailed((err as Error).message);
|
||||
@@ -96,11 +116,11 @@ async function run(): Promise<void> {
|
||||
function detectEmptyWorkdir(inputs: SetupInputs): void {
|
||||
if (fs.readdirSync(inputs.workingDirectory).length === 0) {
|
||||
if (inputs.ignoreEmptyWorkdir) {
|
||||
core.info(
|
||||
log.info(
|
||||
"Empty workdir detected. Ignoring because ignore-empty-workdir is enabled",
|
||||
);
|
||||
} else {
|
||||
core.warning(
|
||||
log.warning(
|
||||
"Empty workdir detected. This may cause unexpected behavior. You can enable ignore-empty-workdir to mute this warning.",
|
||||
);
|
||||
}
|
||||
@@ -112,10 +132,16 @@ async function setupUv(
|
||||
platform: Platform,
|
||||
arch: Architecture,
|
||||
): Promise<{ uvDir: string; version: string }> {
|
||||
const resolvedVersion = await determineVersion(inputs);
|
||||
const resolvedVersion = await resolveUvVersion({
|
||||
manifestFile: inputs.manifestFile,
|
||||
resolutionStrategy: inputs.resolutionStrategy,
|
||||
version: inputs.version,
|
||||
versionFile: inputs.versionFile,
|
||||
workingDirectory: inputs.workingDirectory,
|
||||
});
|
||||
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
|
||||
if (toolCacheResult.installedPath) {
|
||||
core.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
|
||||
log.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
|
||||
return {
|
||||
uvDir: toolCacheResult.installedPath,
|
||||
version: toolCacheResult.version,
|
||||
@@ -129,6 +155,7 @@ async function setupUv(
|
||||
inputs.checksum,
|
||||
inputs.githubToken,
|
||||
inputs.manifestFile,
|
||||
inputs.downloadFromAstralMirror,
|
||||
);
|
||||
|
||||
return {
|
||||
@@ -137,83 +164,44 @@ async function setupUv(
|
||||
};
|
||||
}
|
||||
|
||||
async function determineVersion(inputs: SetupInputs): Promise<string> {
|
||||
return await resolveVersion(
|
||||
getRequestedVersion(inputs),
|
||||
inputs.manifestFile,
|
||||
inputs.resolutionStrategy,
|
||||
);
|
||||
}
|
||||
|
||||
function getRequestedVersion(inputs: SetupInputs): string {
|
||||
if (inputs.version !== "") {
|
||||
return inputs.version;
|
||||
}
|
||||
|
||||
if (inputs.versionFile !== "") {
|
||||
const versionFromFile = getUvVersionFromFile(inputs.versionFile);
|
||||
if (versionFromFile === undefined) {
|
||||
throw new Error(
|
||||
`Could not determine uv version from file: ${inputs.versionFile}`,
|
||||
);
|
||||
}
|
||||
return versionFromFile;
|
||||
}
|
||||
|
||||
const versionFromUvToml = getUvVersionFromFile(
|
||||
`${inputs.workingDirectory}${path.sep}uv.toml`,
|
||||
);
|
||||
const versionFromPyproject = getUvVersionFromFile(
|
||||
`${inputs.workingDirectory}${path.sep}pyproject.toml`,
|
||||
);
|
||||
|
||||
if (versionFromUvToml === undefined && versionFromPyproject === undefined) {
|
||||
core.info(
|
||||
"Could not determine uv version from uv.toml or pyproject.toml. Falling back to latest.",
|
||||
);
|
||||
}
|
||||
|
||||
return versionFromUvToml || versionFromPyproject || "latest";
|
||||
}
|
||||
|
||||
function addUvToPathAndOutput(cachedPath: string): void {
|
||||
core.setOutput("uv-path", `${cachedPath}${path.sep}uv`);
|
||||
core.saveState(STATE_UV_PATH, `${cachedPath}${path.sep}uv`);
|
||||
core.setOutput("uvx-path", `${cachedPath}${path.sep}uvx`);
|
||||
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
|
||||
core.info("UV_NO_MODIFY_PATH is set, not modifying PATH");
|
||||
log.info("UV_NO_MODIFY_PATH is set, not modifying PATH");
|
||||
} else {
|
||||
core.addPath(cachedPath);
|
||||
core.info(`Added ${cachedPath} to the path`);
|
||||
log.info(`Added ${cachedPath} to the path`);
|
||||
}
|
||||
}
|
||||
|
||||
function addToolBinToPath(inputs: SetupInputs): void {
|
||||
if (inputs.toolBinDir !== undefined) {
|
||||
core.exportVariable("UV_TOOL_BIN_DIR", inputs.toolBinDir);
|
||||
core.info(`Set UV_TOOL_BIN_DIR to ${inputs.toolBinDir}`);
|
||||
log.info(`Set UV_TOOL_BIN_DIR to ${inputs.toolBinDir}`);
|
||||
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
|
||||
core.info(
|
||||
log.info(
|
||||
`UV_NO_MODIFY_PATH is set, not adding ${inputs.toolBinDir} to path`,
|
||||
);
|
||||
} else {
|
||||
core.addPath(inputs.toolBinDir);
|
||||
core.info(`Added ${inputs.toolBinDir} to the path`);
|
||||
log.info(`Added ${inputs.toolBinDir} to the path`);
|
||||
}
|
||||
} else {
|
||||
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
|
||||
core.info("UV_NO_MODIFY_PATH is set, not adding user local bin to path");
|
||||
log.info("UV_NO_MODIFY_PATH is set, not adding user local bin to path");
|
||||
return;
|
||||
}
|
||||
if (process.env.XDG_BIN_HOME !== undefined) {
|
||||
core.addPath(process.env.XDG_BIN_HOME);
|
||||
core.info(`Added ${process.env.XDG_BIN_HOME} to the path`);
|
||||
log.info(`Added ${process.env.XDG_BIN_HOME} to the path`);
|
||||
} else if (process.env.XDG_DATA_HOME !== undefined) {
|
||||
core.addPath(`${process.env.XDG_DATA_HOME}/../bin`);
|
||||
core.info(`Added ${process.env.XDG_DATA_HOME}/../bin to the path`);
|
||||
log.info(`Added ${process.env.XDG_DATA_HOME}/../bin to the path`);
|
||||
} else {
|
||||
core.addPath(`${process.env.HOME}/.local/bin`);
|
||||
core.info(`Added ${process.env.HOME}/.local/bin to the path`);
|
||||
log.info(`Added ${process.env.HOME}/.local/bin to the path`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,25 +209,25 @@ function addToolBinToPath(inputs: SetupInputs): void {
|
||||
function setToolDir(inputs: SetupInputs): void {
|
||||
if (inputs.toolDir !== undefined) {
|
||||
core.exportVariable("UV_TOOL_DIR", inputs.toolDir);
|
||||
core.info(`Set UV_TOOL_DIR to ${inputs.toolDir}`);
|
||||
log.info(`Set UV_TOOL_DIR to ${inputs.toolDir}`);
|
||||
}
|
||||
}
|
||||
|
||||
function addPythonDirToPath(inputs: SetupInputs): void {
|
||||
core.exportVariable("UV_PYTHON_INSTALL_DIR", inputs.pythonDir);
|
||||
core.info(`Set UV_PYTHON_INSTALL_DIR to ${inputs.pythonDir}`);
|
||||
log.info(`Set UV_PYTHON_INSTALL_DIR to ${inputs.pythonDir}`);
|
||||
if (process.env.UV_NO_MODIFY_PATH !== undefined) {
|
||||
core.info("UV_NO_MODIFY_PATH is set, not adding python dir to path");
|
||||
log.info("UV_NO_MODIFY_PATH is set, not adding python dir to path");
|
||||
} else {
|
||||
core.addPath(inputs.pythonDir);
|
||||
core.info(`Added ${inputs.pythonDir} to the path`);
|
||||
log.info(`Added ${inputs.pythonDir} to the path`);
|
||||
}
|
||||
}
|
||||
|
||||
function setupPython(inputs: SetupInputs): void {
|
||||
if (inputs.pythonVersion !== "") {
|
||||
core.exportVariable("UV_PYTHON", inputs.pythonVersion);
|
||||
core.info(`Set UV_PYTHON to ${inputs.pythonVersion}`);
|
||||
log.info(`Set UV_PYTHON to ${inputs.pythonVersion}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,14 +239,18 @@ async function activateEnvironment(inputs: SetupInputs): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
core.info(`Creating and activating python venv at ${inputs.venvPath}...`);
|
||||
await exec.exec("uv", [
|
||||
log.info(`Creating and activating python venv at ${inputs.venvPath}...`);
|
||||
const venvArgs = [
|
||||
"venv",
|
||||
inputs.venvPath,
|
||||
"--directory",
|
||||
inputs.workingDirectory,
|
||||
"--clear",
|
||||
]);
|
||||
];
|
||||
if (inputs.noProject) {
|
||||
venvArgs.push("--no-project");
|
||||
}
|
||||
await exec.exec("uv", venvArgs);
|
||||
|
||||
let venvBinPath = `${inputs.venvPath}${path.sep}bin`;
|
||||
if (process.platform === "win32") {
|
||||
@@ -273,13 +265,13 @@ async function activateEnvironment(inputs: SetupInputs): Promise<void> {
|
||||
function setCacheDir(inputs: SetupInputs): void {
|
||||
if (inputs.cacheLocalPath !== undefined) {
|
||||
if (inputs.cacheLocalPath.source === CacheLocalSource.Config) {
|
||||
core.info(
|
||||
log.info(
|
||||
"Using cache-dir from uv config file, not modifying UV_CACHE_DIR",
|
||||
);
|
||||
return;
|
||||
}
|
||||
core.exportVariable("UV_CACHE_DIR", inputs.cacheLocalPath.path);
|
||||
core.info(`Set UV_CACHE_DIR to ${inputs.cacheLocalPath.path}`);
|
||||
log.info(`Set UV_CACHE_DIR to ${inputs.cacheLocalPath.path}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
getLatestVersion,
|
||||
type ManifestVersion,
|
||||
} from "./download/manifest";
|
||||
import * as log from "./utils/logging";
|
||||
|
||||
const VERSION_IN_CHECKSUM_KEY_PATTERN =
|
||||
/-(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)$/;
|
||||
@@ -26,7 +27,7 @@ async function run(): Promise<void> {
|
||||
const latestKnownVersion = getLatestKnownVersionFromChecksums();
|
||||
|
||||
if (semver.lte(latestVersion, latestKnownVersion)) {
|
||||
core.info(
|
||||
log.info(
|
||||
`Latest release (${latestVersion}) is not newer than the latest known version (${latestKnownVersion}). Skipping update.`,
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,19 @@ export function getConfigValueFromTomlFile(
|
||||
if (!fs.existsSync(filePath) || !filePath.endsWith(".toml")) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
return getConfigValueFromTomlContent(filePath, fileContent, key);
|
||||
}
|
||||
|
||||
export function getConfigValueFromTomlContent(
|
||||
filePath: string,
|
||||
fileContent: string,
|
||||
key: string,
|
||||
): string | undefined {
|
||||
if (!filePath.endsWith(".toml")) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (filePath.endsWith("pyproject.toml")) {
|
||||
const tomlContent = toml.parse(fileContent) as {
|
||||
@@ -16,6 +28,7 @@ export function getConfigValueFromTomlFile(
|
||||
};
|
||||
return tomlContent?.tool?.uv?.[key];
|
||||
}
|
||||
|
||||
const tomlContent = toml.parse(fileContent) as Record<
|
||||
string,
|
||||
string | undefined
|
||||
|
||||
+11
-2
@@ -14,8 +14,17 @@ export function getProxyAgent() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export const fetch = async (url: string, opts: RequestInit) =>
|
||||
await undiciFetch(url, {
|
||||
export const fetch = async (url: string, opts: RequestInit) => {
|
||||
// Merge timeout signal with any existing signal from opts
|
||||
const timeoutSignal = AbortSignal.timeout(5_000);
|
||||
const existingSignal = opts.signal;
|
||||
const mergedSignal = existingSignal
|
||||
? AbortSignal.any([timeoutSignal, existingSignal])
|
||||
: timeoutSignal;
|
||||
|
||||
return await undiciFetch(url, {
|
||||
dispatcher: getProxyAgent(),
|
||||
...opts,
|
||||
signal: mergedSignal,
|
||||
});
|
||||
};
|
||||
|
||||
+16
-5
@@ -1,6 +1,7 @@
|
||||
import path from "node:path";
|
||||
import * as core from "@actions/core";
|
||||
import { getConfigValueFromTomlFile } from "./config-file";
|
||||
import * as log from "./logging";
|
||||
|
||||
export enum CacheLocalSource {
|
||||
Input,
|
||||
@@ -22,6 +23,7 @@ export interface SetupInputs {
|
||||
versionFile: string;
|
||||
pythonVersion: string;
|
||||
activateEnvironment: boolean;
|
||||
noProject: boolean;
|
||||
venvPath: string;
|
||||
checksum: string;
|
||||
enableCache: boolean;
|
||||
@@ -39,7 +41,9 @@ export interface SetupInputs {
|
||||
pythonDir: string;
|
||||
githubToken: string;
|
||||
manifestFile?: string;
|
||||
downloadFromAstralMirror: boolean;
|
||||
addProblemMatchers: boolean;
|
||||
quiet: boolean;
|
||||
resolutionStrategy: ResolutionStrategy;
|
||||
}
|
||||
|
||||
@@ -49,6 +53,7 @@ export function loadInputs(): SetupInputs {
|
||||
const versionFile = getVersionFile(workingDirectory);
|
||||
const pythonVersion = core.getInput("python-version");
|
||||
const activateEnvironment = core.getBooleanInput("activate-environment");
|
||||
const noProject = core.getBooleanInput("no-project");
|
||||
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
|
||||
const checksum = core.getInput("checksum");
|
||||
const enableCache = getEnableCache();
|
||||
@@ -71,7 +76,10 @@ export function loadInputs(): SetupInputs {
|
||||
const pythonDir = getUvPythonDir();
|
||||
const githubToken = core.getInput("github-token");
|
||||
const manifestFile = getManifestFile();
|
||||
const downloadFromAstralMirror =
|
||||
core.getInput("download-from-astral-mirror") === "true";
|
||||
const addProblemMatchers = core.getInput("add-problem-matchers") === "true";
|
||||
const quiet = core.getInput("quiet") === "true";
|
||||
const resolutionStrategy = getResolutionStrategy();
|
||||
|
||||
return {
|
||||
@@ -82,14 +90,17 @@ export function loadInputs(): SetupInputs {
|
||||
cachePython,
|
||||
cacheSuffix,
|
||||
checksum,
|
||||
downloadFromAstralMirror,
|
||||
enableCache,
|
||||
githubToken,
|
||||
ignoreEmptyWorkdir,
|
||||
ignoreNothingToCache,
|
||||
manifestFile,
|
||||
noProject,
|
||||
pruneCache,
|
||||
pythonDir,
|
||||
pythonVersion,
|
||||
quiet,
|
||||
resolutionStrategy,
|
||||
restoreCache,
|
||||
saveCache,
|
||||
@@ -118,7 +129,7 @@ function getVenvPath(
|
||||
const venvPathInput = core.getInput("venv-path");
|
||||
if (venvPathInput !== "") {
|
||||
if (!activateEnvironment) {
|
||||
core.warning("venv-path is only used when activate-environment is true");
|
||||
log.warning("venv-path is only used when activate-environment is true");
|
||||
}
|
||||
const tildeExpanded = expandTilde(venvPathInput);
|
||||
return normalizePath(resolveRelativePath(workingDirectory, tildeExpanded));
|
||||
@@ -189,7 +200,7 @@ function getCacheLocalPath(
|
||||
return { path: cacheDirFromConfig, source: CacheLocalSource.Config };
|
||||
}
|
||||
if (process.env.UV_CACHE_DIR !== undefined) {
|
||||
core.info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
log.info(`UV_CACHE_DIR is already set to ${process.env.UV_CACHE_DIR}`);
|
||||
return { path: process.env.UV_CACHE_DIR, source: CacheLocalSource.Env };
|
||||
}
|
||||
if (enableCache) {
|
||||
@@ -226,12 +237,12 @@ function getCacheDirFromConfig(
|
||||
try {
|
||||
const cacheDir = getConfigValueFromTomlFile(resolvedPath, "cache-dir");
|
||||
if (cacheDir !== undefined) {
|
||||
core.info(`Found cache-dir in ${resolvedPath}: ${cacheDir}`);
|
||||
log.info(`Found cache-dir in ${resolvedPath}: ${cacheDir}`);
|
||||
return cacheDir;
|
||||
}
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
core.warning(`Error while parsing ${filePath}: ${message}`);
|
||||
log.warning(`Error while parsing ${filePath}: ${message}`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +251,7 @@ function getCacheDirFromConfig(
|
||||
|
||||
export function getUvPythonDir(): string {
|
||||
if (process.env.UV_PYTHON_INSTALL_DIR !== undefined) {
|
||||
core.info(
|
||||
log.info(
|
||||
`UV_PYTHON_INSTALL_DIR is already set to ${process.env.UV_PYTHON_INSTALL_DIR}`,
|
||||
);
|
||||
return process.env.UV_PYTHON_INSTALL_DIR;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as core from "@actions/core";
|
||||
|
||||
let quiet: boolean | undefined;
|
||||
|
||||
function isQuiet(): boolean {
|
||||
if (quiet === undefined) {
|
||||
quiet =
|
||||
typeof core.getInput === "function" && core.getInput("quiet") === "true";
|
||||
}
|
||||
return quiet;
|
||||
}
|
||||
|
||||
export function info(msg: string): void {
|
||||
if (!isQuiet()) {
|
||||
core.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export const warning = core.warning;
|
||||
export const error = core.error;
|
||||
export const debug = core.debug;
|
||||
@@ -0,0 +1,101 @@
|
||||
import fs from "node:fs";
|
||||
import { getConfigValueFromTomlContent } from "../utils/config-file";
|
||||
import * as log from "../utils/logging";
|
||||
import {
|
||||
getUvVersionFromParsedPyproject,
|
||||
getUvVersionFromRequirementsText,
|
||||
parsePyprojectContent,
|
||||
} from "./requirements-file";
|
||||
import { normalizeVersionSpecifier } from "./specifier";
|
||||
import { getUvVersionFromToolVersions } from "./tool-versions-file";
|
||||
import type { ParsedVersionFile, VersionFileFormat } from "./types";
|
||||
|
||||
interface VersionFileParser {
|
||||
format: VersionFileFormat;
|
||||
parse(filePath: string): string | undefined;
|
||||
supports(filePath: string): boolean;
|
||||
}
|
||||
|
||||
const VERSION_FILE_PARSERS: VersionFileParser[] = [
|
||||
{
|
||||
format: ".tool-versions",
|
||||
parse: (filePath) => getUvVersionFromToolVersions(filePath),
|
||||
supports: (filePath) => filePath.endsWith(".tool-versions"),
|
||||
},
|
||||
{
|
||||
format: "uv.toml",
|
||||
parse: (filePath) => {
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
return getConfigValueFromTomlContent(
|
||||
filePath,
|
||||
fileContent,
|
||||
"required-version",
|
||||
);
|
||||
},
|
||||
supports: (filePath) => filePath.endsWith("uv.toml"),
|
||||
},
|
||||
{
|
||||
format: "pyproject.toml",
|
||||
parse: (filePath) => {
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
const pyproject = parsePyprojectContent(fileContent);
|
||||
const requiredVersion = pyproject.tool?.uv?.["required-version"];
|
||||
|
||||
if (requiredVersion !== undefined) {
|
||||
return requiredVersion;
|
||||
}
|
||||
|
||||
return getUvVersionFromParsedPyproject(pyproject);
|
||||
},
|
||||
supports: (filePath) => filePath.endsWith("pyproject.toml"),
|
||||
},
|
||||
{
|
||||
format: "requirements",
|
||||
parse: (filePath) => {
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
return getUvVersionFromRequirementsText(fileContent);
|
||||
},
|
||||
supports: (filePath) => filePath.endsWith(".txt"),
|
||||
},
|
||||
];
|
||||
|
||||
export function getParsedVersionFile(
|
||||
filePath: string,
|
||||
): ParsedVersionFile | undefined {
|
||||
log.info(`Trying to find version for uv in: ${filePath}`);
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
log.info(`Could not find file: ${filePath}`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const parser = getVersionFileParser(filePath);
|
||||
if (parser === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const specifier = parser.parse(filePath);
|
||||
if (specifier === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const normalizedSpecifier = normalizeVersionSpecifier(specifier);
|
||||
log.info(`Found version for uv in ${filePath}: ${normalizedSpecifier}`);
|
||||
return {
|
||||
format: parser.format,
|
||||
specifier: normalizedSpecifier,
|
||||
};
|
||||
} catch (error) {
|
||||
log.warning(`Error while parsing ${filePath}: ${(error as Error).message}`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function getUvVersionFromFile(filePath: string): string | undefined {
|
||||
return getParsedVersionFile(filePath)?.specifier;
|
||||
}
|
||||
|
||||
function getVersionFileParser(filePath: string): VersionFileParser | undefined {
|
||||
return VERSION_FILE_PARSERS.find((parser) => parser.supports(filePath));
|
||||
}
|
||||
@@ -5,31 +5,23 @@ export function getUvVersionFromRequirementsFile(
|
||||
filePath: string,
|
||||
): string | undefined {
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
|
||||
if (filePath.endsWith(".txt")) {
|
||||
return getUvVersionFromAllDependencies(fileContent.split("\n"));
|
||||
return getUvVersionFromRequirementsText(fileContent);
|
||||
}
|
||||
const dependencies = parsePyprojectDependencies(fileContent);
|
||||
return getUvVersionFromAllDependencies(dependencies);
|
||||
|
||||
return getUvVersionFromPyprojectContent(fileContent);
|
||||
}
|
||||
function getUvVersionFromAllDependencies(
|
||||
allDependencies: string[],
|
||||
|
||||
export function getUvVersionFromRequirementsText(
|
||||
fileContent: string,
|
||||
): string | undefined {
|
||||
return allDependencies
|
||||
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
||||
?.match(/^uv([=<>~!]+\S*)/)?.[1]
|
||||
.trim();
|
||||
return getUvVersionFromAllDependencies(fileContent.split("\n"));
|
||||
}
|
||||
|
||||
interface Pyproject {
|
||||
project?: {
|
||||
dependencies?: string[];
|
||||
"optional-dependencies"?: Record<string, string[]>;
|
||||
};
|
||||
"dependency-groups"?: Record<string, Array<string | object>>;
|
||||
}
|
||||
|
||||
function parsePyprojectDependencies(pyprojectContent: string): string[] {
|
||||
const pyproject: Pyproject = toml.parse(pyprojectContent);
|
||||
export function getUvVersionFromParsedPyproject(
|
||||
pyproject: Pyproject,
|
||||
): string | undefined {
|
||||
const dependencies: string[] = pyproject?.project?.dependencies || [];
|
||||
const optionalDependencies: string[] = Object.values(
|
||||
pyproject?.project?.["optional-dependencies"] || {},
|
||||
@@ -39,5 +31,39 @@ function parsePyprojectDependencies(pyprojectContent: string): string[] {
|
||||
)
|
||||
.flat()
|
||||
.filter((item: string | object) => typeof item === "string");
|
||||
return dependencies.concat(optionalDependencies, devDependencies);
|
||||
|
||||
return getUvVersionFromAllDependencies(
|
||||
dependencies.concat(optionalDependencies, devDependencies),
|
||||
);
|
||||
}
|
||||
|
||||
export function getUvVersionFromPyprojectContent(
|
||||
pyprojectContent: string,
|
||||
): string | undefined {
|
||||
const pyproject = parsePyprojectContent(pyprojectContent);
|
||||
return getUvVersionFromParsedPyproject(pyproject);
|
||||
}
|
||||
|
||||
export interface Pyproject {
|
||||
project?: {
|
||||
dependencies?: string[];
|
||||
"optional-dependencies"?: Record<string, string[]>;
|
||||
};
|
||||
"dependency-groups"?: Record<string, Array<string | object>>;
|
||||
tool?: {
|
||||
uv?: Record<string, string | undefined>;
|
||||
};
|
||||
}
|
||||
|
||||
export function parsePyprojectContent(pyprojectContent: string): Pyproject {
|
||||
return toml.parse(pyprojectContent) as Pyproject;
|
||||
}
|
||||
|
||||
function getUvVersionFromAllDependencies(
|
||||
allDependencies: string[],
|
||||
): string | undefined {
|
||||
return allDependencies
|
||||
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
||||
?.match(/^uv([=<>~!]+\S*)/)?.[1]
|
||||
.trim();
|
||||
}
|
||||
|
||||
+181
-31
@@ -1,34 +1,184 @@
|
||||
import fs from "node:fs";
|
||||
import * as core from "@actions/core";
|
||||
import { getConfigValueFromTomlFile } from "../utils/config-file";
|
||||
import { getUvVersionFromRequirementsFile } from "./requirements-file";
|
||||
import { getUvVersionFromToolVersions } from "./tool-versions-file";
|
||||
import * as tc from "@actions/tool-cache";
|
||||
import * as pep440 from "@renovatebot/pep440";
|
||||
import * as semver from "semver";
|
||||
import { getAllVersions, getLatestVersion } from "../download/manifest";
|
||||
import type { ResolutionStrategy } from "../utils/inputs";
|
||||
import * as log from "../utils/logging";
|
||||
import {
|
||||
type ParsedVersionSpecifier,
|
||||
parseVersionSpecifier,
|
||||
} from "./specifier";
|
||||
import type { ResolveUvVersionOptions } from "./types";
|
||||
import { resolveVersionRequest } from "./version-request-resolver";
|
||||
|
||||
export function getUvVersionFromFile(filePath: string): string | undefined {
|
||||
core.info(`Trying to find version for uv in: ${filePath}`);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
core.info(`Could not find file: ${filePath}`);
|
||||
return undefined;
|
||||
}
|
||||
let uvVersion: string | undefined;
|
||||
try {
|
||||
uvVersion = getUvVersionFromToolVersions(filePath);
|
||||
if (uvVersion === undefined) {
|
||||
uvVersion = getConfigValueFromTomlFile(filePath, "required-version");
|
||||
}
|
||||
if (uvVersion === undefined) {
|
||||
uvVersion = getUvVersionFromRequirementsFile(filePath);
|
||||
}
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
core.warning(`Error while parsing ${filePath}: ${message}`);
|
||||
return undefined;
|
||||
}
|
||||
if (uvVersion?.startsWith("==")) {
|
||||
uvVersion = uvVersion.slice(2);
|
||||
}
|
||||
if (uvVersion !== undefined) {
|
||||
core.info(`Found version for uv in ${filePath}: ${uvVersion}`);
|
||||
}
|
||||
return uvVersion;
|
||||
interface ConcreteVersionResolutionContext {
|
||||
manifestUrl?: string;
|
||||
parsedSpecifier: ParsedVersionSpecifier;
|
||||
resolutionStrategy: ResolutionStrategy;
|
||||
}
|
||||
|
||||
interface ConcreteVersionResolver {
|
||||
resolve(
|
||||
context: ConcreteVersionResolutionContext,
|
||||
): Promise<string | undefined>;
|
||||
}
|
||||
|
||||
class ExactVersionResolver implements ConcreteVersionResolver {
|
||||
async resolve(
|
||||
context: ConcreteVersionResolutionContext,
|
||||
): Promise<string | undefined> {
|
||||
if (context.parsedSpecifier.kind !== "exact") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
core.debug(
|
||||
`Version ${context.parsedSpecifier.normalized} is an explicit version.`,
|
||||
);
|
||||
return context.parsedSpecifier.normalized;
|
||||
}
|
||||
}
|
||||
|
||||
class LatestVersionResolver implements ConcreteVersionResolver {
|
||||
async resolve(
|
||||
context: ConcreteVersionResolutionContext,
|
||||
): Promise<string | undefined> {
|
||||
const shouldUseLatestVersion =
|
||||
context.parsedSpecifier.kind === "latest" ||
|
||||
(context.parsedSpecifier.kind === "range" &&
|
||||
context.parsedSpecifier.isSimpleMinimumVersionSpecifier &&
|
||||
context.resolutionStrategy === "highest");
|
||||
|
||||
if (!shouldUseLatestVersion) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (
|
||||
context.parsedSpecifier.kind === "range" &&
|
||||
context.parsedSpecifier.isSimpleMinimumVersionSpecifier
|
||||
) {
|
||||
log.info("Found minimum version specifier, using latest version");
|
||||
}
|
||||
|
||||
const latestVersion = await getLatestVersion(context.manifestUrl);
|
||||
|
||||
if (
|
||||
context.parsedSpecifier.kind === "range" &&
|
||||
context.parsedSpecifier.isSimpleMinimumVersionSpecifier &&
|
||||
!pep440.satisfies(latestVersion, context.parsedSpecifier.raw)
|
||||
) {
|
||||
throw new Error(`No version found for ${context.parsedSpecifier.raw}`);
|
||||
}
|
||||
|
||||
return latestVersion;
|
||||
}
|
||||
}
|
||||
|
||||
class RangeVersionResolver implements ConcreteVersionResolver {
|
||||
async resolve(
|
||||
context: ConcreteVersionResolutionContext,
|
||||
): Promise<string | undefined> {
|
||||
if (context.parsedSpecifier.kind !== "range") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const availableVersions = await getAllVersions(context.manifestUrl);
|
||||
core.debug(`Available versions: ${availableVersions}`);
|
||||
|
||||
const resolvedVersion =
|
||||
context.resolutionStrategy === "lowest"
|
||||
? minSatisfying(availableVersions, context.parsedSpecifier.normalized)
|
||||
: maxSatisfying(availableVersions, context.parsedSpecifier.normalized);
|
||||
|
||||
if (resolvedVersion === undefined) {
|
||||
throw new Error(`No version found for ${context.parsedSpecifier.raw}`);
|
||||
}
|
||||
|
||||
return resolvedVersion;
|
||||
}
|
||||
}
|
||||
|
||||
const CONCRETE_VERSION_RESOLVERS: ConcreteVersionResolver[] = [
|
||||
new ExactVersionResolver(),
|
||||
new LatestVersionResolver(),
|
||||
new RangeVersionResolver(),
|
||||
];
|
||||
|
||||
export async function resolveUvVersion(
|
||||
options: ResolveUvVersionOptions,
|
||||
): Promise<string> {
|
||||
const request = resolveVersionRequest(options);
|
||||
const resolutionStrategy = options.resolutionStrategy ?? "highest";
|
||||
const version = await resolveVersion(
|
||||
request.specifier,
|
||||
options.manifestFile,
|
||||
resolutionStrategy,
|
||||
);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
export async function resolveVersion(
|
||||
versionInput: string,
|
||||
manifestUrl: string | undefined,
|
||||
resolutionStrategy: ResolutionStrategy = "highest",
|
||||
): Promise<string> {
|
||||
core.debug(`Resolving version: ${versionInput}`);
|
||||
|
||||
const context: ConcreteVersionResolutionContext = {
|
||||
manifestUrl,
|
||||
parsedSpecifier: parseVersionSpecifier(versionInput),
|
||||
resolutionStrategy,
|
||||
};
|
||||
|
||||
for (const resolver of CONCRETE_VERSION_RESOLVERS) {
|
||||
const version = await resolver.resolve(context);
|
||||
if (version !== undefined) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`No version found for ${versionInput}`);
|
||||
}
|
||||
|
||||
function maxSatisfying(
|
||||
versions: string[],
|
||||
version: string,
|
||||
): string | undefined {
|
||||
const maxSemver = tc.evaluateVersions(versions, version);
|
||||
if (maxSemver !== "") {
|
||||
core.debug(`Found a version that satisfies the semver range: ${maxSemver}`);
|
||||
return maxSemver;
|
||||
}
|
||||
|
||||
const maxPep440 = pep440.maxSatisfying(versions, version);
|
||||
if (maxPep440 !== null) {
|
||||
core.debug(
|
||||
`Found a version that satisfies the pep440 specifier: ${maxPep440}`,
|
||||
);
|
||||
return maxPep440;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function minSatisfying(
|
||||
versions: string[],
|
||||
version: string,
|
||||
): string | undefined {
|
||||
const minSemver = semver.minSatisfying(versions, version);
|
||||
if (minSemver !== null) {
|
||||
core.debug(`Found a version that satisfies the semver range: ${minSemver}`);
|
||||
return minSemver;
|
||||
}
|
||||
|
||||
const minPep440 = pep440.minSatisfying(versions, version);
|
||||
if (minPep440 !== null) {
|
||||
core.debug(
|
||||
`Found a version that satisfies the pep440 specifier: ${minPep440}`,
|
||||
);
|
||||
return minPep440;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import * as tc from "@actions/tool-cache";
|
||||
|
||||
export type ParsedVersionSpecifier =
|
||||
| {
|
||||
kind: "exact";
|
||||
normalized: string;
|
||||
raw: string;
|
||||
}
|
||||
| {
|
||||
kind: "latest";
|
||||
normalized: "latest";
|
||||
raw: string;
|
||||
}
|
||||
| {
|
||||
isSimpleMinimumVersionSpecifier: boolean;
|
||||
kind: "range";
|
||||
normalized: string;
|
||||
raw: string;
|
||||
};
|
||||
|
||||
export function normalizeVersionSpecifier(specifier: string): string {
|
||||
const trimmedSpecifier = specifier.trim();
|
||||
|
||||
if (trimmedSpecifier.startsWith("==")) {
|
||||
return trimmedSpecifier.slice(2);
|
||||
}
|
||||
|
||||
return trimmedSpecifier;
|
||||
}
|
||||
|
||||
export function parseVersionSpecifier(
|
||||
specifier: string,
|
||||
): ParsedVersionSpecifier {
|
||||
const raw = specifier.trim();
|
||||
const normalized = normalizeVersionSpecifier(raw);
|
||||
|
||||
if (normalized === "latest") {
|
||||
return {
|
||||
kind: "latest",
|
||||
normalized: "latest",
|
||||
raw,
|
||||
};
|
||||
}
|
||||
|
||||
if (tc.isExplicitVersion(normalized)) {
|
||||
return {
|
||||
kind: "exact",
|
||||
normalized,
|
||||
raw,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
isSimpleMinimumVersionSpecifier: raw.includes(">") && !raw.includes(","),
|
||||
kind: "range",
|
||||
normalized,
|
||||
raw,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { ResolutionStrategy } from "../utils/inputs";
|
||||
|
||||
export type VersionSource =
|
||||
| "input"
|
||||
| "version-file"
|
||||
| "uv.toml"
|
||||
| "pyproject.toml"
|
||||
| "default";
|
||||
|
||||
export type VersionFileFormat =
|
||||
| ".tool-versions"
|
||||
| "pyproject.toml"
|
||||
| "requirements"
|
||||
| "uv.toml";
|
||||
|
||||
export interface ParsedVersionFile {
|
||||
format: VersionFileFormat;
|
||||
specifier: string;
|
||||
}
|
||||
|
||||
export interface ResolveUvVersionOptions {
|
||||
manifestFile?: string;
|
||||
resolutionStrategy?: ResolutionStrategy;
|
||||
version?: string;
|
||||
versionFile?: string;
|
||||
workingDirectory: string;
|
||||
}
|
||||
|
||||
export interface VersionRequest {
|
||||
format?: VersionFileFormat;
|
||||
source: VersionSource;
|
||||
sourcePath?: string;
|
||||
specifier: string;
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import * as path from "node:path";
|
||||
import * as log from "../utils/logging";
|
||||
import { getParsedVersionFile } from "./file-parser";
|
||||
import { normalizeVersionSpecifier } from "./specifier";
|
||||
import type {
|
||||
ParsedVersionFile,
|
||||
ResolveUvVersionOptions,
|
||||
VersionRequest,
|
||||
} from "./types";
|
||||
|
||||
export interface VersionRequestResolver {
|
||||
resolve(context: VersionRequestContext): VersionRequest | undefined;
|
||||
}
|
||||
|
||||
export class VersionRequestContext {
|
||||
readonly version: string | undefined;
|
||||
readonly versionFile: string | undefined;
|
||||
readonly workingDirectory: string;
|
||||
|
||||
private readonly parsedFiles = new Map<
|
||||
string,
|
||||
ParsedVersionFile | undefined
|
||||
>();
|
||||
|
||||
constructor(
|
||||
version: string | undefined,
|
||||
versionFile: string | undefined,
|
||||
workingDirectory: string,
|
||||
) {
|
||||
this.version = version;
|
||||
this.versionFile = versionFile;
|
||||
this.workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
getVersionFile(filePath: string): ParsedVersionFile | undefined {
|
||||
const cachedResult = this.parsedFiles.get(filePath);
|
||||
if (cachedResult !== undefined || this.parsedFiles.has(filePath)) {
|
||||
return cachedResult;
|
||||
}
|
||||
|
||||
const result = getParsedVersionFile(filePath);
|
||||
this.parsedFiles.set(filePath, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
getWorkspaceCandidates(): Array<{
|
||||
source: "pyproject.toml" | "uv.toml";
|
||||
sourcePath: string;
|
||||
}> {
|
||||
return [
|
||||
{
|
||||
source: "uv.toml",
|
||||
sourcePath: path.join(this.workingDirectory, "uv.toml"),
|
||||
},
|
||||
{
|
||||
source: "pyproject.toml",
|
||||
sourcePath: path.join(this.workingDirectory, "pyproject.toml"),
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export class ExplicitInputVersionResolver implements VersionRequestResolver {
|
||||
resolve(context: VersionRequestContext): VersionRequest | undefined {
|
||||
if (context.version === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
source: "input",
|
||||
specifier: normalizeVersionSpecifier(context.version),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class VersionFileVersionResolver implements VersionRequestResolver {
|
||||
resolve(context: VersionRequestContext): VersionRequest | undefined {
|
||||
if (context.versionFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const versionFile = context.getVersionFile(context.versionFile);
|
||||
if (versionFile === undefined) {
|
||||
throw new Error(
|
||||
`Could not determine uv version from file: ${context.versionFile}`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
format: versionFile.format,
|
||||
source: "version-file",
|
||||
sourcePath: context.versionFile,
|
||||
specifier: versionFile.specifier,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class WorkspaceVersionResolver implements VersionRequestResolver {
|
||||
resolve(context: VersionRequestContext): VersionRequest | undefined {
|
||||
for (const candidate of context.getWorkspaceCandidates()) {
|
||||
const versionFile = context.getVersionFile(candidate.sourcePath);
|
||||
if (versionFile === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return {
|
||||
format: versionFile.format,
|
||||
source: candidate.source,
|
||||
sourcePath: candidate.sourcePath,
|
||||
specifier: versionFile.specifier,
|
||||
};
|
||||
}
|
||||
|
||||
log.info(
|
||||
"Could not determine uv version from uv.toml or pyproject.toml. Falling back to latest.",
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export class LatestVersionResolver implements VersionRequestResolver {
|
||||
resolve(): VersionRequest {
|
||||
return {
|
||||
source: "default",
|
||||
specifier: "latest",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const VERSION_REQUEST_RESOLVERS: VersionRequestResolver[] = [
|
||||
new ExplicitInputVersionResolver(),
|
||||
new VersionFileVersionResolver(),
|
||||
new WorkspaceVersionResolver(),
|
||||
new LatestVersionResolver(),
|
||||
];
|
||||
|
||||
export function resolveVersionRequest(
|
||||
options: ResolveUvVersionOptions,
|
||||
): VersionRequest {
|
||||
const context = new VersionRequestContext(
|
||||
emptyToUndefined(options.version),
|
||||
emptyToUndefined(options.versionFile),
|
||||
options.workingDirectory,
|
||||
);
|
||||
|
||||
for (const resolver of VERSION_REQUEST_RESOLVERS) {
|
||||
const request = resolver.resolve(context);
|
||||
if (request !== undefined) {
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Could not resolve a requested uv version.");
|
||||
}
|
||||
|
||||
function emptyToUndefined(value: string | undefined): string | undefined {
|
||||
return value === undefined || value === "" ? undefined : value;
|
||||
}
|
||||
Reference in New Issue
Block a user