Skip to content

Commit ed36bce

Browse files
GitHub Workflows: Fix up UV and caching
- Update `setup-uv` to v6 - Fix up caching. - Cache keys for virtualenv and the like are based on lockfile
1 parent 58c89fa commit ed36bce

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@ jobs:
1818
pull-requests: write
1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: "3.11"
2521
- name: Install uv
26-
uses: astral-sh/setup-uv@v1
27-
- name: Restore uv cache
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
version: 0.8.22
25+
python-version: 3.11
26+
enable-cache: true
27+
cache-suffix: pre-commit
28+
cache-dependency-glob: uv.lock
29+
- name: Restore venv cache
2830
uses: actions/cache@v4
2931
with:
3032
path: |
31-
~/.cache/uv
3233
.venv
33-
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
34+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
35+
- uses: actions/cache@v4
36+
with:
37+
path: .mypy_cache
38+
key: mypy_cache|${{ hashFiles('pyproject.toml') }}
3439
- name: Synchronize project dependencies
3540
run: uv sync --group dev
3641
- name: Run pre-commit checks

.github/workflows/test-and-publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,21 @@ jobs:
3333
with:
3434
python-version: ${{ matrix.python-version }}
3535
- name: Install uv
36-
uses: astral-sh/setup-uv@v1
37-
- name: Restore uv cache
36+
uses: astral-sh/setup-uv@v6
37+
with:
38+
version: 0.8.22
39+
python-version: ${{ matrix.python-version }}
40+
enable-cache: true
41+
cache-suffix: pre-commit
42+
cache-dependency-glob: uv.lock
43+
- name: Restore venv cache
3844
uses: actions/cache@v4
3945
with:
4046
path: |
41-
~/.cache/uv
4247
${{ env.UV_PROJECT_ENVIRONMENT }}
43-
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
48+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
4449
- name: Synchronize project dependencies
45-
run: uv sync --group dev --python ${{ matrix.python-version }}
50+
run: uv sync --group dev
4651
- name: Run tests
4752
run: uv run pytest
4853

0 commit comments

Comments
 (0)