18
18
PROTOC_VERSION : 3.20.2
19
19
20
20
jobs :
21
+ all_python_setup :
22
+ runs-on : ubuntu-latest
23
+ outputs :
24
+ all_python : ${{ steps.all_python_setup.outputs.all_python }}
25
+ steps :
26
+ - name : Set up all python
27
+ id : all_python
28
+ run : |
29
+ echo 'all_python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]' >> $GITHUB_OUTPUT
21
30
docs :
22
31
runs-on : ubuntu-latest
23
32
steps :
@@ -34,11 +43,15 @@ jobs:
34
43
- name : Build the documentation.
35
44
run : nox -s docs
36
45
mypy :
46
+ needs : all_python_setup
37
47
strategy :
38
48
matrix :
39
49
# Run mypy on all of the supported python versions listed in setup.py
40
50
# https://github.com/python/mypy/blob/master/setup.py
41
- python : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
51
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
52
+ exclude :
53
+ # Remove once https://github.com/googleapis/gapic-generator-python/issues/2303 is fixed
54
+ - python : 3.7
42
55
runs-on : ubuntu-latest
43
56
steps :
44
57
- uses : actions/checkout@v4
@@ -52,11 +65,12 @@ jobs:
52
65
- name : Check type annotations.
53
66
run : nox -s mypy-${{ matrix.python }}
54
67
showcase :
68
+ needs : all_python_setup
55
69
strategy :
56
70
# Run showcase tests on the lowest and highest supported runtimes
57
71
matrix :
58
72
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `showcase_w_rest_async` target when async rest is GA.
59
- python : ["3.7 ", "3.13 "]
73
+ python : ["${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[0] ", "${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] "]
60
74
target : [showcase, showcase_w_rest_async]
61
75
logging_scope : ["", "google"]
62
76
@@ -100,6 +114,7 @@ jobs:
100
114
run : nox -s ${{ matrix.target }}-${{ matrix.python }}
101
115
showcase-mtls :
102
116
if : ${{ false }} # TODO(dovs): reenable when #1218 is fixed
117
+ needs : all_python_setup
103
118
strategy :
104
119
matrix :
105
120
target : [showcase_mtls]
@@ -111,10 +126,10 @@ jobs:
111
126
run : |
112
127
sudo mkdir -p /tmp/workspace/tests/cert/
113
128
sudo chown -R ${USER} /tmp/workspace/
114
- - name : Set up Python "3.13"
129
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
115
130
uses : actions/setup-python@v5
116
131
with :
117
- python-version : " 3.13 "
132
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
118
133
cache : ' pip'
119
134
- name : Copy mtls files
120
135
run : cp tests/cert/mtls.* /tmp/workspace/tests/cert/
@@ -145,9 +160,10 @@ jobs:
145
160
nox -s ${{ matrix.target }}
146
161
# TODO(yon-mg): add compute unit tests
147
162
showcase-unit :
163
+ needs : all_python_setup
148
164
strategy :
149
165
matrix :
150
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
166
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
151
167
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `_w_rest_async` variant when async rest is GA.
152
168
variant : ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
153
169
logging_scope : ["", "google"]
@@ -182,13 +198,14 @@ jobs:
182
198
GOOGLE_SDK_PYTHON_LOGGING_SCOPE : ${{ matrix.logging_scope }}
183
199
run : nox -s showcase_unit${{ matrix.variant }}-${{ matrix.python }}
184
200
showcase-unit-add-iam-methods :
201
+ needs : all_python_setup
185
202
runs-on : ubuntu-latest
186
203
steps :
187
204
- uses : actions/checkout@v4
188
- - name : Set up Python "3.13"
205
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
189
206
uses : actions/setup-python@v5
190
207
with :
191
- python-version : " 3.13 "
208
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
192
209
cache : ' pip'
193
210
- name : Install system dependencies.
194
211
run : |
@@ -207,16 +224,17 @@ jobs:
207
224
- name : Run unit tests.
208
225
run : nox -s showcase_unit_add_iam_methods
209
226
showcase-mypy :
227
+ needs : all_python_setup
210
228
runs-on : ubuntu-latest
211
229
strategy :
212
230
matrix :
213
231
variant : ['', _alternative_templates]
214
232
steps :
215
233
- uses : actions/checkout@v4
216
- - name : Set up Python "3.13"
234
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
217
235
uses : actions/setup-python@v5
218
236
with :
219
- python-version : " 3.13 "
237
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
220
238
cache : ' pip'
221
239
- name : Install system dependencies.
222
240
run : |
@@ -235,13 +253,14 @@ jobs:
235
253
- name : Typecheck the generated output.
236
254
run : nox -s showcase_mypy${{ matrix.variant }}
237
255
snippetgen :
256
+ needs : all_python_setup
238
257
runs-on : ubuntu-latest
239
258
steps :
240
259
- uses : actions/checkout@v4
241
- - name : Set up Python "3.13"
260
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
242
261
uses : actions/setup-python@v5
243
262
with :
244
- python-version : " 3.13 "
263
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
245
264
cache : ' pip'
246
265
- name : Install system dependencies.
247
266
run : |
@@ -252,10 +271,10 @@ jobs:
252
271
- name : Check autogenerated snippets.
253
272
run : nox -s snippetgen
254
273
unit :
274
+ needs : all_python_setup
255
275
strategy :
256
276
matrix :
257
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
258
-
277
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
259
278
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
260
279
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
261
280
runs-on : ubuntu-22.04
@@ -264,7 +283,7 @@ jobs:
264
283
- name : Set up Python ${{ matrix.python }}
265
284
uses : actions/setup-python@v5
266
285
with :
267
- python-version : ${{ matrix.python }}
286
+ python-version : " ${{ matrix.python }}"
268
287
cache : ' pip'
269
288
- name : Install pandoc
270
289
run : |
@@ -276,9 +295,10 @@ jobs:
276
295
- name : Run unit tests.
277
296
run : nox -s unit-${{ matrix.python }}
278
297
fragment :
298
+ needs : all_python_setup
279
299
strategy :
280
300
matrix :
281
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
301
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
282
302
variant : ['', _alternative_templates]
283
303
284
304
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
@@ -330,32 +350,34 @@ jobs:
330
350
run : bazelisk test //tests/integration/... --test_output=errors
331
351
332
352
goldens-lint :
353
+ needs : all_python_setup
333
354
runs-on : ubuntu-latest
334
355
steps :
335
356
- uses : actions/checkout@v4
336
- - name : Set up Python 3.13
357
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
337
358
uses : actions/setup-python@v5
338
359
with :
339
- python-version : " 3.13 "
360
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
340
361
cache : ' pip'
341
362
- name : Install nox.
342
363
run : |
343
364
python -m pip install nox
344
365
- name : Run blacken and lint on the generated output.
345
366
run : |
346
- nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.13 blacken lint
347
- nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.13 blacken lint
348
- nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.13 blacken lint
349
- nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.13 blacken lint
350
- nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.13 blacken lint
367
+ nox -f tests/integration/goldens/asset/noxfile.py -s mypy-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] blacken lint
368
+ nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] blacken lint
369
+ nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] blacken lint
370
+ nox -f tests/integration/goldens/logging/noxfile.py -s mypy-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] blacken lint
371
+ nox -f tests/integration/goldens/redis/noxfile.py -s mypy-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1] blacken lint
351
372
goldens-unit :
373
+ needs : all_python_setup
352
374
runs-on : ubuntu-latest
353
375
steps :
354
376
- uses : actions/checkout@v4
355
- - name : Set up Python 3.13
377
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
356
378
uses : actions/setup-python@v5
357
379
with :
358
- python-version : " 3.13 "
380
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
359
381
cache : ' pip'
360
382
- name : Install nox.
361
383
run : |
@@ -365,18 +387,19 @@ jobs:
365
387
# in order to run unit tests
366
388
# See https://github.com/googleapis/gapic-generator-python/issues/1806
367
389
run : |
368
- nox -f tests/integration/goldens/credentials/noxfile.py -s unit-3.13
369
- nox -f tests/integration/goldens/eventarc/noxfile.py -s unit-3.13
370
- nox -f tests/integration/goldens/logging/noxfile.py -s unit-3.13
371
- nox -f tests/integration/goldens/redis/noxfile.py -s unit-3.13
390
+ nox -f tests/integration/goldens/credentials/noxfile.py -s unit-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
391
+ nox -f tests/integration/goldens/eventarc/noxfile.py -s unit-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
392
+ nox -f tests/integration/goldens/logging/noxfile.py -s unit-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
393
+ nox -f tests/integration/goldens/redis/noxfile.py -s unit-${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
372
394
goldens-prerelease :
395
+ needs : all_python_setup
373
396
runs-on : ubuntu-latest
374
397
steps :
375
398
- uses : actions/checkout@v4
376
- - name : Set up Python 3.13
399
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
377
400
uses : actions/setup-python@v5
378
401
with :
379
- python-version : " 3.13 "
402
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
380
403
cache : ' pip'
381
404
- name : Install nox.
382
405
run : |
@@ -391,13 +414,14 @@ jobs:
391
414
nox -f tests/integration/goldens/logging/noxfile.py -s prerelease_deps
392
415
nox -f tests/integration/goldens/redis/noxfile.py -s prerelease_deps
393
416
lint :
417
+ needs : all_python_setup
394
418
runs-on : ubuntu-latest
395
419
steps :
396
420
- uses : actions/checkout@v4
397
- - name : Set up Python "3.13"
421
+ - name : Set up Python ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
398
422
uses : actions/setup-python@v5
399
423
with :
400
- python-version : " 3.13 "
424
+ python-version : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
401
425
cache : ' pip'
402
426
- name : Install nox.
403
427
run : |
0 commit comments