GeezerVison is showing github.com — Key the linters' venv cache on the exact Python version (#941) · realpython/materials@5093d33
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/linters.yml +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,21 +21,24 @@ jobs: |
21 | 21 | - {name: Linux314, python: '3.14', os: ubuntu-latest} |
22 | 22 | steps: |
23 | 23 | - name: Check out repository |
24 | | - uses: actions/checkout@v2 |
| 24 | + uses: actions/checkout@v4 |
25 | 25 |
|
26 | 26 | - name: Set up Python |
27 | | - uses: actions/setup-python@v2 |
| 27 | + id: setup-python |
| 28 | + uses: actions/setup-python@v5 |
28 | 29 | with: |
29 | 30 | python-version: ${{ matrix.python }} |
30 | 31 |
|
| 32 | + # The cached venv links to the exact interpreter it was built with, |
| 33 | + # so the key includes the resolved patch version (for example, 3.14.10). |
31 | 34 | - name: Restore cache |
32 | 35 | id: cache |
33 | | - uses: actions/cache@v3 |
| 36 | + uses: actions/cache@v4 |
34 | 37 | with: |
35 | 38 | path: ./venv |
36 | | - key: ${{ matrix.name }}-v2-pip-${{ hashFiles('requirements.txt') }} |
| 39 | + key: ${{ matrix.name }}-${{ steps.setup-python.outputs.python-version }}-pip-${{ hashFiles('requirements.txt') }} |
37 | 40 | restore-keys: | |
38 | | - ${{ matrix.name }}-v2-pip- |
| 41 | + ${{ matrix.name }}-${{ steps.setup-python.outputs.python-version }}-pip- |
39 | 42 |
|
40 | 43 | - name: Install dependencies |
41 | 44 | if: steps.cache.outputs.cache-hit != 'true' |
|