Skip to content

Commit cab5fa8

Browse files
authored
ci: cache poetry venv keyed on lockfile and cython sources (#1704)
1 parent 8cae923 commit cab5fa8

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ concurrency:
1111
group: ${{ github.head_ref || github.run_id }}
1212
cancel-in-progress: true
1313

14+
env:
15+
POETRY_VIRTUALENVS_IN_PROJECT: "true"
16+
1417
jobs:
1518
lint:
1619
runs-on: ubuntu-latest
@@ -89,13 +92,21 @@ jobs:
8992
python-version: ${{ matrix.python-version }}
9093
cache: "poetry"
9194
allow-prereleases: true
95+
- name: Cache poetry venv
96+
id: cache-venv
97+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
98+
with:
99+
path: |
100+
.venv
101+
src/zeroconf/**/*.so
102+
key: venv-v1-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.extension }}-${{ hashFiles('poetry.lock', 'pyproject.toml', 'build_ext.py', 'src/zeroconf/**/*.py', 'src/zeroconf/**/*.pxd') }}
92103
- name: Install Dependencies no cython
93-
if: ${{ matrix.extension == 'skip_cython' }}
104+
if: ${{ matrix.extension == 'skip_cython' && steps.cache-venv.outputs.cache-hit != 'true' }}
94105
env:
95106
SKIP_CYTHON: 1
96107
run: poetry install --only=main,dev
97108
- name: Install Dependencies with cython
98-
if: ${{ matrix.extension != 'skip_cython' }}
109+
if: ${{ matrix.extension != 'skip_cython' && steps.cache-venv.outputs.cache-hit != 'true' }}
99110
env:
100111
REQUIRE_CYTHON: 1
101112
run: poetry install --only=main,dev
@@ -120,7 +131,16 @@ jobs:
120131
enable-cache: true
121132
- name: Install poetry
122133
run: uv tool install poetry
134+
- name: Cache poetry venv
135+
id: cache-venv
136+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
137+
with:
138+
path: |
139+
.venv
140+
src/zeroconf/**/*.so
141+
key: venv-v1-${{ runner.os }}-benchmark-py3.13-${{ hashFiles('poetry.lock', 'pyproject.toml', 'build_ext.py', 'src/zeroconf/**/*.py', 'src/zeroconf/**/*.pxd') }}
123142
- name: Install Dependencies
143+
if: steps.cache-venv.outputs.cache-hit != 'true'
124144
run: |
125145
REQUIRE_CYTHON=1 poetry install --only=main,dev
126146
shell: bash

0 commit comments

Comments
 (0)