mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-07-21 12:29:40 +00:00
Compare commits
1 Commits
dependabot
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47a7f4fb2e |
@@ -100,7 +100,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
cache-local-path: ""
|
||||
|
||||
# Prune cache before saving
|
||||
prune-cache: "true"
|
||||
prune-cache: "false"
|
||||
|
||||
# Upload managed Python installations to the GitHub Actions cache
|
||||
cache-python: "false"
|
||||
|
||||
4
__tests__/cache/restore-cache.test.ts
vendored
4
__tests__/cache/restore-cache.test.ts
vendored
@@ -62,13 +62,13 @@ describe("restoreCache", () => {
|
||||
expect(cacheKey).toContain("-tests-3.10%2C3.11");
|
||||
});
|
||||
|
||||
it("keeps cache keys unchanged for exact Python versions and simple suffixes", async () => {
|
||||
it("uses an unpruned cache key by default", async () => {
|
||||
const inputs = createSetupInputs({ cacheSuffix: "tests-3.11" });
|
||||
|
||||
await restoreCache(inputs, "3.11");
|
||||
|
||||
expect(cacheKeyOutput()).toBe(
|
||||
"setup-uv-2-x86_64-unknown-linux-gnu-ubuntu-24.04-3.11-pruned-dependencyhash-tests-3.11",
|
||||
"setup-uv-2-x86_64-unknown-linux-gnu-ubuntu-24.04-3.11-dependencyhash-tests-3.11",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ export function createSetupInputs(
|
||||
ignoreEmptyWorkdir: false,
|
||||
ignoreNothingToCache: false,
|
||||
noProject: false,
|
||||
pruneCache: true,
|
||||
pruneCache: false,
|
||||
pythonDir: "/tmp/uv-python-dir",
|
||||
pythonVersion: "",
|
||||
quiet: false,
|
||||
|
||||
@@ -61,7 +61,7 @@ inputs:
|
||||
default: ""
|
||||
prune-cache:
|
||||
description: "Prune cache before saving."
|
||||
default: "true"
|
||||
default: "false"
|
||||
cache-python:
|
||||
description: "Upload managed Python installations to the Github Actions cache."
|
||||
default: "false"
|
||||
|
||||
@@ -33,8 +33,8 @@ The computed cache key is available as the `cache-key` output:
|
||||
## Enable caching
|
||||
|
||||
> [!NOTE]
|
||||
> The cache is pruned before it is uploaded to the GitHub Actions cache. This can lead to
|
||||
> a small or empty cache. See [Disable cache pruning](#disable-cache-pruning) for more details.
|
||||
> The entire uv cache is uploaded to the GitHub Actions cache by default. To reduce the cache size,
|
||||
> see [Enable cache pruning](#enable-cache-pruning).
|
||||
|
||||
If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be uploaded to
|
||||
the GitHub Actions cache. This can speed up runs that reuse the cache by several minutes.
|
||||
@@ -173,30 +173,29 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\setup-uv-cache` on
|
||||
cache-local-path: "/path/to/cache"
|
||||
```
|
||||
|
||||
## Disable cache pruning
|
||||
## Enable cache pruning
|
||||
|
||||
By default, the uv cache is pruned after every run, removing pre-built wheels, but retaining any
|
||||
wheels that were built from source. On GitHub-hosted runners, it's typically faster to omit those
|
||||
pre-built wheels from the cache (and instead re-download them from the registry on each run).
|
||||
However, on self-hosted or local runners, preserving the cache may be more efficient. See
|
||||
the [documentation](https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration) for
|
||||
more information.
|
||||
By default, the entire uv cache is persisted across runs. On GitHub-hosted runners, it's typically
|
||||
faster to prune the cache before saving it, removing pre-built wheels, but retaining any wheels that
|
||||
were built from source. The pre-built wheels are then re-downloaded from the registry on each run.
|
||||
See the [documentation](https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration)
|
||||
for more information.
|
||||
|
||||
If you want to persist the entire cache across runs, disable cache pruning with the `prune-cache`
|
||||
input.
|
||||
If you want to prune the cache before saving it, enable cache pruning with the `prune-cache` input.
|
||||
|
||||
```yaml
|
||||
- name: Don't prune the cache before saving it
|
||||
- name: Prune the cache before saving it
|
||||
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
||||
with:
|
||||
enable-cache: true
|
||||
prune-cache: false
|
||||
prune-cache: true
|
||||
```
|
||||
|
||||
## Cache Python installs
|
||||
|
||||
By default, the Python install dir (`uv python dir` / `UV_PYTHON_INSTALL_DIR`) is not cached,
|
||||
for the same reason that the dependency cache is pruned.
|
||||
for the same reason that pruning the dependency cache can improve performance on GitHub-hosted
|
||||
runners.
|
||||
If you want to cache Python installs along with your dependencies, set the `cache-python` input to `true`.
|
||||
|
||||
Note that this only caches Python versions that uv actually installs into `UV_PYTHON_INSTALL_DIR`
|
||||
|
||||
27
package-lock.json
generated
27
package-lock.json
generated
@@ -27,7 +27,7 @@
|
||||
"@vercel/ncc": "^0.44.1",
|
||||
"esbuild": "^0.28.0",
|
||||
"jest": "^30.4.2",
|
||||
"js-yaml": "^5.2.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
"ts-jest": "^29.4.11",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
@@ -4365,25 +4365,16 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.1.tgz",
|
||||
"integrity": "sha512-zfLtNfQqxVqq3uaTqSkh4x4hZw3KHobGUA0fJUj4wawW8bsQLTVqpHdXSIzidh7o+4lEW36tANuAGdaFx6Zgnw==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/puzrin"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/nodeca"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.mjs"
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jsesc": {
|
||||
@@ -8626,9 +8617,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.1.tgz",
|
||||
"integrity": "sha512-zfLtNfQqxVqq3uaTqSkh4x4hZw3KHobGUA0fJUj4wawW8bsQLTVqpHdXSIzidh7o+4lEW36tANuAGdaFx6Zgnw==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^2.0.1"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"@vercel/ncc": "^0.44.1",
|
||||
"esbuild": "^0.28.0",
|
||||
"jest": "^30.4.2",
|
||||
"js-yaml": "^5.2.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
"ts-jest": "^29.4.11",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user