You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set the cache-dependency-glob default to **/uv.lock (#77)
We should aim for a solution with sane defaults that work as most users
would expect it.
The current default leads to a cache that is never invalidated and thus
never updated.
This also mirrors the default behaviors for setup-python which use
`**/requirements.txt`, `**/Pipfile.lock` or `**/poetry.lock`
Also make it clear that the uv cache on the filesystem can be uploaded to the GitHub Actions cache, but they are distinct things.
Also make it clear that the local cache path can be changed without using `enable-cache: true`
Copy file name to clipboardExpand all lines: README.md
+34-26Lines changed: 34 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,12 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
11
11
## Contents
12
12
13
13
-[Usage](#usage)
14
-
-[Install specific version](#install-specific-version)
@@ -67,8 +67,13 @@ are automatically verified by this action. The sha265 hashes can be found on the
67
67
### Enable caching
68
68
69
69
If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to
70
-
the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes. The cache
71
-
will always be reused on self-hosted runners.
70
+
the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes.
71
+
72
+
> [!TIP]
73
+
>
74
+
> On self-hosted runners this is usually not needed since the cache generated by uv
75
+
> on the runner's filesystem is not removed after a run.
76
+
> For more details see [Local cache path](#local-cache-path).
72
77
73
78
You can optionally define a custom cache key suffix.
74
79
@@ -90,54 +95,57 @@ use it in subsequent steps. For example, to use the cache in the above case:
90
95
run: echo "Cache was restored"
91
96
```
92
97
93
-
#### Local cache path
94
-
95
-
If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`),
96
-
specify the path with the `cache-local-path` input.
97
-
98
-
```yaml
99
-
- name: Define a custom uv cache path
100
-
uses: astral-sh/setup-uv@v2
101
-
with:
102
-
enable-cache: true
103
-
cache-local-path: "/path/to/cache"
104
-
```
105
-
106
98
#### Cache dependency glob
107
99
108
100
If you want to control when the cache is invalidated, specify a glob pattern with the
109
101
`cache-dependency-glob`input. The cache will be invalidated if any file matching the glob pattern
110
102
changes. The glob matches files relative to the repository root.
111
103
104
+
> [!NOTE]
105
+
> The default is `**/uv.lock`.
106
+
112
107
```yaml
113
108
- name: Define a cache dependency glob
114
109
uses: astral-sh/setup-uv@v2
115
110
with:
116
111
enable-cache: true
117
-
cache-dependency-glob: "uv.lock"
112
+
cache-dependency-glob: "**/requirements*.txt"
118
113
```
119
114
120
115
```yaml
121
-
- name: Define a cache dependency glob
116
+
- name: Define a list of cache dependency globs
122
117
uses: astral-sh/setup-uv@v2
123
118
with:
124
119
enable-cache: true
125
-
cache-dependency-glob: "**requirements*.txt"
120
+
cache-dependency-glob: |
121
+
**/requirements*.txt
122
+
**/pyproject.toml
126
123
```
127
124
128
125
```yaml
129
-
- name: Define a list of cache dependency globs
126
+
- name: Never invalidate the cache
130
127
uses: astral-sh/setup-uv@v2
131
128
with:
132
129
enable-cache: true
133
-
cache-dependency-glob: |
134
-
**requirements*.txt
135
-
**pyproject.toml
130
+
cache-dependency-glob: ""
131
+
```
132
+
133
+
### Local cache path
134
+
135
+
This action controls where uv stores its cache on the runner's filesystem.
136
+
You can change the default (`/tmp/setup-uv-cache`) by
137
+
specifying the path with the `cache-local-path` input.
138
+
139
+
```yaml
140
+
- name: Define a custom uv cache path
141
+
uses: astral-sh/setup-uv@v2
142
+
with:
143
+
cache-local-path: "/path/to/cache"
136
144
```
137
145
138
146
### GitHub authentication token
139
147
140
-
This action uses the GitHub API to fetch the `uv` release artifacts. To avoid hitting the GitHub API
148
+
This action uses the GitHub API to fetch the uv release artifacts. To avoid hitting the GitHub API
141
149
rate limit too quickly, an authentication token can be provided via the `github-token` input. By
142
150
default, the `GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions.
0 commit comments