diff --git a/README.md b/README.md index 35611b8..c91f254 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs ## Contents - [Usage](#usage) - - [Install specific version](#install-specific-version) - - [Install latest version](#install-latest-version) + - [Install the latest version (default)](#install-the-latest-version-default) + - [Install a specific version](#install-a-specific-version) - [Validate checksum](#validate-checksum) - [Enable Caching](#enable-caching) - - [Local cache path](#local-cache-path) - [Cache dependency glob](#cache-dependency-glob) + - [Local cache path](#local-cache-path) - [GitHub authentication token](#github-authentication-token) - [How it works](#how-it-works) - [FAQ](#faq) @@ -67,8 +67,13 @@ are automatically verified by this action. The sha265 hashes can be found on the ### Enable caching If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to -the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes. The cache -will always be reused on self-hosted runners. +the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes. + +> [!TIP] +> +> On self-hosted runners this is usually not needed since the cache generated by uv +> on the runner's filesystem is not removed after a run. +> For more details see [Local cache path](#local-cache-path). You can optionally define a custom cache key suffix. @@ -90,39 +95,21 @@ use it in subsequent steps. For example, to use the cache in the above case: run: echo "Cache was restored" ``` -#### Local cache path - -If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`), -specify the path with the `cache-local-path` input. - -```yaml -- name: Define a custom uv cache path - uses: astral-sh/setup-uv@v2 - with: - enable-cache: true - cache-local-path: "/path/to/cache" -``` - #### Cache dependency glob If you want to control when the cache is invalidated, specify a glob pattern with the `cache-dependency-glob` input. The cache will be invalidated if any file matching the glob pattern changes. The glob matches files relative to the repository root. -```yaml -- name: Define a cache dependency glob - uses: astral-sh/setup-uv@v2 - with: - enable-cache: true - cache-dependency-glob: "uv.lock" -``` +> [!NOTE] +> The default is `**/uv.lock`. ```yaml - name: Define a cache dependency glob uses: astral-sh/setup-uv@v2 with: enable-cache: true - cache-dependency-glob: "**requirements*.txt" + cache-dependency-glob: "**/requirements*.txt" ``` ```yaml @@ -131,13 +118,34 @@ changes. The glob matches files relative to the repository root. with: enable-cache: true cache-dependency-glob: | - **requirements*.txt - **pyproject.toml + **/requirements*.txt + **/pyproject.toml +``` + +```yaml +- name: Never invalidate the cache + uses: astral-sh/setup-uv@v2 + with: + enable-cache: true + cache-dependency-glob: "" +``` + +### Local cache path + +This action controls where uv stores its cache on the runner's filesystem. +You can change the default (`/tmp/setup-uv-cache`) by +specifying the path with the `cache-local-path` input. + +```yaml +- name: Define a custom uv cache path + uses: astral-sh/setup-uv@v2 + with: + cache-local-path: "/path/to/cache" ``` ### GitHub authentication token -This action uses the GitHub API to fetch the `uv` release artifacts. To avoid hitting the GitHub API +This action uses the GitHub API to fetch the uv release artifacts. To avoid hitting the GitHub API rate limit too quickly, an authentication token can be provided via the `github-token` input. By default, the `GITHUB_TOKEN` secret is used, which is automatically provided by GitHub Actions. diff --git a/action.yml b/action.yml index 2a383f3..45b7690 100644 --- a/action.yml +++ b/action.yml @@ -20,8 +20,8 @@ inputs: cache-dependency-glob: description: 'Glob pattern to match files relative to the repository root to control - the cache. e.g. "uv.lock"' - required: false + the cache.' + default: "**/uv.lock" cache-suffix: description: "Suffix for the cache key" required: false