mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-01-19 00:08:17 +08:00
Add **/requirements*.txt to default cache-dependency-glob (#185)
Contributes to: https://github.com/astral-sh/setup-uv/issues/181
This commit is contained in:
parent
bdcda7e77f
commit
be4207d29e
35
.github/workflows/test-cache.yml
vendored
35
.github/workflows/test-cache.yml
vendored
@ -41,6 +41,41 @@ jobs:
|
||||
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||
- run: uv sync
|
||||
working-directory: __tests__/fixtures/uv-project
|
||||
test-setup-cache-requirements-txt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup with cache
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-requirements-txt
|
||||
- run: |
|
||||
uv venv
|
||||
uv pip install -r requirements.txt
|
||||
working-directory: __tests__/fixtures/requirements-txt-project
|
||||
test-restore-cache-requirements-txt:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test-setup-cache
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Restore with cache
|
||||
id: restore
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-requirements-txt
|
||||
- name: Cache was hit
|
||||
run: |
|
||||
if [ "$CACHE_HIT" != "true" ]; then
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||
- run: |
|
||||
uv venv
|
||||
uv pip install -r requirements.txt
|
||||
working-directory: __tests__/fixtures/requirements-txt-project
|
||||
|
||||
test-setup-cache-dependency-glob:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -154,14 +154,19 @@ changes. If you use relative paths, they are relative to the repository root.
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> The default is `**/uv.lock`.
|
||||
> The default is
|
||||
> ```yaml
|
||||
> cache-dependency-glob: |
|
||||
> **/requirements*.txt
|
||||
> **/uv.lock
|
||||
> ```
|
||||
|
||||
```yaml
|
||||
- name: Define a cache dependency glob
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "**/requirements*.txt"
|
||||
cache-dependency-glob: "**/pyproject.toml"
|
||||
```
|
||||
|
||||
```yaml
|
||||
|
@ -0,0 +1 @@
|
||||
print("Hello world")
|
@ -0,0 +1 @@
|
||||
ruff>=0.6.2
|
@ -25,7 +25,9 @@ inputs:
|
||||
description:
|
||||
"Glob pattern to match files relative to the repository root to control
|
||||
the cache."
|
||||
default: "**/uv.lock"
|
||||
default: |
|
||||
**/uv.lock
|
||||
**/requirements*.txt
|
||||
cache-suffix:
|
||||
description: "Suffix for the cache key"
|
||||
required: false
|
||||
|
Loading…
Reference in New Issue
Block a user