diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49f185a..5cf566e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,8 @@ jobs: with: python-version: "3.14" activate-environment: true + enable-cache: true + cache-dependency-glob: "pyproject.toml" - run: | uv --version python -c "import os, sys; assert sys.version_info[:2] == (3, 14); assert os.environ['VIRTUAL_ENV'].endswith(r'\.venv')" @@ -44,6 +46,8 @@ jobs: with: python-version: ${{ matrix.python-version }} activate-environment: true + enable-cache: true + cache-dependency-glob: "pyproject.toml" - name: Install dependencies run: | diff --git a/actions/__init__.py b/actions/__init__.py index 779099e..204acd7 100644 --- a/actions/__init__.py +++ b/actions/__init__.py @@ -28,4 +28,4 @@ # ├── test_summarize_pr.py # └── ... -__version__ = "0.2.28" +__version__ = "0.2.29" diff --git a/setup-uv/README.md b/setup-uv/README.md index 53950a3..7c15094 100644 --- a/setup-uv/README.md +++ b/setup-uv/README.md @@ -9,11 +9,15 @@ Installs the latest [uv](https://docs.astral.sh/uv/) release with retry support with: python-version: "3.14" activate-environment: true + enable-cache: true + cache-dependency-glob: "pyproject.toml" ``` ## Inputs -| Input | Description | Required | Default | -| ---------------------- | ----------------------------------------- | -------- | ------- | -| `python-version` | Python version for uv commands | No | - | -| `activate-environment` | Create and activate a `.venv` environment | No | `false` | +| Input | Description | Required | Default | +| ----------------------- | ----------------------------------------- | -------- | ------------ | +| `python-version` | Python version for uv commands | No | - | +| `activate-environment` | Create and activate a `.venv` environment | No | `false` | +| `enable-cache` | Cache uv downloads between workflow runs | No | `false` | +| `cache-dependency-glob` | Dependency files used to invalidate cache | No | `**/uv.lock` | diff --git a/setup-uv/action.yml b/setup-uv/action.yml index 0a259c7..044c7ab 100644 --- a/setup-uv/action.yml +++ b/setup-uv/action.yml @@ -11,6 +11,14 @@ inputs: description: "Create and activate a .venv environment" required: false default: "false" + enable-cache: + description: "Cache uv downloads between workflow runs" + required: false + default: "false" + cache-dependency-glob: + description: "Dependency files used to invalidate the uv cache" + required: false + default: "**/uv.lock" runs: using: "composite" @@ -49,3 +57,17 @@ runs: echo "$PWD/.venv/bin" >> "$GITHUB_PATH" fi fi + + - name: Find uv cache + if: inputs.enable-cache == 'true' + id: uv-cache + shell: bash + run: echo "path=$(uv cache dir)" >> "$GITHUB_OUTPUT" + + - name: Cache uv + if: inputs.enable-cache == 'true' + uses: actions/cache@v6 + with: + path: ${{ steps.uv-cache.outputs.path }} + key: uv-${{ runner.os }}-${{ runner.arch }}-${{ inputs.python-version }}-${{ hashFiles(inputs.cache-dependency-glob) }} + restore-keys: uv-${{ runner.os }}-${{ runner.arch }}-${{ inputs.python-version }}-