Compare commits

...
Author SHA1 Message Date
dependabot[bot] d9fed21359 chore(deps): bump github/codeql-action/autobuild from 4.38.2 to 4.39.0
Bumps [github/codeql-action/autobuild](https://github.com/github/codeql-action) from 4.38.2 to 4.39.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee)

---
updated-dependencies:
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 10:53:25 +00:00
github-actions[bot]andeifinger 963ce8fe9e chore: update known checksums for 0.13.8 (#1131)
chore: update known checksums for 0.13.8

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-11-13 09:00:13 +01:00
Kevin Stillhammer 5e83ccf689 chore(deps): roll up Dependabot dependency updates (#1130)
## Summary
- Reproduce the remaining dependency changes from nine open Dependabot
PRs against current main, without reverting unrelated changes from older
PR branches.
- Update actions/setup-node to 7.1.0 (#1127), release-drafter to 7.10.0
(#1126), and CodeQL init/analyze/autobuild to 4.38.2 (#1116, #1115,
#1114).
- Update @types/node to 26.6.2 (#1108), undici to 8.11.0 (#1107), Biome
to 2.5.14 (#1106), and Jest to 30.5.2 (#1105).
- Align the Biome schema and regenerate affected action bundles.

## Excluded
- #1029 (TypeScript 7.0.2): all 16 test suites fail before executing
tests because ts-jest 29.4.11 expects the TypeScript compiler API and
declares a >=4.3 <7 peer range. Excluded with operator approval;
TypeScript remains at 6.0.3.
- None of the ten open Dependabot PRs were already no-ops against main.

## Validation
- npm ci --ignore-scripts
- npm run all: passed (16 suites, 179 tests; no Biome fixes)
- actionlint: passed
- uvx zizmor --offline .github/workflows: no findings
- npm audit signatures: 353 verified registry signatures, 38 verified
attestations
- Workflow all-tests-passed dependency check: passed
- git diff --check: passed

npm installation reports 30 audit vulnerabilities, matching the baseline
count; unrelated audit fixes are outside this rollup.

Refs: pi-session 01a1d01c-e089-7536-b5be-fed125cdaa18
2026-11-12 15:20:49 +01:00
yamamoto7andClaude Opus 5.5 898180d41d fix: resolve partial PEP 440 specifiers with PEP 440 semantics (#1128)
## Summary

`<=`, `==` and `>` with a partial version are valid PEP 440 specifiers,
but the resolver tries them as semver ranges first, and semver reads
them differently:

| specifier | semver (before) | PEP 440 (what uv enforces) |
|---|---|---|
| `<=0.5` | `<0.6.0`, installs 0.5.31 | `<=0.5.0`, installs 0.5.0 |
| `==0.5` | `==` is stripped and `0.5` is read as `0.5.x`, installs
0.5.31 | `==0.5.0`, installs 0.5.0 |
| `>0.5` with `resolution-strategy: lowest` | `>=0.6.0`, installs 0.6.0
| `>0.5.0`, installs 0.5.1 |

So `required-version = "<=0.5"` or `"==0.5"` in `uv.toml` /
`pyproject.toml` installs a uv that does not satisfy the project's own
`required-version`, and uv refuses to run there (`Required uv version
... does not match the running version ...`).

This is the same problem #1111 fixed for `~=`. Instead of adding more
operators to that check, specifiers that `@renovatebot/pep440` accepts
as a valid range now skip the semver evaluation, and `==` is only
stripped from a full version, so `==0.5` stays a PEP 440 pin.

Notes:

- Semver-only syntax is not valid PEP 440 and still goes through semver:
`0.4.x`, `^0.5`, `~0.5`, `>=0.4.0 <0.5.0` and a bare `0.5`.
- Inputs that are valid in both, like `>=0.4.0` from the docs, now go
through PEP 440. They mean the same in both, and the PEP 440 path uses
the same first-match lookup over the manifest.
- Full pins like `==0.9.26` still resolve as explicit versions, and
compound specifiers like `>=0.4,<=0.5` already went through PEP 440.

## Test plan

- Added cases for `<=0.9` and `==0.9` with the default strategy and
`>0.9` with `lowest` in `download-version.test.ts`. All three fail
without the change.
- `npm ci --ignore-scripts`, then `npm run build`, `npm run check` (no
fixes), `npm run package` and `npm run test:unit` on macOS with Node
24.13.0: 179 tests across 16 suites pass. The rebuilt
`dist/setup/index.cjs` only differs in the changed functions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 15:12:48 +01:00
Kevin Stillhammer bd4d5efd86 Fix workflow tests after ubuntu-latest switch to 26.04 (#1129)
## Summary
Fix two workflow issues exposed by the `ubuntu-latest` transition to
Ubuntu 26.04, in separate commits:

- Use `npx --no-install tsc` in the workflow job dependency check
instead of relying on a globally installed TypeScript compiler, matching
https://github.com/astral-sh/ruff-action/pull/455.
- Disable caching in `test-specific-version`,
`test-version-file-version`, and `test-tool-versions-python-version`.
These jobs only verify versions or outputs and do not create a
dependency cache directory.

## Background
The cache key includes the OS version, so the runner transition caused
cache misses. Previously restored caches bypassed cache saving and hid
the missing-directory problem. On a cold cache, cleanup tried to save a
directory that these tests never created. Disabling caching makes these
non-cache tests independent of existing cache entries; dedicated cache
tests remain unchanged.

## Validation
- `npm ci --ignore-scripts` and `npm run all` using npm 11.10.0 after
the compiler fix (176 tests passed)
- Workflow TypeScript compilation and job dependency check
- `actionlint` and `uvx zizmor .github/workflows/test.yml` passed after
both changes
- `git diff --check`

Refs: pi-session 01a1cfe6-d342-70b6-a474-504b84877d9e
2026-11-12 14:45:39 +01:00
dependabot[bot] 0a73d6eb01 chore(deps): bump release-drafter/release-drafter from 7.7.0 to 7.9.0 (#1121)
Bumps
[release-drafter/release-drafter](https://github.com/release-drafter/release-drafter)
from 7.7.0 to 7.9.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/release-drafter/release-drafter/releases">release-drafter/release-drafter's
releases</a>.</em></p>
<blockquote>
<h2>v7.9.0</h2>
<h1>What's Changed</h1>
<h2>New</h2>
<ul>
<li>feat(autolabeler): sync configured pull request labels (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1787">#1787</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat(autolabeler): support multiple labels, stop rules and fallback
(<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1785">#1785</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat: expose PR labels in Drafter and Check PR outputs (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1782">#1782</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat: add resolved tag template variable (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1784">#1784</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
</ul>
<h2>Dependency Updates</h2>
<ul>
<li>ci(deps): update reviewdog/action-actionlint action to v1.77.0 (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1781">#1781</a>)
<a
href="https://github.com/apps/renovate"><code>@​renovate[bot]</code></a></li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li>fix(config): provide standard loading for the programmatic API (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1783">#1783</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>fix: skip the missing-baseline warning when <code>from</code> is set
(<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1789">#1789</a>)
<a href="https://github.com/jmeridth"><code>@​jmeridth</code></a></li>
</ul>
<h2>Maintenance</h2>
<ul>
<li>ci: dogfood Release Drafter and stage npm publishing (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1778">#1778</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>ci: lint GitHub Actions workflows with actionlint (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1780">#1780</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li>No new contributors</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/release-drafter/release-drafter/compare/v7.8.0...v7.9.0">https://github.com/release-drafter/release-drafter/compare/v7.8.0...v7.9.0</a></p>
<h2>v7.8.0</h2>
<h1>What's Changed</h1>
<h2>Token authentication change</h2>
<p>The <code>token</code> action input now takes precedence over
<code>env.GITHUB_TOKEN</code> and defaults to <code>${{ github.token
}}</code>. Pass a PAT or GitHub App token through
<code>with.token</code>, especially when publishing releases that should
trigger downstream workflows:</p>
<pre lang="yaml"><code>with:
  token: ${{ secrets.PAT }}
  publish: true
</code></pre>
<h2>New</h2>
<ul>
<li>feat: merge repeated changes with group-changes (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1725">#1725</a>)
<a
href="https://github.com/slawekjaranowski"><code>@​slawekjaranowski</code></a>,
<a href="https://github.com/claude"><code>@​claude</code></a></li>
<li>feat(facade): wire multiforge adapters (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1709">#1709</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat(adapters): add GitLab REST adapter (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1708">#1708</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat(adapters): add Gitea and Forgejo REST adapters (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1707">#1707</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
<li>feat: add config-driven check-pr validation (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1706">#1706</a>)
<a href="https://github.com/jetersen"><code>@​jetersen</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/72967cdc98ddd3160f1fc3dff619de365e137dd0"><code>72967cd</code></a>
chore: release v7.9.0 (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1790">#1790</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/43cd2a9c7fdb7a2f7251be3394eabbaa641afd31"><code>43cd2a9</code></a>
feat(autolabeler): sync configured pull request labels (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1787">#1787</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/a99850f1915e19ca4688cb09fdb1aed905599e14"><code>a99850f</code></a>
feat(autolabeler): support multiple labels, stop rules and fallback (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1785">#1785</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/26b70804414cbb9f92ad61943b96089cb3e613c5"><code>26b7080</code></a>
feat: expose PR labels in Drafter and Check PR outputs (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1782">#1782</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/58b89af2fab657ccc06f1b1a8968049ac862ad37"><code>58b89af</code></a>
feat: add resolved tag template variable (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1784">#1784</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/7aa25ba4c5822e4f85a6e081a29258c05346823a"><code>7aa25ba</code></a>
fix(config): provide standard loading for the programmatic API (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1783">#1783</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/1e800128f2866500319ebd3f13ab67c4713b9f99"><code>1e80012</code></a>
fix: skip the missing-baseline warning when <code>from</code> is set (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1789">#1789</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/57f417922ac8a5cf17282aec6e7786aba69a3ee8"><code>57f4179</code></a>
ci: dogfood Release Drafter and stage npm publishing (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1778">#1778</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/75620c000f3cea11ac40a3fc917a07910bdfa677"><code>75620c0</code></a>
ci(deps): update reviewdog/action-actionlint action to v1.77.0 (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1781">#1781</a>)</li>
<li><a
href="https://github.com/release-drafter/release-drafter/commit/fb48a58bf7b2fa270433efd264ac3211839bc258"><code>fb48a58</code></a>
ci: lint GitHub Actions workflows with actionlint (<a
href="https://redirect.github.com/release-drafter/release-drafter/issues/1780">#1780</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/release-drafter/release-drafter/compare/34d80673e067bdc0c24568d3af899c216adcfaa9...72967cdc98ddd3160f1fc3dff619de365e137dd0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=release-drafter/release-drafter&package-manager=github_actions&previous-version=7.7.0&new-version=7.9.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-04 09:17:08 +01:00
William Woodruff 68ef1d76d3 Run demudhra first on macOS (#1125) 2026-11-03 13:23:25 -05:00
Zsolt Dollenstein fce2a640fd Repair cached Python directory junctions on Windows (#1122)
With `cache-python: true`, a Windows runner can report a cache hit while
extracting the cache incorrectly. When `@actions/cache`'s tar extracts
uv's minor-version junction before the patch directory it points to, it
creates a file symlink. Resolving that link later raises `[WinError 5]
Access is denied`.

This PR fixes things up after restoring the Python cache, recreating the
junction if resolving the link fails with access denied and its recorded
target is a matching, accessible CPython installation in the same
directory.

This is a temporary workaround until
https://github.com/actions/toolkit/issues/2562 gets resolved and
`@actions/cache` itself becomes resilient to these situations.

I tested this by restoring the same archive on two fresh `windows-2022`
runners. The original run passed because resolving the minor-version
link raised the expected WinError 5. With the patch, `uv sync --offline
--managed-python --no-python-downloads` created a virtual environment
whose `home` in `pyvenv.cfg` resolved to the cached CPython 3.10.22
installation. [Original
run](https://github.com/astral-sh/ruff/actions/runs/41469344610/job/125358623949#step:9:1)
· [Patched
run](https://github.com/astral-sh/ruff/actions/runs/41469344610/job/125358623835#step:10:1).
2026-11-03 19:11:16 +01:00
github-actions[bot]andeifinger a1b1886df2 chore: update known checksums for 0.13.7 (#1124)
chore: update known checksums for 0.13.7

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-11-03 09:20:52 +01:00
github-actions[bot]andeifinger 4c58170a94 docs: update version references to v10.3.3 (#1120)
Update `uses: astral-sh/setup-uv@...` references in documentation to
`68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3`.

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-28 15:45:31 +01:00
Kevin StillhammerandAmp 68559e99cc Use Astral mirror for version manifests with GitHub fallback (#1119)
Amp-Thread-ID:
https://ampcode.com/threads/T-01a1822a-68da-7125-9e7d-16e038ab0840

Closes: #1118

Co-authored-by: Amp <amp@ampcode.com>
2026-10-28 15:09:55 +01:00
github-actions[bot]andeifinger 0192b69518 chore: update known checksums for 0.13.6 (#1117)
chore: update known checksums for 0.13.6

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-27 11:55:43 +01:00
Kevin StillhammerandAmp 2f29784424 docs: use JSDoc for compatible release specifier comment (#1113)
Amp-Thread-ID:
https://ampcode.com/threads/T-01a17443-b5b9-703c-8877-780650eae403

Co-authored-by: Amp <amp@ampcode.com>
2026-10-26 08:49:11 +01:00
soujasKandClaude Opus 5.5 9c7332190c fix: allow whitespace in uv requirement specifiers (#1112)
## Summary

When the uv version is read from dependencies (`requirements.txt`, or
`project.dependencies` / `optional-dependencies` / `dependency-groups`
in `pyproject.toml` via `version-file`), the specifier was matched with
`/^uv([=<>~!]+\S*)/`. PEP 508 allows whitespace around operators and
after commas, and those valid forms were misread:

| dependency | before | after |
|---|---|---|
| `uv >= 0.5.0` | not found, latest uv installed | `>=0.5.0` |
| `uv == 0.11.20` | not found, latest uv installed | `==0.11.20` |
| `uv>=0.5.0, <0.6.0` | `>=0.5.0,`, fails with `No version found for
>=0.5.0,` | `>=0.5.0,<0.6.0` |

The regex now allows whitespace around operators and between
comma-separated clauses, and strips it from the result. Inputs that
worked before give the same result, including inline `--hash=` options,
trailing ` # comments`, the `\` continuation lines from `uv pip compile
--generate-hashes`, and names that only start with `uv` (`uvicorn`,
`uv-build`).

## Test plan

- Added cases for spaced operators, spaced clauses, inline `--hash` and
trailing comments. The four whitespace cases failed before the change.
- `npm run all` on Ubuntu (WSL) with Node 24.19.0: build, Biome (no
fixes), packaging, and 165 tests across 15 suites pass. The rebuilt
`dist/setup/index.cjs` only differs in the changed line.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:37:03 +01:00
soujasKandClaude Opus 5.5 80fbe0140c fix: resolve ~= specifiers with PEP 440 semantics (#1111)
## Summary

`~=` is the PEP 440 compatible release operator, but the resolver tries
`semver.validRange()` first, and semver accepts `~=` as a tilde range:

| specifier | semver | PEP 440 |
|---|---|---|
| `~=0.9` | `>=0.9.0 <0.10.0` | `>=0.9, ==0.*` |

So with the default `highest` strategy, `version: "~=0.9"` (or
`required-version = "~=0.9"` picked up through `version-file`) installs
the highest 0.9.x instead of the highest 0.x. The same happens with
`manifest-file`, where `tc.evaluateVersions` is semver-based.

This skips the semver evaluation for specifiers containing `~=`, so they
are only evaluated with `@renovatebot/pep440`. No semver range
legitimately uses `~=`.

Notes:

- Only a bare two-segment `~=X.Y` resolved incorrectly. `~=X.Y.Z` gives
the same result in both, and compound specifiers like `~=0.9, !=0.9.3`
were already rejected by semver and fell through to PEP 440.
- `minSatisfying` gets the same check for consistency. The lower bound
is the same under both interpretations, so `lowest` didn't produce wrong
results before.
- A single-segment `~=1` is invalid PEP 440. semver used to resolve it
to 1.x; it now fails with `No version found for ~=1`, same as other
invalid specifiers.

## Test plan

- Added tests for `~=0.9` with the default manifest and with
`manifest-file`. Both returned `0.9.26` instead of `0.10.2` before the
change.
- `npm run all` on Ubuntu (WSL) with Node 24.19.0: build, Biome (no
fixes), packaging, and 161 tests across 15 suites pass. The rebuilt
`dist/setup/index.cjs` only differs in the changed lines.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:39:29 +01:00
soujasKandClaude Opus 5.5 36b7b57007 fix: only report a saved cache when saving succeeded (#1110)
## Summary

The post step logs `uv cache saved with key: ...` (and `Python cache
saved with key: ...`) even when the save failed. The log in #769 shows
it right after `Warning: Failed to save: ...`:

```
Warning: Failed to save: "C:\Program failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
uv cache saved with key: setup-uv-2-x86_64-pc-windows-msvc-windows-11-3.12.12-pruned-...
```

`@actions/cache`'s `saveCache` doesn't throw for these failures. It logs
them and returns `-1`, and `saveCacheToKey` ignored the return value.
This now checks for `-1` before logging, which is the same check the
`actions/cache` save step uses (`if (cacheId != -1) core.info("Cache
saved with key: ...")`). `@actions/cache` already logs the reason, so
nothing else is logged on failure, and the exit code stays the same.

This only changes the log line. It doesn't address the underlying
tar/gzip failure in #769. One limitation: with the legacy (v1) cache
service, an upload that fails after the cache was reserved still returns
the reserved id, so that one case is still reported as saved. That's on
the `@actions/cache` side and affects `actions/cache` the same way.

Related to #769

## Test plan

- Added `__tests__/cache/save-cache.test.ts`. The `-1` case fails before
the change and passes after it.
- `npm run all` on Ubuntu (WSL) with Node 24.19.0 / npm 11.17.0: build,
Biome (no fixes), packaging, and all 161 tests across 16 suites pass.
The regenerated `dist/save-cache/index.cjs` only differs in the changed
lines.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:38:39 +01:00
github-actions[bot]andeifinger 56618cab7a docs: update version references to v10.3.2 (#1104)
Update `uses: astral-sh/setup-uv@...` references in documentation to
`07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2`.

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-22 11:25:32 +02:00
github-actions[bot]andeifinger 07a047e608 chore: update known checksums for 0.13.5 (#1103)
chore: update known checksums for 0.13.5

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-22 10:18:56 +02:00
github-actions[bot]andeifinger e1b85369e7 docs: update version references to v10.3.1 (#1102)
Update `uses: astral-sh/setup-uv@...` references in documentation to
`18d369b23da25a81e9458561248e1aafff6a70fa # v10.3.1`.

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-21 22:51:19 +02:00
Kevin Stillhammer 18d369b23d chore(deps): roll up Dependabot updates (#1101)
## Summary

Roll up the remaining dependency changes from eight open Dependabot PRs
against current `main`, without reverting newer workflow settings:

- CodeQL init, analyze, and autobuild: 4.37.7 → 4.38.1 (#1097, #1096,
#1095)
- zizmor-action: 0.6.3 → 0.6.4 (#1085)
- @biomejs/biome: 2.5.9 → 2.5.11, including its schema URL (#1075)
- @types/node: 26.2.0 → 26.4.0 (#1074)
- Jest: 30.4.2 → 30.5.0 (#1073)
- js-yaml: 5.3.0 → 5.4.1 (#1072)

All nine open Dependabot PRs had remaining dependency changes; none was
a no-op. TypeScript 7.0.2 (#1029) is intentionally deferred with
maintainer approval: ts-jest 29.4.11 requires TypeScript <7, and
applying the update caused all 15 test suites to fail before running
with `Cannot read properties of undefined (reading 'readFile')`.

The lockfile was regenerated using npm install with scripts disabled. No
runtime dependency entries changed, and repackaging produced no `dist/`
changes.

## Validation

Using Node 24.19.0 and npm 11.10.0:

- `npm ci --ignore-scripts`
- `npm run all` — passed; 15 test suites, 159 tests; Biome applied no
fixes
- `npm audit signatures` — all 353 audited packages have verified
registry signatures; 38 have verified attestations
- `actionlint .github/workflows/codeql-analysis.yml
.github/workflows/test.yml` — passed
- `uvx zizmor --no-progress --offline
.github/workflows/codeql-analysis.yml .github/workflows/test.yml` — no
findings
- `git diff --check` — passed

Refs: pi-session 01a15ec2-de1a-7557-a0bb-00369b0a4a10
2026-10-21 16:17:16 +02:00
github-actions[bot]andeifinger 4ad2329c1e chore: update known checksums for 0.13.4 (#1099)
chore: update known checksums for 0.13.4

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-21 09:58:30 +02:00
github-actions[bot]andeifinger 4bc6759c82 chore: update known checksums for 0.13.2/0.13.3 (#1098)
chore: update known checksums for 0.13.2/0.13.3

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-20 08:46:37 +02:00
Danny Ward c97f06e356 fix: preserve cache error class names in save-cache bundle (#1093)
## Summary

- Preserve class names in the save-cache bundle so `@actions/cache`
error-name comparisons distinguish validation errors, benign
cache-reservation races, and finalization errors correctly.
- Add regression coverage that exercises the bundled `ValidationError`,
`ReserveCacheError`, and `FinalizeCacheError` constructors.

Fixes #1028

## Verification

- `npm run all` passed on Ubuntu 24.04 with Node 24.19.0: build, Biome,
packaging, and all 159 tests across 15 suites.
- `git diff --check` passed.

The save-cache bundle increases by about 77 KB raw (14 KB gzip) to
preserve the required names.
2026-10-15 14:57:07 +02:00
github-actions[bot]andeifinger 8ca4be000b chore: update known checksums for 0.13.1 (#1094)
chore: update known checksums for 0.13.1

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2026-10-15 08:23:05 +02:00
flange-ipb b627d85691 docs: cache-dependency-glob matches relative to the working directory (#1092)
Hello!

In #498 the behaviour of the `cache-dependency-glob` flag changed from
being relative to repository root to being relative to
`working-directory`. This is not yet documented in README.md.
[docs/caching.md](https://github.com/astral-sh/setup-uv/blob/f64d32b1cd6cc11405a74665b3dfb7bb86fea9f0/docs/caching.md#cache-dependency-glob)
already documents this behaviour correctly.
2026-10-14 15:58:35 +02:00
zaniebotandzaniebot f8c88970fc Verify npm dependency signatures before builds (#1027)
CI installs the locked npm dependency tree without running lifecycle
scripts, but it does not verify registry signatures or available
provenance attestations. Run `npm audit signatures` after installation
in both the test and checksum-update workflows, before `npm run all`
executes dependency tooling. The check follows npm's registry-signature
support and verifies attestations when present; it does not require
every dependency to publish provenance.

Related: astral-sh/ruff-action#402 adds the same signature and
provenance verification. astral-sh/setup-uv#1026 separately hardens
`npm` install defaults.

Co-authored-by: zaniebot <242828183+zaniebot@users.noreply.github.com>
2026-10-14 10:52:00 +02:00
github-actions[bot]andzanieb f64d32b1cd docs: update version references to v10.3.0 (#1090)
Update `uses: astral-sh/setup-uv@...` references in documentation to
`1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0`.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2026-10-09 23:17:16 +02:00
32 changed files with 8614 additions and 4208 deletions

No files matched your search

+3 -3
View File
@@ -47,7 +47,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
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@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
uses: github/codeql-action/autobuild@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.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@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
pull-requests: read
steps:
- name: 🚀 Run Release Drafter
uses: release-drafter/release-drafter@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
uses: release-drafter/release-drafter@978bb0b30c5ee8cdd332ced253758157150d43f0 # v7.10.0
with:
commitish: ${{ github.sha }}
env:
+49 -19
View File
@@ -27,18 +27,20 @@ jobs:
- name: Actionlint
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
- name: Run zizmor
uses: zizmorcore/zizmor-action@70fb788f84895a7701f5643d103d587e460b5c99 # v0.6.3
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: |
npm ci --ignore-scripts
- name: Verify npm package signatures
run: npm audit signatures
- run: |
npm run all
- name: Check all jobs are in all-tests-passed.needs
run: |
tsc -p tsconfig.json
npx --no-install tsc -p tsconfig.json
node check-all-tests-passed-needs.js
working-directory: .github/scripts
- name: Make sure no changes from linters are detected
@@ -51,6 +53,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -132,6 +136,7 @@ jobs:
id: setup-uv
uses: $/
with:
enable-cache: false
version: ${{ matrix.input.version-input }}
resolution-strategy: ${{ matrix.input.resolution-strategy || 'highest' }}
- name: Correct version gets installed
@@ -223,6 +228,7 @@ jobs:
- name: Install version from ${{ matrix.input.version-file }}
uses: $/
with:
enable-cache: false
version-file: ${{ matrix.input.version-file }}
- name: Correct version gets installed
run: |
@@ -241,6 +247,7 @@ jobs:
id: setup-uv
uses: $/
with:
enable-cache: false
version-file: "__tests__/fixtures/.tool-versions"
- name: Verify Python version from .tool-versions
run: |
@@ -279,6 +286,8 @@ jobs:
- os: macos-latest
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -316,6 +325,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install default version
uses: $/
- run: uv tool install ruff==0.14.10
@@ -327,6 +338,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -364,6 +377,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install latest version
id: setup-uv
uses: $/
@@ -400,6 +415,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install latest version
id: setup-uv
uses: $/
@@ -549,6 +566,8 @@ jobs:
- os: windows-2025
expected-os: "windows-2025"
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Setup uv
id: setup-uv
uses: $/
@@ -983,14 +1002,18 @@ jobs:
run: rm -rf "$UV_PYTHON_INSTALL_DIR"
test-cache-python-installs:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Verify Python install dir is not populated
shell: bash
run: |
if [ -d /home/runner/work/_temp/uv-python-dir ]; then
if [ -e "$RUNNER_TEMP/uv-python-dir" ]; then
echo "Python install dir should not exist"
exit 1
fi
@@ -1003,21 +1026,26 @@ jobs:
- run: uv sync --managed-python
working-directory: __tests__/fixtures/uv-project
- name: Verify Python install dir exists
shell: bash
run: |
if [ ! -d /home/runner/work/_temp/uv-python-dir ]; then
if [ ! -d "$UV_PYTHON_INSTALL_DIR" ]; then
echo "Python install dir should exist"
exit 1
fi
test-restore-python-installs:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs: test-cache-python-installs
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Verify Python install dir does not exist
shell: bash
run: |
if [ -d /home/runner/work/_temp/uv-python-dir ]; then
if [ -e "$RUNNER_TEMP/uv-python-dir" ]; then
echo "Python install dir should not exist"
exit 1
fi
@@ -1028,19 +1056,21 @@ jobs:
enable-cache: true
cache-python: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-cache-python-installs
- name: Verify Python install dir exists
run: |
if [ ! -d /home/runner/work/_temp/uv-python-dir ]; then
echo "Python install dir should exist"
exit 1
fi
- name: Cache was hit
run: |
if [ "$CACHE_HIT" != "true" ]; then
exit 1
fi
- name: Verify the restored Python minor-version link resolves to the patch directory
shell: python
env:
CACHE_HIT: ${{ steps.restore.outputs.python-cache-hit }}
run: |
import os
from pathlib import Path
assert os.environ["CACHE_HIT"] == "true", "expected a Python cache hit"
installs = Path(os.environ["UV_PYTHON_INSTALL_DIR"]).resolve()
assert installs.is_dir(), "Python install dir should exist"
patch_dir, = installs.glob("cpython-*.*.*-*")
minor_prefix = patch_dir.name.rsplit(".", 1)[0]
alias, = installs.glob(f"{minor_prefix}-*")
assert alias.resolve(strict=True) == patch_dir, alias
- run: uv sync --managed-python
working-directory: __tests__/fixtures/uv-project
+5 -2
View File
@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: true
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
@@ -38,7 +38,10 @@ jobs:
fi
- name: Compile changes
if: ${{ steps.changes-exist.outputs.changes-exist == 'true' }}
run: npm ci --ignore-scripts && npm run all
run: |
npm ci --ignore-scripts
npm audit signatures
npm run all
- name: Create Pull Request
if: ${{ steps.changes-exist.outputs.changes-exist == 'true' }}
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
+11 -11
View File
@@ -27,7 +27,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
```yaml
- name: Install the latest version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
```
If you do not specify a version, this action will look for a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
@@ -43,7 +43,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
```yaml
- name: Install uv with all available options
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
# The version of uv to install, e.g., "0.5.0", "latest", or "latest-known" (default: searches for version in config files, then latest)
version: ""
@@ -81,7 +81,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
# Enable the GitHub Actions cache for uv: true, false, or auto (enabled on GitHub-hosted runners except for release, tag push, pull_request_target, and workflow_run events; disabled on self-hosted runners)
enable-cache: "auto"
# Glob pattern to match files relative to the repository root to control the cache
# Glob pattern to match files relative to the working directory to control the cache
cache-dependency-glob: |
**/*requirements*.txt
**/*requirements*.in
@@ -143,7 +143,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
- `venv`: Path to the activated venv if activate-environment is true.
- `python-version`: The Python version that was set.
- `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime. Empty when `activate-environment` is false.
- `python-cache-hit`: A boolean value to indicate the Python cache entry was found.
- `python-cache-hit`: A boolean indicating whether the Python cache was restored successfully.
### Python version
@@ -161,7 +161,7 @@ python 3.13
```
```yaml
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version-file: ".tool-versions"
```
@@ -172,7 +172,7 @@ a warning.
```yaml
- name: Install the latest version of uv and set the python version to 3.13t
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: 3.13t
- run: uv pip install --python=3.13t pip
@@ -190,7 +190,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: ${{ matrix.python-version }}
- name: Test with python ${{ matrix.python-version }}
@@ -226,7 +226,7 @@ It also controls where [the venv gets created](#activate-environment), unless `v
```yaml
- name: Install uv based on the config files in the working-directory
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
working-directory: my/subproject/dir
```
@@ -268,7 +268,7 @@ For example:
- name: Checkout the repository
uses: actions/checkout@main
- name: Install the latest version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Test
@@ -280,7 +280,7 @@ To install a specific version of Python, use
```yaml
- name: Install the latest version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Install Python 3.12
@@ -299,7 +299,7 @@ output:
uses: actions/checkout@main
- name: Install the default version of uv
id: setup-uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: Print the installed version
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
```
+37
View File
@@ -1,3 +1,4 @@
import { fileURLToPath } from "node:url";
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
import { createSetupInputs } from "../helpers/setup-inputs";
@@ -48,6 +49,42 @@ beforeEach(() => {
});
describe("restoreCache", () => {
it.each([
["win32", false],
["linux", true],
] as const)(
"keeps the matched Python cache key on %s when the install directory cannot be read",
async (platform, pythonCacheHit) => {
const inputs = createSetupInputs({
cachePython: true,
// A file at the install directory path makes readdir fail.
pythonDir: fileURLToPath(import.meta.url),
restoreCache: true,
});
mockRestoreCache
.mockReturnValueOnce("uv-key")
.mockReturnValueOnce("python-key");
const originalPlatform = process.platform;
Object.defineProperty(process, "platform", { value: platform });
try {
await restoreCache(inputs);
} finally {
Object.defineProperty(process, "platform", { value: originalPlatform });
}
expect(mockSetOutput).toHaveBeenCalledWith("cache-hit", true);
expect(mockSetOutput).toHaveBeenCalledWith(
"python-cache-hit",
pythonCacheHit,
);
expect(mockSaveState).toHaveBeenCalledWith(
"python-cache-matched-key",
"python-key",
);
},
);
it("encodes Python version ranges before adding them to the cache key", async () => {
await restoreCache(createSetupInputs(), ">3.10.11,<3.11");
+33
View File
@@ -0,0 +1,33 @@
import { readFileSync } from "node:fs";
import { runInNewContext } from "node:vm";
import { expect, it } from "@jest/globals";
const saveCacheBundle = readFileSync(
new URL("../../dist/save-cache/index.cjs", import.meta.url),
"utf8",
);
function bundledErrorClass(name: string): new (message: string) => Error {
const start = saveCacheBundle.indexOf(`var ${name} = class`);
expect(start).toBeGreaterThanOrEqual(0);
const end = saveCacheBundle.indexOf("\n};", start);
expect(end).toBeGreaterThan(start);
const declaration = saveCacheBundle.slice(start, end + 3);
return runInNewContext(`${declaration}; ${name}`, {
__name: (target: object, value: string) =>
Object.defineProperty(target, "name", { configurable: true, value }),
}) as new (
message: string,
) => Error;
}
it.each(["ValidationError", "ReserveCacheError", "FinalizeCacheError"])(
"preserves the %s name in the save-cache bundle",
(name) => {
const ErrorClass = bundledErrorClass(name);
expect(new ErrorClass("test").name).toBe(ErrorClass.name);
},
);
+87
View File
@@ -0,0 +1,87 @@
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import {
afterAll,
beforeEach,
describe,
expect,
it,
jest,
} from "@jest/globals";
import { CacheLocalSource, type SetupInputs } from "../../src/utils/inputs";
import { createSetupInputs } from "../helpers/setup-inputs";
const mockSaveCache = jest.fn<() => Promise<number>>();
const mockInfo = jest.fn();
const mockLoadInputs = jest.fn<() => SetupInputs>(() =>
createSetupInputs({ enableCache: false }),
);
const state: Record<string, string> = {};
jest.unstable_mockModule("@actions/cache", () => ({
saveCache: mockSaveCache,
}));
jest.unstable_mockModule("@actions/core", () => ({
getState: jest.fn((name: string) => state[name] ?? ""),
setFailed: jest.fn(),
}));
jest.unstable_mockModule("../../src/utils/inputs", () => ({
loadInputs: mockLoadInputs,
}));
jest.unstable_mockModule("../../src/utils/logging", () => ({
info: mockInfo,
warning: jest.fn(),
}));
jest.spyOn(process, "exit").mockImplementation((() => undefined) as never);
const { run } = await import("../../src/save-cache");
const cacheDir = mkdtempSync(join(tmpdir(), "setup-uv-save-cache-"));
const cacheKey = "setup-uv-2-x86_64-unknown-linux-gnu-ubuntu-24.04-3.12-hash";
function infoMessages(): string[] {
return mockInfo.mock.calls.map(([msg]) => msg as string);
}
beforeEach(() => {
delete process.env.UV_CACHE_DIR;
state["cache-key"] = cacheKey;
state["cache-matched-key"] = "";
mockLoadInputs.mockReturnValue(
createSetupInputs({
cacheLocalPath: { path: cacheDir, source: CacheLocalSource.Input },
}),
);
});
afterAll(() => {
rmSync(cacheDir, { force: true, recursive: true });
});
describe("saveCache", () => {
it("reports the saved key when the cache is saved", async () => {
mockSaveCache.mockResolvedValue(42);
await run();
expect(mockSaveCache).toHaveBeenCalledWith([cacheDir], cacheKey);
expect(infoMessages()).toContain(`uv cache saved with key: ${cacheKey}`);
});
it("does not report the cache as saved when saving fails", async () => {
// @actions/cache logs the failure itself and returns -1
mockSaveCache.mockResolvedValue(-1);
await run();
expect(mockSaveCache).toHaveBeenCalledWith([cacheDir], cacheKey);
expect(infoMessages()).not.toContain(
`uv cache saved with key: ${cacheKey}`,
);
});
});
+50 -1
View File
@@ -146,6 +146,55 @@ describe("download-version", () => {
expect(mockGetAllVersions).not.toHaveBeenCalled();
});
it("resolves ~= with PEP 440 compatible release semantics", async () => {
mockGetFirstMatchingVersion.mockImplementation(
(predicate: (version: string) => boolean) =>
["1.0.0", "0.10.2", "0.9.26"].find(predicate),
);
const version = await resolveVersion("~=0.9", undefined);
expect(version).toBe("0.10.2");
});
it("resolves ~= with PEP 440 compatible release semantics from manifest-file", async () => {
mockGetAllVersions.mockResolvedValue(["1.0.0", "0.10.2", "0.9.26"]);
const version = await resolveVersion(
"~=0.9",
"https://example.com/custom.ndjson",
);
expect(version).toBe("0.10.2");
});
it.each([
["<=0.9", "0.9.0"],
["==0.9", "0.9.0"],
])("resolves %s with PEP 440 semantics", async (specifier, expected) => {
mockGetFirstMatchingVersion.mockImplementation(
(predicate: (version: string) => boolean) =>
["0.10.2", "0.9.26", "0.9.0", "0.8.24"].find(predicate),
);
const version = await resolveVersion(specifier, undefined);
expect(version).toBe(expected);
});
it("resolves >0.9 with PEP 440 semantics for the lowest strategy", async () => {
mockGetAllVersions.mockResolvedValue([
"0.10.0",
"0.9.26",
"0.9.1",
"0.9.0",
]);
const version = await resolveVersion(">0.9", undefined, "lowest");
expect(version).toBe("0.9.1");
});
it("treats == exact pins as explicit versions", async () => {
const version = await resolveVersion("==0.9.26", undefined);
@@ -220,7 +269,7 @@ describe("download-version", () => {
"token",
),
).rejects.toThrow(
"Could not find artifact for version 0.9.26, arch x86_64, platform unknown-linux-gnu in https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson .",
"Could not find artifact for version 0.9.26, arch x86_64, platform unknown-linux-gnu in https://releases.astral.sh/github/versions/main/v1/uv.ndjson .",
);
expect(mockDownloadTool).not.toHaveBeenCalled();
+73 -1
View File
@@ -96,6 +96,78 @@ describe("manifest", () => {
expect(versions).toHaveLength(2);
expect(versions[0]?.version).toBe("0.9.26");
expect(versions[1]?.version).toBe("0.9.25");
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
]);
});
it("falls back to GitHub after mirror network retries are exhausted", async () => {
jest.useFakeTimers();
mockFetch
.mockRejectedValueOnce(new Error("mirror unavailable"))
.mockRejectedValueOnce(new Error("mirror unavailable"))
.mockRejectedValueOnce(new Error("mirror unavailable"))
.mockResolvedValueOnce(
createMockResponse(true, 200, "OK", sampleManifestResponse),
);
const result = fetchManifest();
await jest.runAllTimersAsync();
await expect(result).resolves.toEqual([
expect.objectContaining({ version: "0.9.26" }),
expect.objectContaining({ version: "0.9.25" }),
]);
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
]);
await expect(getLatestVersion()).resolves.toBe("0.9.26");
expect(mockFetch).toHaveBeenCalledTimes(4);
});
it.each([404, 429, 503])(
"falls back to a streaming GitHub manifest on mirror HTTP %s",
async (status) => {
mockFetch
.mockResolvedValueOnce(createMockResponse(false, status, "Error", ""))
.mockResolvedValueOnce(
createStreamingMockResponse([`${sampleManifestResponse}\n`]),
);
await expect(getLatestVersion()).resolves.toBe("0.9.26");
await expect(
getArtifact("0.9.26", "aarch64", "apple-darwin"),
).resolves.toEqual({
archiveFormat: "tar.gz",
checksum:
"fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f",
downloadUrl:
"https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-apple-darwin.tar.gz",
});
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
]);
},
);
it("does not fall back from a custom manifest", async () => {
mockFetch.mockResolvedValue(
createMockResponse(false, 503, "Service Unavailable", ""),
);
await expect(
fetchManifest("https://example.com/custom.ndjson"),
).rejects.toThrow(
"Failed to fetch manifest data: 503 Service Unavailable",
);
expect(mockFetch.mock.calls.map(([url]) => url)).toEqual([
"https://example.com/custom.ndjson",
]);
});
it("retries network failures", async () => {
@@ -123,7 +195,7 @@ describe("manifest", () => {
await jest.runAllTimersAsync();
await result;
expect(mockFetch).toHaveBeenCalledTimes(MANIFEST_FETCH_ATTEMPTS);
expect(mockFetch).toHaveBeenCalledTimes(MANIFEST_FETCH_ATTEMPTS * 2);
});
it("throws on a failed fetch", async () => {
@@ -35,3 +35,14 @@ test("strips PEP 508 markers from requirements dependencies", () => {
expect(parsedVersion).toBe("==0.11.20");
});
test.each([
["uv >= 0.5.0", ">=0.5.0"],
["uv == 0.11.20", "==0.11.20"],
["uv>=0.5.0, <0.6.0", ">=0.5.0,<0.6.0"],
["uv >= 0.5.0 , < 0.6.0", ">=0.5.0,<0.6.0"],
["uv==0.11.20 --hash=sha256:abc", "==0.11.20"],
["uv==0.11.20 # pinned for CI", "==0.11.20"],
])("allows whitespace in the uv specifier %s", (dependency, expected) => {
expect(getUvVersionFromRequirementsText(dependency)).toBe(expected);
});
+1 -1
View File
@@ -113,7 +113,7 @@ outputs:
python-runtime-id:
description: "An opaque identifier reported by uv for the activated venv's Python runtime. Empty when activate-environment is false."
python-cache-hit:
description: "A boolean value to indicate the Python cache entry was found"
description: "A boolean indicating whether the Python cache was restored successfully."
runs:
using: "node24"
main: "dist/setup/index.cjs"
+1 -1
View File
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.5.9/schema.json",
"$schema": "https://biomejs.dev/schemas/2.5.14/schema.json",
"assist": {
"actions": {
"source": {
Generated Vendored
+2536 -722
View File
File diff suppressed because it is too large. Load diff
Generated Vendored
+1713 -726
View File
File diff suppressed because it is too large. Load diff
+1622 -692
View File
File diff suppressed because it is too large. Load diff
+9 -9
View File
@@ -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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "latest"
```
@@ -19,7 +19,7 @@ When `manifest-file` is set, `latest-known` still selects a version from setup-u
```yaml
- name: Install the latest version of uv known to setup-uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "latest-known"
```
@@ -28,7 +28,7 @@ When `manifest-file` is set, `latest-known` still selects a version from setup-u
```yaml
- name: Install a specific version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "0.4.4"
```
@@ -41,21 +41,21 @@ to install the latest version that satisfies the range.
```yaml
- name: Install a semver range of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: ">=0.4.0"
```
```yaml
- name: Pinning a minor version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "0.4.x"
```
```yaml
- name: Install a pep440-specifier-satisfying version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: ">=0.4.25,<0.5"
```
@@ -67,7 +67,7 @@ You can change this behavior using the `resolution-strategy` input:
```yaml
- name: Install the lowest compatible version of uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: ">=0.4.0"
resolution-strategy: "lowest"
@@ -92,7 +92,7 @@ as `UV_PYTHON`. Only a single Python version is supported; multiple fallback ver
```yaml
- name: Install uv based on the version defined in pyproject.toml
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version-file: "pyproject.toml"
```
@@ -103,7 +103,7 @@ silently picking up a newer uv until the lockfile is updated.
```yaml
- name: Install uv based on the version locked in uv.lock
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version-file: "uv.lock"
```
+12 -12
View File
@@ -24,7 +24,7 @@ The computed cache key is available as the `cache-key` output:
```yaml
- name: Setup uv
id: setup-uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- name: Print cache key
@@ -54,7 +54,7 @@ You can optionally define a custom cache key suffix.
```yaml
- name: Enable caching and define a custom cache key suffix
id: setup-uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-suffix: "optional-suffix"
@@ -93,7 +93,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml
- name: Define a cache dependency glob
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
@@ -101,7 +101,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml
- name: Define a list of cache dependency globs
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-dependency-glob: |
@@ -111,7 +111,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml
- name: Define an absolute cache dependency glob
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
@@ -119,7 +119,7 @@ changes. If you use relative paths, they are relative to the working directory.
```yaml
- name: Never invalidate the cache
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-dependency-glob: ""
@@ -132,7 +132,7 @@ By default, the cache will be restored.
```yaml
- name: Don't restore an existing cache
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
restore-cache: false
@@ -148,7 +148,7 @@ these events. Set `save-cache: true` to save the cache for all events.
```yaml
- name: Don't save the cache after the run
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
save-cache: false
@@ -174,7 +174,7 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
```yaml
- name: Define a custom uv cache path
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
cache-local-path: "/path/to/cache"
```
@@ -191,7 +191,7 @@ If you want to prune the cache before saving it, enable cache pruning with the `
```yaml
- name: Prune the cache before saving it
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
prune-cache: true
@@ -210,7 +210,7 @@ To force managed Python installs, set `UV_PYTHON_PREFERENCE=only-managed`.
```yaml
- name: Cache Python installs
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-python: true
@@ -228,7 +228,7 @@ If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
```yaml
- name: Ignore nothing to cache
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
ignore-nothing-to-cache: true
+7 -5
View File
@@ -11,7 +11,7 @@ You can specify a checksum to override those values. The sha256 hashes can also
```yaml
- name: Install a specific version and validate the checksum
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "0.3.1"
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
@@ -20,10 +20,12 @@ You can specify a checksum to override those values. The sha256 hashes can also
## Manifest file
By default, setup-uv reads version metadata from
[`astral-sh/versions`](https://github.com/astral-sh/versions).
the [Astral mirror](https://releases.astral.sh/github/versions/main/v1/uv.ndjson).
If the mirror request fails, it falls back to [`astral-sh/versions`](https://github.com/astral-sh/versions).
The `manifest-file` input lets you override that source with your own URL, for example to test
custom uv builds or alternate download locations.
custom uv builds or alternate download locations. Custom manifest URLs do not fall back to the
default sources.
### Format
@@ -40,7 +42,7 @@ The `archive_format` field is currently ignored.
```yaml
- name: Use a custom manifest file
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
manifest-file: "https://example.com/my-custom-manifest.ndjson"
```
@@ -59,7 +61,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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
add-problem-matchers: false
```
+14 -13
View File
@@ -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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
activate-environment: true
- run: uv pip install pip
@@ -32,7 +32,7 @@ key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
```yaml
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
activate-environment: true
venv-path: ${{ runner.temp }}/custom-venv
@@ -50,12 +50,13 @@ You can customize the venv location with `venv-path`, for example to place it in
## GitHub authentication token
By default, this action resolves available uv versions from
[`astral-sh/versions`](https://github.com/astral-sh/versions), then downloads uv artifacts from
GitHub Releases.
By default, this action fetches version metadata and uv archives from the Astral mirror.
If a manifest request fails, it falls back to `raw.githubusercontent.com`. If an archive download
fails, it falls back to GitHub Releases.
You can provide a token via `github-token` to authenticate those downloads. By default, the
`GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions.
You can provide a token via `github-token` to authenticate GitHub Releases downloads. The token
is not sent to the Astral mirror or used for manifest requests. By default, the `GITHUB_TOKEN`
secret is used, which is automatically provided by GitHub Actions.
If the default
[permissions for the GitHub token](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
@@ -63,7 +64,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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
```
@@ -81,7 +82,7 @@ input:
```yaml
- name: Install the latest version of uv with a custom tool dir
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
tool-dir: "/path/to/tool/dir"
```
@@ -100,7 +101,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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
tool-bin-dir: "/path/to/tool-bin/dir"
```
@@ -117,7 +118,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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
cache-local-path: "~/path/to/cache"
tool-dir: "~/path/to/tool/dir"
@@ -134,7 +135,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@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
ignore-empty-workdir: true
```
@@ -160,7 +161,7 @@ This action sets several environment variables that influence uv's behavior and
```yaml
- name: Example using environment variables
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
tool-dir: "/custom/tool/dir"
+2055 -1954
View File
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -46,17 +46,17 @@
"@actions/tool-cache": "^4.0.0",
"@renovatebot/pep440": "^5.0.0",
"smol-toml": "^1.8.0",
"undici": "^8.10.0"
"undici": "^8.11.0"
},
"devDependencies": {
"@biomejs/biome": "^2.5.9",
"@biomejs/biome": "^2.5.14",
"@types/js-yaml": "^4.0.9",
"@types/node": "^26.2.0",
"@types/node": "^26.6.2",
"@types/semver": "^7.8.0",
"@vercel/ncc": "^0.45.0",
"esbuild": "^0.28.2",
"jest": "^30.4.2",
"js-yaml": "^5.3.0",
"jest": "^30.5.2",
"js-yaml": "^5.4.1",
"ts-jest": "^29.4.11",
"typescript": "^6.0.3"
}
+2
View File
@@ -9,6 +9,8 @@ const builds = [
},
{
entryPoints: ["src/save-cache.ts"],
// @actions/cache compares error.name to the error constructor's name.
keepNames: true,
outfile: "dist/save-cache/index.cjs",
staleOutfiles: ["dist/save-cache/index.mjs"],
},
+60
View File
@@ -0,0 +1,60 @@
import { readdir, readlink, realpath, symlink, unlink } from "node:fs/promises";
import nodePath from "node:path";
export async function repairPythonJunctions(pythonDir: string): Promise<void> {
const entries = await readdir(pythonDir, { withFileTypes: true });
const directories = new Set(
entries
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name.toLowerCase()),
);
for (const entry of entries) {
const name = entry.name.toLowerCase();
if (!entry.isSymbolicLink() || !/^cpython-\d+\.\d+[+-].+$/.test(name)) {
continue;
}
const link = nodePath.join(pythonDir, entry.name);
let target: string;
try {
target = nodePath.resolve(pythonDir, await readlink(link));
} catch (err) {
// Fail only if the link still has the access error that requires repair.
if (await resolvesWithAccessDenied(link)) {
throw err;
}
continue;
}
// uv omits only the patch and prerelease from its minor-version links.
const sibling = nodePath.relative(pythonDir, target).toLowerCase();
const version = /^(cpython-\d+\.\d+)\.\d+(?:(?:a|b|rc)\d+)?([+-].+)$/.exec(
sibling,
);
if (
!version ||
version[1] + version[2] !== name ||
!directories.has(sibling)
) {
continue;
}
// Git for Windows tar can restore a junction as a file symlink when it
// extracts the link before its target. Opening it as a directory fails.
if (!(await resolvesWithAccessDenied(link))) {
continue;
}
// An inaccessible installation can also cause EPERM through a valid link.
await realpath(target);
await unlink(link);
await symlink(target, link, "junction");
}
}
async function resolvesWithAccessDenied(link: string): Promise<boolean> {
try {
await realpath(link);
return false;
} catch (err) {
return (err as NodeJS.ErrnoException).code === "EPERM";
}
}
+21 -22
View File
@@ -4,6 +4,7 @@ import { hashFiles } from "../hash/hash-files";
import type { SetupInputs } from "../utils/inputs";
import * as log from "../utils/logging";
import { getArch, getOSNameVersion, getPlatform } from "../utils/platforms";
import { repairPythonJunctions } from "./repair-python-junctions";
export const STATE_CACHE_KEY = "cache-key";
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
@@ -44,6 +45,9 @@ export async function restoreCache(
inputs.pythonDir,
STATE_PYTHON_CACHE_MATCHED_KEY,
"python-cache-hit",
// TODO: Remove this repair once @actions/cache preserves Windows junctions.
// https://github.com/actions/toolkit/issues/2562
process.platform === "win32" ? repairPythonJunctions : undefined,
);
} else {
core.setOutput("python-cache-hit", false);
@@ -55,21 +59,33 @@ async function restoreCacheFromKey(
cachePath: string,
stateKey: string,
outputKey: string,
afterRestore?: (cachePath: string) => Promise<void>,
): Promise<void> {
log.info(
`Trying to restore cache from GitHub Actions cache with key: ${cacheKey}`,
);
let matchedKey: string | undefined;
try {
matchedKey = await cache.restoreCache([cachePath], cacheKey);
const matchedKey = await cache.restoreCache([cachePath], cacheKey);
if (!matchedKey) {
log.info(`No GitHub Actions cache found for key: ${cacheKey}`);
core.setOutput(outputKey, false);
return;
}
// Record the match before the post-restore hook so the post step can skip
// archiving the directory again even if the hook fails. A PR that restored
// from its base branch could otherwise save the broken copy in its own cache.
core.saveState(stateKey, matchedKey);
await afterRestore?.(cachePath);
log.info(
`cache restored from GitHub Actions cache with key: ${matchedKey}`,
);
core.setOutput(outputKey, true);
} catch (err) {
const message = (err as Error).message;
log.warning(message);
core.setOutput(outputKey, false);
return;
}
handleMatchResult(matchedKey, cacheKey, stateKey, outputKey);
}
async function computeKeys(
@@ -107,20 +123,3 @@ async function computeKeys(
const python = inputs.cachePython ? "-py" : "";
return `setup-uv-${CACHE_VERSION}-${getArch()}-${platform}-${osNameVersion}-${version}${pythonArchKey}${pruned}${python}${cacheDependencyPathHash}${suffix}`;
}
function handleMatchResult(
matchedKey: string | undefined,
primaryKey: string,
stateKey: string,
outputKey: string,
): void {
if (!matchedKey) {
log.info(`No GitHub Actions cache found for key: ${primaryKey}`);
core.setOutput(outputKey, false);
return;
}
core.saveState(stateKey, matchedKey);
log.info(`cache restored from GitHub Actions cache with key: ${matchedKey}`);
core.setOutput(outputKey, true);
}
+144
View File
@@ -1,4 +1,148 @@
{
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
"aarch64-unknown-linux-musl-0.13.8": "0c6f8593fcf1eadfc60e663b685c408267559d7c5d61c689bbb9f3a7e369ba32",
"arm-unknown-linux-musleabihf-0.13.8": "1ddb914171ea853439e5f3f7d2c82f2cccd423d350707e1b6b397d10b53e7ad4",
"armv7-unknown-linux-gnueabihf-0.13.8": "079618cfa7110f0bf812355cc030d3f309b2ebc085c3c8bcb7c291edf874d57d",
"armv7-unknown-linux-musleabihf-0.13.8": "8378d009ea93bea8131d3bf6316c76bef1bf3c167e1efa0bcf9b32f8c6be92ac",
"i686-pc-windows-msvc-0.13.8": "4fbc1489e659e46acc9f39215c2f849a8f6cca76cea2a34ab88bb203d6be4548",
"i686-unknown-linux-gnu-0.13.8": "a02ef14274bdd62f5f8563df42fbaddee622af3673b6779aeb8a838930945130",
"i686-unknown-linux-musl-0.13.8": "58d36909387012b6dd977ad31290345ad26c54b470c4534509795d2eeaf2234b",
"powerpc64le-unknown-linux-gnu-0.13.8": "4b7857be36535a31dc1e670b79d663bc278f1177e53d3e499e1ed300b72cbd14",
"riscv64gc-unknown-linux-gnu-0.13.8": "ac218efd4ecbc5f08878146003ee5f2c96a837e43e89a973dd5b681d2430e53c",
"riscv64gc-unknown-linux-musl-0.13.8": "4bcdf839b7bf234cca080797c2d86c5c77b34e3c2e065666d08ba8c201c03fa0",
"s390x-unknown-linux-gnu-0.13.8": "0b4bb8c6003acb8aca89696d9a10edd310b7336d3f30aa77a59ecfd0b39385af",
"x86_64-apple-darwin-0.13.8": "a04c2ffeac28b2003a2c13caf538ab425fcd7def3e4a41571f4a8fb370a66af3",
"x86_64-pc-windows-msvc-0.13.8": "529e78a9cec6cd7e3e014f7ecd8bda0c113969d4ed0f2efeedb85c30943325b8",
"x86_64-unknown-linux-gnu-0.13.8": "5acfd9177cfecf0bf87578f059728215ccc884388988f55f7a65041b57387d91",
"x86_64-unknown-linux-musl-0.13.8": "61fb26dabc4f0cf1d050fc6c67d40e43e4fae2994af21ebc1e050b233bf2b5ed",
"aarch64-apple-darwin-0.13.7": "81b811b57e4624df7ed3aac148e0359100d9962f3d9dce00aec533dc2e086731",
"aarch64-pc-windows-msvc-0.13.7": "505d9e65e7692bac3ddf98c66754aa26c5050c409c184af30a881a0a72cc85e3",
"aarch64-unknown-linux-gnu-0.13.7": "71279f8d3c67241e807b9d8db872d1bf541579fb9f08b7d1eb1682196d1e57dc",
"aarch64-unknown-linux-musl-0.13.7": "2d3ec076a0c4c0e8250bb6418c44080828b544f1a3be0b6e46adf9fb6923de45",
"arm-unknown-linux-musleabihf-0.13.7": "2c029d1eda470c667e46a36fc5e2479c9a3e4af91e0cabcde07711bf40d587a9",
"armv7-unknown-linux-gnueabihf-0.13.7": "5e2a1315a1b8b4a25250d536f62fa5c1ab5ed17233e7bf486c3c7849cb663284",
"armv7-unknown-linux-musleabihf-0.13.7": "4a1a7dc0b1713bbeac665a2f95e680eea3bb7ecebea226ae3b2de552bc72e88b",
"i686-pc-windows-msvc-0.13.7": "fa2abbf16f7d12cb01c9b7f313d843218fbd91a9d3fab487cc06a1d6765b27bf",
"i686-unknown-linux-gnu-0.13.7": "cc4f86390f9c99e8f53530e5e7f2cdc6ae7c011c9e805764332a3e3c01a378e4",
"i686-unknown-linux-musl-0.13.7": "c2d50f5c64eb81fd1fd1ec5870403c0533fe4b6bf76f940cc5e97824e49ab782",
"powerpc64le-unknown-linux-gnu-0.13.7": "e8b65412482f848743e73566808f5bb480e826c9ce25361997891fcf71299080",
"riscv64gc-unknown-linux-gnu-0.13.7": "48aff38af87c7c8255beb9b51b3676598045786ac5197de15fea54ebfe6c72e1",
"riscv64gc-unknown-linux-musl-0.13.7": "6c2e67417dda9661e67c2591a6226805ef2ed8ebc203baeed411f67d459207b2",
"s390x-unknown-linux-gnu-0.13.7": "2b64a479b905b9cdab99c71105e523a0d7aa79581cbd716d40bce26d7b595428",
"x86_64-apple-darwin-0.13.7": "20c47e4c1f630b8abaff8c291fa9b9aa300fef92c4fbff95adf198b55287cda7",
"x86_64-pc-windows-msvc-0.13.7": "0cdc5b38fe5a8168ed6a25814f5ba43c21d313dd3187314fccb37b7cec46e021",
"x86_64-unknown-linux-gnu-0.13.7": "c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83",
"x86_64-unknown-linux-musl-0.13.7": "287491da03f2a785c70fa75b13e1f849918c2f2b5415fe84876b8214eeb792f9",
"aarch64-apple-darwin-0.13.6": "60fbd5c8a1ed681845eea28d9d622fcde03c51e91a43465b64a1e17db1ed3472",
"aarch64-pc-windows-msvc-0.13.6": "c2426c0c8e28b53d8c440e47a18d96ad4db51e159866c0e81435b196d7f0081c",
"aarch64-unknown-linux-gnu-0.13.6": "229e194255c7958d86d56e8790d969a6f74736592133f0dfd0076f754c642c1d",
"aarch64-unknown-linux-musl-0.13.6": "819692e404d23e5aae6bc44c0e260f1f5492fd1910ab4693b2c650f926dbe800",
"arm-unknown-linux-musleabihf-0.13.6": "57ac0f7c04deb42c5d686b4eeeef555c442db6ffea16fe4cbd7adb0384403794",
"armv7-unknown-linux-gnueabihf-0.13.6": "d00cd4949c4524c934afcfee1aedfa9d337cf4e43be4d6b692ad8d74d0a65562",
"armv7-unknown-linux-musleabihf-0.13.6": "b215398c886e8cc2cfa282fe346c02025957f8633b75a3d4fd848e0adda4eddd",
"i686-pc-windows-msvc-0.13.6": "32ceb64db231cbedfd499f7654c72e4c0b564f2846f9e76c0a4a7b2d03d7e67c",
"i686-unknown-linux-gnu-0.13.6": "665ea831c38d342900950e606beb2ccc37b7ba0fcefc37b814eb4b076305f2b6",
"i686-unknown-linux-musl-0.13.6": "de3a015c4b0fce63c178ae4fa95c94c873adfd92fa1e258c6a2a94e529812629",
"powerpc64le-unknown-linux-gnu-0.13.6": "3b2847185ec2946fcc928500efef7e3e74c255d3be6f2cb435081a84885d8c6c",
"riscv64gc-unknown-linux-gnu-0.13.6": "517052603ed46483b59d8875c9c61a577946b8f493c73e4339e45e7b119171d0",
"riscv64gc-unknown-linux-musl-0.13.6": "659a95dc6aee3ecf86742a08d8ca6c6261422121cbd41decc0042f5a71af6305",
"s390x-unknown-linux-gnu-0.13.6": "fb56d731308aa5c7718059d71afcb14d9a933a974997cee3d4eb5d06fc462a4b",
"x86_64-apple-darwin-0.13.6": "63ba17fdda55ad1a230d4b37fc6017ffa10c23688c83818bd3bfdf914c652a02",
"x86_64-pc-windows-msvc-0.13.6": "a2a8820d5eea32f08ef467ef3b7f66883a9b076d5737a2fc2fbb5f458d1bb50f",
"x86_64-unknown-linux-gnu-0.13.6": "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645",
"x86_64-unknown-linux-musl-0.13.6": "5d61f26b6c7213779eda90edc6971ea6b0b796bfb8d49a574c8ad69b59838548",
"aarch64-apple-darwin-0.13.5": "743f85035a1996ecb350659e01cd9faea9709829be09b1b4b03c73eaf3c9cd73",
"aarch64-pc-windows-msvc-0.13.5": "09f47edf90726084a70f9426f6e3ca4f46e9bf7cbf23b1716ec64d60b055fae3",
"aarch64-unknown-linux-gnu-0.13.5": "4bb69cf95ed13f23713bb7bc09f241896ea0c75b7c557e615a20604b82f9c403",
"aarch64-unknown-linux-musl-0.13.5": "7906c79adb21c81abd559841ba76bb1d9af9d791acac7a041b2972e03ae16538",
"arm-unknown-linux-musleabihf-0.13.5": "0ffc73aead06a19ed9b63fb7f81f6376d12146829d509dda1585a8bfa3256f5e",
"armv7-unknown-linux-gnueabihf-0.13.5": "fe6b5b1d30b28b9dec45cfd8f60fec38941e18a8f9b1e64530dd197aba68dd07",
"armv7-unknown-linux-musleabihf-0.13.5": "980649d802ee0c41127184f0d8c0461d1f0004e967246df9602bbb9ab983ca7f",
"i686-pc-windows-msvc-0.13.5": "96228420d0a89a64757afba59932c1e58c4977e4122f2cc9f8615a51ba2d3084",
"i686-unknown-linux-gnu-0.13.5": "f5713d6c05d77d01de9655270d713ba87ed45391752f489c80bbf1690bccc17c",
"i686-unknown-linux-musl-0.13.5": "ef427365b5e84790d3f807bd0dfda0d8ee89e78f47e0cfdf86378a5bd9b13894",
"powerpc64le-unknown-linux-gnu-0.13.5": "f891bc62de89832775d5104ad3b3332848122536a8dc8bac5775a18cce42b845",
"riscv64gc-unknown-linux-gnu-0.13.5": "5c2692ecbf3a9d2c5955c403b30e61740b3ea2fdcc9b6eb533eeda268bf2b56d",
"riscv64gc-unknown-linux-musl-0.13.5": "485ffd2d7623fd98f791cb6ab45aa967f1605e3f691666fc49713e3feb2362b9",
"s390x-unknown-linux-gnu-0.13.5": "b383e82d562f269fffbb69f44258ae278b6f4b45fbe7e572574669021b547e94",
"x86_64-apple-darwin-0.13.5": "b0f52b0e3945b4107d89024ea38e625683011fbfc05a0d98f9fa2d6dcee28c66",
"x86_64-pc-windows-msvc-0.13.5": "a38b8d1902b7cfbc76b423ba1bb456f623f42064cdc72628b6075b89afd1019a",
"x86_64-unknown-linux-gnu-0.13.5": "f68d291c75783122dad58ab77def0e13f3233f358731db5d6d7e8715603b928f",
"x86_64-unknown-linux-musl-0.13.5": "57ef9d9ccb01fb1bd998df995b0dd221b52f7d7841fbea93f2d4463bf61fb7a9",
"aarch64-apple-darwin-0.13.4": "e0b1d4743ce64c55d9f0f4a444afa6b81125680070ee04e853fcd0f6c1ebf8f1",
"aarch64-pc-windows-msvc-0.13.4": "c4bc5a9534b2bb6a12fe29ea748445e1a6f9cb7bb275211c4fb74c52ecf317a5",
"aarch64-unknown-linux-gnu-0.13.4": "1ae72b4718729e2ccc4f1ae2c6d1e531ca8467800e0546e9130b3886023a60ab",
"aarch64-unknown-linux-musl-0.13.4": "253a17cadcb659ae77a0fe3b9a2f1c14297528d480c421899e61e64d64f24e8f",
"arm-unknown-linux-musleabihf-0.13.4": "86df14c4dc6d98822b84c9fdf1ad626e2d4a81be60c49bd56a8840b9b70d9fdc",
"armv7-unknown-linux-gnueabihf-0.13.4": "9e52201e4502e349f27020879283736ca184185363ec8328554fd26596e61eb8",
"armv7-unknown-linux-musleabihf-0.13.4": "d69261a33fbfabf3ff811ccd1f964920919a4f45bbcbd867913369cbfb32d0e3",
"i686-pc-windows-msvc-0.13.4": "b450f623b34bf85322bbc656d5879915acd818dc5b05fc2d33e343da26799e37",
"i686-unknown-linux-gnu-0.13.4": "8c72700f224979886ab41003a46cbac5a8ba070ff5857717026a3b4b144c5686",
"i686-unknown-linux-musl-0.13.4": "985ef009e3bb182ce701c7911cd8d6296ccf2690b6dfd434972fbf64ff3f9057",
"powerpc64le-unknown-linux-gnu-0.13.4": "ae7320fcf963ed6ca19bacf436cf5d71cd5c9fbaf66450d614e7673c1f876be4",
"riscv64gc-unknown-linux-gnu-0.13.4": "0173f624fd99811a12c1e1d1b0c476d9e850b3408ab01b8d513028376fb1c9c0",
"riscv64gc-unknown-linux-musl-0.13.4": "250aa02f66cf080651f13c9696dece1023f1e38a825f9c9a8f21627ccb3a3ef2",
"s390x-unknown-linux-gnu-0.13.4": "e2ccfa8c19d340cd282c91f715dd37b7f0c5efa9b256c0a6c373fec3e01ec20d",
"x86_64-apple-darwin-0.13.4": "7be2dcd316122f4b3e5a0a7889f6248266c14425374e105ff7dc9779184603a6",
"x86_64-pc-windows-msvc-0.13.4": "ccec7508a07d9933d7cb1261880633efcf1f30d6e6eddab21823f1dae6f23225",
"x86_64-unknown-linux-gnu-0.13.4": "2b428396f12572d4429cf210ca234dd599a33b3af0958a4d5ed569d63e3f344f",
"x86_64-unknown-linux-musl-0.13.4": "28d4385f9f9d1d1c7654d85b3855e0e2615b2f6cc13136a2edff858bbdc16ff1",
"aarch64-apple-darwin-0.13.3": "bf1e4fb6f5f5079a2902ad3f3a9e2d337575b226a1378f2449d8404353650608",
"aarch64-pc-windows-msvc-0.13.3": "aeaca1a1b721c1686c09b4aa23d57f938df049bed1b8e534b5bf79a032b8b87b",
"aarch64-unknown-linux-gnu-0.13.3": "611ff684f193a84d2fdad29c5f12505d02ece94984c7c982cdde950eba5c95b9",
"aarch64-unknown-linux-musl-0.13.3": "4a58785768ab0577497ca7940be2f9fd5a34e48c3fd37923692fc0a81d71ac9f",
"arm-unknown-linux-musleabihf-0.13.3": "ad9f4041e97b723da4238295b531850e31fd007f807b60040dc82d982268220c",
"armv7-unknown-linux-gnueabihf-0.13.3": "51a2ba864b76824fc208a91c1e2da02caf475036e083268a2974af69024aa867",
"armv7-unknown-linux-musleabihf-0.13.3": "3cd65b49fe3e163d538b306b1eebdbbf80bd95bb498f863db917a2554f4fe5ec",
"i686-pc-windows-msvc-0.13.3": "887d05656858bb9402a9d094c371012e7a1227cde4ddb84898b3a940673d17dd",
"i686-unknown-linux-gnu-0.13.3": "91565a548a4b8b9ad78b5b6db534ca217cd9851b214419ca6d0af3e5d85a6e09",
"i686-unknown-linux-musl-0.13.3": "3df2a0dc3f309156740c0088022f26ea0aa121ce6bc27d6afeedce25026e35e8",
"powerpc64le-unknown-linux-gnu-0.13.3": "fed4c6e245cce9eaaa050daec4f19a469bb8e329e45d0832a03581df5aa41e38",
"riscv64gc-unknown-linux-gnu-0.13.3": "ef5cdc493ede8705aa350d15d9b96e73d3f8c2e583e344a94d25910414e7a8c4",
"riscv64gc-unknown-linux-musl-0.13.3": "77961b8ba0fbb10fa5f95c09fb36c31c76468a427a17fa175dc7ec6d7b7312b1",
"s390x-unknown-linux-gnu-0.13.3": "ef70e576e895cd5c997125bbdcdbb2913df07f135cda5becf5e22fbd2fcd7661",
"x86_64-apple-darwin-0.13.3": "5c35634957db7ebd9c2e4cc6c66b8979fb2c26a6b0dbd1d214d6acbac4033a89",
"x86_64-pc-windows-msvc-0.13.3": "bb701bd35b586c45966654ea2703c9bd116a6a4fc0a8ca755bd644c2c41c5ebe",
"x86_64-unknown-linux-gnu-0.13.3": "e4f169ec380f1793b898a6f1fcbacd22db25cf7ca0349a6e96ffb85b69998d04",
"x86_64-unknown-linux-musl-0.13.3": "a36fca4c151d1ac13707984a88a4e2742edec0f2bc1b3e1c18c1c751e4679fd3",
"aarch64-apple-darwin-0.13.2": "4a5d878cd0db3a57d79eec638c275e71c394e10533ae54c77b33d940866f53b7",
"aarch64-pc-windows-msvc-0.13.2": "305d3a87a3c83ced9a9347e0b2e9d1719013db1ed8d7b34ba42ee1558f968686",
"aarch64-unknown-linux-gnu-0.13.2": "3143e25fccac6f81b3b400792caa2ec431a5e8824d855cde9550a25f0fac8ea0",
"aarch64-unknown-linux-musl-0.13.2": "b7444ae484d951d856b1ea0bae8224bf0ea856e9cefe8bd67c6d3f5d98375c78",
"arm-unknown-linux-musleabihf-0.13.2": "e3c5eadb268ca0422229ff2fba05af5d6440a86dbd5e3ac83db508c8599ada11",
"armv7-unknown-linux-gnueabihf-0.13.2": "239ad77579931c9599ac7468bd02ac8de710ff349a99e76d52e32fb4206cd2f5",
"armv7-unknown-linux-musleabihf-0.13.2": "c453906c4c80754e30e5305c05d92aff1b5023a5b96c57e9ddbb17fcf82f34e9",
"i686-pc-windows-msvc-0.13.2": "3790797c9597310c412fadb10f5cfbc529dcc6e7ec7d1240e108cf56e3ab88c5",
"i686-unknown-linux-gnu-0.13.2": "f8fcad706f05c435e6de5a0e38eb96604041629ef279c6309501636d0b88a237",
"i686-unknown-linux-musl-0.13.2": "050646f5f9b75eb5db2fe215ffa49ea6bf166c678b5541659f3d7b4a6ca9537a",
"powerpc64le-unknown-linux-gnu-0.13.2": "2c1ea5b57b7a6a0251c050aafb5c3c51866f18b380336553a5ec525d9aaed446",
"riscv64gc-unknown-linux-gnu-0.13.2": "a28c0bd7156a06ed5b5fabe8e44ef5e402c592dfb60c5053da22e52bd6fb4cf9",
"riscv64gc-unknown-linux-musl-0.13.2": "da6129b8acee2e9636a78367c761ef685e6ae2818a77cfffe2427ea52cae1ba4",
"s390x-unknown-linux-gnu-0.13.2": "307987b9bbcfac0eefe5d71eb1fec08bce0cdad5b70306cf3fa7a57430e5cad2",
"x86_64-apple-darwin-0.13.2": "08f0cb0d63a012ffa07659d1872030c1110fccdd665d49bc3683b0ca262b4a62",
"x86_64-pc-windows-msvc-0.13.2": "9cfb447a4027550f134753253fdffbcd35b79a66dd888260bf6776891916069e",
"x86_64-unknown-linux-gnu-0.13.2": "e14d48c117ec33601d6f860dda47aa5ea490d77a5a9ef770529c448fa6747d9f",
"x86_64-unknown-linux-musl-0.13.2": "aba5d9e0af3662ee85772c5da147c3824cd6728a50bce6c507ae20672df7e83e",
"aarch64-apple-darwin-0.13.1": "cfe454573412ff7380d15fc7dae5997ab53ffce72fce0a78e91ddbc84001acd2",
"aarch64-pc-windows-msvc-0.13.1": "ec7846a5939b4654afee24f2d82bf6fde71bd7a6952d7748f1135ab301dd0a49",
"aarch64-unknown-linux-gnu-0.13.1": "9041c73c99fdc5892cf128140beb354eca9231d502068cc36e6cb53a8e59ad14",
"aarch64-unknown-linux-musl-0.13.1": "345a8308e4d1835cdfaadf692836fd3137a6d45864773f05ad7bf59442b1ba16",
"arm-unknown-linux-musleabihf-0.13.1": "68d35d155ed7555da1fa811e16b1f8711227e5bcf0c5d45bbc7282333ec82970",
"armv7-unknown-linux-gnueabihf-0.13.1": "833bb2b4a47ba2aa4356e577eb52be2deb15d145d79e559dfe8fcc3bf546017b",
"armv7-unknown-linux-musleabihf-0.13.1": "443b8bc3e4ef03b20b38aa1b03bc0604f55dfa74e091b7acc4851bcd5e5d6c58",
"i686-pc-windows-msvc-0.13.1": "fcebe7cd3be7e2b1b4b5802bac36c85eeb724837c48be48d41a226367ef7d4a3",
"i686-unknown-linux-gnu-0.13.1": "99645fd8923859e74a8f481d4f949318dae47beb65adc4b13a73f2582da9f853",
"i686-unknown-linux-musl-0.13.1": "8fd67e5a8d3ef4ec75acda39d16df00821e2b0728f1f0e7f8aef24101ba88ddf",
"powerpc64le-unknown-linux-gnu-0.13.1": "66b890c75291de97617705dcc275a3e4ed99446e73b93c7748c6ca28d6793203",
"riscv64gc-unknown-linux-gnu-0.13.1": "52d9f0677840c20a14ed037a6cba515cc2f20a03001aaa605f928e80f4b55ec2",
"riscv64gc-unknown-linux-musl-0.13.1": "b60c852c5a072640a624438935ffc1eddc4c38842c8422db890d6912e5d586d3",
"s390x-unknown-linux-gnu-0.13.1": "d04236f6631a514824e06ce45f1b4832edfb43648d2e9fed2188c9fc66d8c95f",
"x86_64-apple-darwin-0.13.1": "bb7b805bdcf3d0bc8c74ceb94569e6b3e8aa35bd492acdbb9d46bf46d9d4ff6b",
"x86_64-pc-windows-msvc-0.13.1": "3b2661a463a5baea7f5076ea2b25ab71d77f36a6c0d809e5350651792f80a672",
"x86_64-unknown-linux-gnu-0.13.1": "eadd9d27c134ab5ac1ffd4473b97a741407f3ea238288f03121fc4deddf90220",
"x86_64-unknown-linux-musl-0.13.1": "6c86040a8f045ab9adc9e3ec4cdafa03fd00e9a988ed2bf28971c7fc2d0debd0",
"aarch64-apple-darwin-0.13.0": "a9c1b29002cf3c83f07fa9cd8a887a3be0107d90e23189721221e7257db8e3d6",
"aarch64-pc-windows-msvc-0.13.0": "cb54028b59aa87f11cf6dec293ce000420043a49a8aea522e822a671321f8932",
"aarch64-unknown-linux-gnu-0.13.0": "3ccfb6af6e242433eb552f7d9676abd5412c6595c497e990d9c8cb7b5bd4d2c3",
+18 -1
View File
@@ -1,7 +1,10 @@
import { createInterface } from "node:readline";
import { Readable } from "node:stream";
import * as core from "@actions/core";
import { VERSIONS_MANIFEST_URL } from "../utils/constants";
import {
GITHUB_VERSIONS_MANIFEST_URL,
VERSIONS_MANIFEST_URL,
} from "../utils/constants";
import { fetch } from "../utils/fetch";
import * as log from "../utils/logging";
import { selectDefaultVariant } from "./variant-selection";
@@ -167,6 +170,20 @@ export function clearManifestCache(manifestUrl?: string): void {
}
async function fetchManifestResponse(manifestUrl: string) {
try {
return await fetchManifestResponseFromUrl(manifestUrl);
} catch (error) {
if (manifestUrl !== VERSIONS_MANIFEST_URL) {
throw error;
}
log.info(
`Failed to fetch manifest from Astral mirror, falling back to GitHub: ${(error as Error).message}`,
);
return await fetchManifestResponseFromUrl(GITHUB_VERSIONS_MANIFEST_URL);
}
}
async function fetchManifestResponseFromUrl(manifestUrl: string) {
let response: Awaited<ReturnType<typeof fetch>> | undefined;
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
log.info(`Fetching manifest data from ${manifestUrl} ...`);
+4 -2
View File
@@ -159,8 +159,10 @@ async function saveCacheToKey(
}
log.info(`Including ${cacheName} path: ${cachePath}`);
await cache.saveCache([cachePath], cacheKey);
log.info(`${cacheName} saved with key: ${cacheKey}`);
const cacheId = await cache.saveCache([cachePath], cacheKey);
if (cacheId !== -1) {
log.info(`${cacheName} saved with key: ${cacheKey}`);
}
}
run();
+2
View File
@@ -2,6 +2,8 @@ export const TOOL_CACHE_NAME = "uv";
export const STATE_UV_PATH = "uv-path";
export const STATE_UV_VERSION = "uv-version";
export const VERSIONS_MANIFEST_URL =
"https://releases.astral.sh/github/versions/main/v1/uv.ndjson";
export const GITHUB_VERSIONS_MANIFEST_URL =
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson";
/** GitHub Releases URL prefix for uv artifacts. */
+3 -1
View File
@@ -69,5 +69,7 @@ function getUvVersionFromAllDependencies(
function getUvVersionFromDependency(dependency: string): string | undefined {
const dependencyWithoutMarker = dependency.split(";", 1)[0]?.trim();
return dependencyWithoutMarker?.match(/^uv([=<>~!]+\S*)/)?.[1].trim();
return dependencyWithoutMarker
?.match(/^uv\s*((?:[=<>~!]+\s*[^\s,]+\s*,?\s*)+)/)?.[1]
.replace(/\s/g, "");
}
+19 -3
View File
@@ -169,7 +169,9 @@ async function findHighestSatisfyingVersion(
): Promise<string | undefined> {
// This fast path assumes uv releases are semver-monotonic: newer manifest
// entries always have higher versions, with no lower-version backports.
const semverRange = semver.validRange(versionSpecifier);
const semverRange = isPep440Specifier(versionSpecifier)
? null
: semver.validRange(versionSpecifier);
if (semverRange !== null) {
const semverMatch = await getFirstMatchingVersion((version) =>
semver.satisfies(version, semverRange),
@@ -193,11 +195,23 @@ async function findHighestSatisfyingVersion(
return pep440Match;
}
/**
* Specifiers that are valid PEP 440 must be evaluated as PEP 440. semver
* accepts several of them with different semantics, e.g. `~=0.5` as `<0.6.0`
* instead of `<1.0`, `<=0.5` as `<0.6.0` instead of `<=0.5.0` and `>0.5` as
* `>=0.6.0` instead of `>0.5.0`.
*/
function isPep440Specifier(versionSpecifier: string): boolean {
return pep440.validRange(versionSpecifier);
}
function maxSatisfying(
versions: string[],
version: string,
): string | undefined {
const maxSemver = tc.evaluateVersions(versions, version);
const maxSemver = isPep440Specifier(version)
? ""
: tc.evaluateVersions(versions, version);
if (maxSemver !== "") {
core.debug(`Found a version that satisfies the semver range: ${maxSemver}`);
return maxSemver;
@@ -218,7 +232,9 @@ function minSatisfying(
versions: string[],
version: string,
): string | undefined {
const minSemver = semver.minSatisfying(versions, version);
const minSemver = isPep440Specifier(version)
? null
: semver.minSatisfying(versions, version);
if (minSemver !== null) {
core.debug(`Found a version that satisfies the semver range: ${minSemver}`);
return minSemver;
+6 -1
View File
@@ -21,8 +21,13 @@ export type ParsedVersionSpecifier =
export function normalizeVersionSpecifier(specifier: string): string {
const trimmedSpecifier = specifier.trim();
// Only strip `==` from full versions. A partial pin like `==0.5` means
// `==0.5.0` in PEP 440, but `0.5` alone is read as the semver range `0.5.x`.
if (trimmedSpecifier.startsWith("==")) {
return trimmedSpecifier.slice(2);
const pinnedVersion = trimmedSpecifier.slice(2).trim();
if (tc.isExplicitVersion(pinnedVersion)) {
return pinnedVersion;
}
}
return trimmedSpecifier;