Skip to content

Commit 17329c3

Browse files
committed
try cache
1 parent 634456a commit 17329c3

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

.github/workflows/python-release.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
strategy:
9898
matrix:
9999
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]
100+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
100101

101102
steps:
102103
- uses: actions/checkout@v4
@@ -105,21 +106,35 @@ jobs:
105106

106107
- uses: actions/setup-python@v5
107108
with:
108-
python-version: |
109-
3.9
110-
3.10
111-
3.11
112-
3.12
109+
python-version: ${{ matrix.python-version }}
113110

114111
- name: Install poetry
115112
run: pip install poetry
116113

114+
- name: Cache Poetry
115+
uses: actions/cache@v3
116+
with:
117+
path: ~/.cache/pypoetry
118+
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
119+
restore-keys: |
120+
${{ runner.os }}-poetry-${{ matrix.python-version }}-
121+
${{ runner.os }}-poetry-
122+
117123
# Publish the source distribution with the version that's in
118124
# the repository, otherwise the tests will fail
119125
- name: Compile source distribution
120126
run: python3 -m poetry build --format=sdist
121127
if: startsWith(matrix.os, 'ubuntu')
122128

129+
- name: Set up cache for cibuildwheel output
130+
uses: actions/cache@v3
131+
with:
132+
path: wheelhouse
133+
key: ${{ runner.os }}-cibuildwheel-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
134+
restore-keys: |
135+
${{ runner.os }}-cibuildwheel-${{ matrix.python-version }}-
136+
${{ runner.os }}-cibuildwheel-
137+
123138
- name: Build wheels
124139
uses: pypa/[email protected]
125140
with:
@@ -145,7 +160,7 @@ jobs:
145160
# TODO: upload to SVN
146161
- uses: actions/upload-artifact@v4
147162
with:
148-
name: "svn-release-candidate-${{ matrix.os }}"
163+
name: "svn-release-candidate-${{ matrix.os }}-${{ matrix.python-version }}"
149164
path: ./wheelhouse/*
150165

151166
svn_generate_checksums:
@@ -224,6 +239,7 @@ jobs:
224239
strategy:
225240
matrix:
226241
os: [ ubuntu-22.04, windows-2022, macos-13, macos-14, macos-15 ]
242+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
227243

228244
steps:
229245
- uses: actions/checkout@v4
@@ -232,24 +248,38 @@ jobs:
232248

233249
- uses: actions/setup-python@v5
234250
with:
235-
python-version: |
236-
3.9
237-
3.10
238-
3.11
239-
3.12
251+
python-version: ${{ matrix.python-version }}
240252

241253
- name: Install poetry
242254
run: pip install poetry
243255

244256
- name: Set version with RC
245257
run: python -m poetry version "${{ env.RELEASE_CANDIDATE }}"
246258

259+
- name: Cache Poetry
260+
uses: actions/cache@v3
261+
with:
262+
path: ~/.cache/pypoetry
263+
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
264+
restore-keys: |
265+
${{ runner.os }}-poetry-${{ matrix.python-version }}-
266+
${{ runner.os }}-poetry-
267+
247268
# Publish the source distribution with the version that's in
248269
# the repository, otherwise the tests will fail
249270
- name: Compile source distribution
250271
run: python3 -m poetry build --format=sdist
251272
if: startsWith(matrix.os, 'ubuntu')
252273

274+
- name: Set up cache for cibuildwheel output
275+
uses: actions/cache@v3
276+
with:
277+
path: wheelhouse
278+
key: ${{ runner.os }}-cibuildwheel-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
279+
restore-keys: |
280+
${{ runner.os }}-cibuildwheel-${{ matrix.python-version }}-
281+
${{ runner.os }}-cibuildwheel-
282+
253283
- name: Build wheels
254284
uses: pypa/[email protected]
255285
with:
@@ -275,7 +305,7 @@ jobs:
275305
# TODO: upload to PyPi
276306
- uses: actions/upload-artifact@v4
277307
with:
278-
name: "pypi-release-candidate-${{ matrix.os }}"
308+
name: "pypi-release-candidate-${{ matrix.os }}-${{ matrix.python-version }}"
279309
path: ./wheelhouse/*
280310

281311
pypi_merge_artifacts:

0 commit comments

Comments
 (0)