32
32
fail-fast : false
33
33
matrix :
34
34
os : [ubuntu-latest]
35
- python-version : ["3.10", "3.11", "3.12", "3.13", "3.14"]
35
+ python-version : &matrix-python-version ["3.10", "3.11", "3.12", "3.13", "3.14"]
36
36
include :
37
37
- os : macos-latest
38
38
python-version : " 3.10"
44
44
outputs :
45
45
python-key : ${{ steps.generate-python-key.outputs.key }}
46
46
steps :
47
- - name : Check out code from GitHub
47
+ - &checkout
48
+ name : Check out code from GitHub
48
49
49
- - name : Set up Python ${{ matrix.python-version }}
50
+ - &setup-python
51
+ name : Set up Python ${{ matrix.python-version }}
50
52
id : python
51
53
52
54
with :
60
62
hashFiles('pyproject.toml', 'requirements_test.txt',
61
63
'requirements_test_min.txt', 'requirements_test_pre_commit.txt') }}" >>
62
64
$GITHUB_OUTPUT
63
- - name : Restore Python virtual environment
65
+ - &cache-python
66
+ name : Restore Python virtual environment
64
67
id : cache-venv
65
68
66
69
with :
73
76
run : |
74
77
python -m venv venv
75
78
. venv/bin/activate
76
- python -m pip install --upgrade pip setuptools wheel
79
+ python -m pip install --upgrade pip
77
80
pip install --upgrade --requirement requirements_test.txt
78
81
- name : Run pytest
79
82
run : |
@@ -98,17 +101,17 @@ jobs:
98
101
name : process / coverage
99
102
runs-on : ubuntu-latest
100
103
timeout-minutes : 5
101
- needs : tests
104
+ needs : [ tests]
102
105
steps :
103
- - name : Check out code from GitHub
104
-
106
+ - *checkout
105
107
- name : Set up Python 3.13
106
108
id : python
107
109
108
110
with :
109
111
python-version : " 3.13"
110
112
check-latest : true
111
- - name : Restore Python virtual environment
113
+ - &cache-restore-python
114
+ name : Restore Python virtual environment
112
115
id : cache-venv
113
116
uses :
actions/cache/[email protected]
114
117
with :
@@ -134,29 +137,15 @@ jobs:
134
137
name : run benchmark / ${{ matrix.python-version }} / Linux
135
138
runs-on : ubuntu-latest
136
139
timeout-minutes : 10
137
- needs : tests
140
+ needs : [ tests]
138
141
strategy :
139
142
fail-fast : false
140
143
matrix :
141
144
python-version : ["3.13"]
142
145
steps :
143
- - name : Check out code from GitHub
144
-
145
- - name : Set up Python ${{ matrix.python-version }}
146
- id : python
147
-
148
- with :
149
- python-version : ${{ matrix.python-version }}
150
- check-latest : true
151
- - name : Restore Python virtual environment
152
- id : cache-venv
153
- uses :
actions/cache/[email protected]
154
- with :
155
- path : venv
156
- fail-on-cache-miss : true
157
- key :
158
- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
159
- needs.tests.outputs.python-key }}
146
+ - *checkout
147
+ - *setup-python
148
+ - *cache-restore-python
160
149
- name : Run pytest
161
150
run : |
162
151
. venv/bin/activate
@@ -185,45 +174,31 @@ jobs:
185
174
name : run / ${{ matrix.python-version }} / Windows
186
175
runs-on : windows-latest
187
176
timeout-minutes : 25
188
- needs : tests
177
+ needs : [ tests]
189
178
strategy :
190
179
fail-fast : false
191
180
matrix :
192
- python-version : ["3.10", "3.11", "3.12", "3.13", "3.14"]
181
+ python-version : *matrix-python-version
193
182
steps :
194
183
- name : Set temp directory
195
184
run : echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
196
185
# Workaround to set correct temp directory on Windows
197
186
# https://github.com/actions/virtual-environments/issues/712
198
- - name : Check out code from GitHub
199
-
200
- - name : Set up Python ${{ matrix.python-version }}
201
- id : python
202
-
203
- with :
204
- python-version : ${{ matrix.python-version }}
205
- check-latest : true
206
- allow-prereleases : true
187
+ - *checkout
188
+ - *setup-python
207
189
- name : Generate partial Python venv restore key
208
190
id : generate-python-key
209
191
run : >-
210
192
echo "key=venv-${{ env.CACHE_VERSION }}-${{
211
193
hashFiles('pyproject.toml', 'requirements_test_min.txt')
212
194
}}" >> $env:GITHUB_OUTPUT
213
- - name : Restore Python virtual environment
214
- id : cache-venv
215
-
216
- with :
217
- path : venv
218
- key : >-
219
- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
220
- steps.generate-python-key.outputs.key }}
195
+ - *cache-python
221
196
- name : Create Python virtual environment
222
197
if : steps.cache-venv.outputs.cache-hit != 'true'
223
198
run : |
224
199
python -m venv venv
225
200
. venv\\Scripts\\activate
226
- python -m pip install --upgrade pip setuptools wheel
201
+ python -m pip install --upgrade pip
227
202
pip install --upgrade --requirement requirements_test_min.txt
228
203
- name : Run pytest
229
204
run : |
0 commit comments