3232 fail-fast : false
3333 matrix :
3434 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"]
3636 include :
3737 - os : macos-latest
3838 python-version : " 3.10"
4444 outputs :
4545 python-key : ${{ steps.generate-python-key.outputs.key }}
4646 steps :
47- - name : Check out code from GitHub
47+ - &checkout
48+ name : Check out code from GitHub
4849 uses : actions/checkout@v5.0.0
49- - name : Set up Python ${{ matrix.python-version }}
50+ - &setup-python
51+ name : Set up Python ${{ matrix.python-version }}
5052 id : python
5153 uses : actions/setup-python@v6.0.0
5254 with :
6062 hashFiles('pyproject.toml', 'requirements_test.txt',
6163 'requirements_test_min.txt', 'requirements_test_pre_commit.txt') }}" >>
6264 $GITHUB_OUTPUT
63- - name : Restore Python virtual environment
65+ - &cache-python
66+ name : Restore Python virtual environment
6467 id : cache-venv
6568 uses : actions/cache@v4.2.4
6669 with :
7376 run : |
7477 python -m venv venv
7578 . venv/bin/activate
76- python -m pip install --upgrade pip setuptools wheel
79+ python -m pip install --upgrade pip
7780 pip install --upgrade --requirement requirements_test.txt
7881 - name : Run pytest
7982 run : |
@@ -98,17 +101,17 @@ jobs:
98101 name : process / coverage
99102 runs-on : ubuntu-latest
100103 timeout-minutes : 5
101- needs : tests
104+ needs : [ tests]
102105 steps :
103- - name : Check out code from GitHub
104- uses : actions/checkout@v5.0.0
106+ - *checkout
105107 - name : Set up Python 3.13
106108 id : python
107109 uses : actions/setup-python@v6.0.0
108110 with :
109111 python-version : " 3.13"
110112 check-latest : true
111- - name : Restore Python virtual environment
113+ - &cache-restore-python
114+ name : Restore Python virtual environment
112115 id : cache-venv
113116 uses : actions/cache/restore@v4.2.4
114117 with :
@@ -134,29 +137,15 @@ jobs:
134137 name : run benchmark / ${{ matrix.python-version }} / Linux
135138 runs-on : ubuntu-latest
136139 timeout-minutes : 10
137- needs : tests
140+ needs : [ tests]
138141 strategy :
139142 fail-fast : false
140143 matrix :
141144 python-version : ["3.13"]
142145 steps :
143- - name : Check out code from GitHub
144- uses : actions/checkout@v5.0.0
145- - name : Set up Python ${{ matrix.python-version }}
146- id : python
147- uses : actions/setup-python@v6.0.0
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/restore@v4.2.4
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
160149 - name : Run pytest
161150 run : |
162151 . venv/bin/activate
@@ -185,45 +174,31 @@ jobs:
185174 name : run / ${{ matrix.python-version }} / Windows
186175 runs-on : windows-latest
187176 timeout-minutes : 25
188- needs : tests
177+ needs : [ tests]
189178 strategy :
190179 fail-fast : false
191180 matrix :
192- python-version : ["3.10", "3.11", "3.12", "3.13", "3.14"]
181+ python-version : *matrix-python-version
193182 steps :
194183 - name : Set temp directory
195184 run : echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
196185 # Workaround to set correct temp directory on Windows
197186 # https://github.com/actions/virtual-environments/issues/712
198- - name : Check out code from GitHub
199- uses : actions/checkout@v5.0.0
200- - name : Set up Python ${{ matrix.python-version }}
201- id : python
202- uses : actions/setup-python@v6.0.0
203- with :
204- python-version : ${{ matrix.python-version }}
205- check-latest : true
206- allow-prereleases : true
187+ - *checkout
188+ - *setup-python
207189 - name : Generate partial Python venv restore key
208190 id : generate-python-key
209191 run : >-
210192 echo "key=venv-${{ env.CACHE_VERSION }}-${{
211193 hashFiles('pyproject.toml', 'requirements_test_min.txt')
212194 }}" >> $env:GITHUB_OUTPUT
213- - name : Restore Python virtual environment
214- id : cache-venv
215- uses : actions/cache@v4.2.4
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
221196 - name : Create Python virtual environment
222197 if : steps.cache-venv.outputs.cache-hit != 'true'
223198 run : |
224199 python -m venv venv
225200 . venv\\Scripts\\activate
226- python -m pip install --upgrade pip setuptools wheel
201+ python -m pip install --upgrade pip
227202 pip install --upgrade --requirement requirements_test_min.txt
228203 - name : Run pytest
229204 run : |
0 commit comments