Skip to content

Commit b4baf46

Browse files
committed
ci: cache .venv instead of ~/.cache/pdm
- Cache virtual environment (includes installed tools) - Fixes: black/isort/flake8 not found errors - Cache hit: ~2s install, Cache miss: ~15s install
1 parent b77011e commit b4baf46

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# .github/workflows/test.yml
22
#
3-
# CI for pull requests
3+
# CI for pull requests and push to main
44
# Runs test, lint, commit message, and docs checks in parallel
55
#
66

@@ -29,13 +29,13 @@ jobs:
2929
with:
3030
python-version: '3.12'
3131

32-
- name: Cache PDM packages
32+
- name: Cache virtual environment
3333
uses: actions/cache@v4
3434
with:
35-
path: ~/.cache/pdm
36-
key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }}
35+
path: .venv
36+
key: ${{ runner.os }}-venv-${{ hashFiles('pdm.lock') }}
3737
restore-keys: |
38-
${{ runner.os }}-pdm-
38+
${{ runner.os }}-venv-
3939
4040
- run: pdm install --with dev
4141
- run: pdm run pytest -v
@@ -52,13 +52,13 @@ jobs:
5252
with:
5353
python-version: '3.12'
5454

55-
- name: Cache PDM packages
55+
- name: Cache virtual environment
5656
uses: actions/cache@v4
5757
with:
58-
path: ~/.cache/pdm
59-
key: ${{ runner.os }}-pdm-${{ hashFiles('pdm.lock') }}
58+
path: .venv
59+
key: ${{ runner.os }}-venv-${{ hashFiles('pdm.lock') }}
6060
restore-keys: |
61-
${{ runner.os }}-pdm-
61+
${{ runner.os }}-venv-
6262
6363
- run: pdm install --with dev
6464
- run: pdm run black --check src/ tests/

0 commit comments

Comments
 (0)