@@ -16,29 +16,46 @@ concurrency:
16
16
env :
17
17
SHOWCASE_VERSION : 0.35.0
18
18
PROTOC_VERSION : 3.20.2
19
+ # Use Python 3.10 for docs to match the version for the sphinx plugin
20
+ # https://github.com/googleapis/synthtool/pull/1891
21
+ DOCS_PYTHON : " 3.10"
22
+ OLDEST_PYTHON : " 3.7"
23
+ NEWEST_STABLE_PYTHON : " 3.13"
24
+ PRERELEASE_PYTHON : " 3.14"
19
25
20
26
jobs :
27
+ all_python_setup :
28
+ runs-on : ubuntu-latest
29
+ outputs :
30
+ all_python : ${{ steps.all_python_setup.outputs.all_python }}
31
+ steps :
32
+ - name : Set up all python
33
+ id : all_python
34
+ run : |
35
+ echo 'all_python=["3.7", "3.8", "3.9", "3.10", "3.11" ]' >> $GITHUB_OUTPUT
21
36
docs :
22
37
runs-on : ubuntu-latest
23
38
steps :
24
39
- uses : actions/checkout@v4
25
40
- name : Set up Python
26
41
uses : actions/setup-python@v5
27
- # Use python 3.10 for docs to match the version for the sphinx plugin
28
- # https://github.com/googleapis/synthtool/pull/1891
29
42
with :
30
- python-version : " 3.10 "
43
+ python-version : " ${{ vars.DOCS_PYTHON }} "
31
44
cache : ' pip'
32
45
- name : Install nox.
33
46
run : python -m pip install nox
34
47
- name : Build the documentation.
35
48
run : nox -s docs
36
49
mypy :
50
+ needs : all_python_setup
37
51
strategy :
38
52
matrix :
39
53
# Run mypy on all of the supported python versions listed in setup.py
40
54
# https://github.com/python/mypy/blob/master/setup.py
41
- python : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
55
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
56
+ exclude :
57
+ # Remove once https://github.com/googleapis/gapic-generator-python/issues/2303 is fixed
58
+ - python : 3.7
42
59
runs-on : ubuntu-latest
43
60
steps :
44
61
- uses : actions/checkout@v4
56
73
# Run showcase tests on the lowest and highest supported runtimes
57
74
matrix :
58
75
# 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 "]
76
+ python : ["${{ vars.OLDEST_PYTHON }} ", "${{ vars.NEWEST_STABLE_PYTHON }} "]
60
77
target : [showcase, showcase_w_rest_async]
61
78
logging_scope : ["", "google"]
62
79
@@ -111,10 +128,10 @@ jobs:
111
128
run : |
112
129
sudo mkdir -p /tmp/workspace/tests/cert/
113
130
sudo chown -R ${USER} /tmp/workspace/
114
- - name : Set up Python "3.13"
131
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
115
132
uses : actions/setup-python@v5
116
133
with :
117
- python-version : " 3.13 "
134
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
118
135
cache : ' pip'
119
136
- name : Copy mtls files
120
137
run : cp tests/cert/mtls.* /tmp/workspace/tests/cert/
@@ -145,9 +162,10 @@ jobs:
145
162
nox -s ${{ matrix.target }}
146
163
# TODO(yon-mg): add compute unit tests
147
164
showcase-unit :
165
+ needs : all_python_setup
148
166
strategy :
149
167
matrix :
150
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
168
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
151
169
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `_w_rest_async` variant when async rest is GA.
152
170
variant : ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
153
171
logging_scope : ["", "google"]
@@ -185,10 +203,10 @@ jobs:
185
203
runs-on : ubuntu-latest
186
204
steps :
187
205
- uses : actions/checkout@v4
188
- - name : Set up Python "3.13"
206
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
189
207
uses : actions/setup-python@v5
190
208
with :
191
- python-version : " 3.13 "
209
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
192
210
cache : ' pip'
193
211
- name : Install system dependencies.
194
212
run : |
@@ -213,10 +231,10 @@ jobs:
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 ${{ vars.NEWEST_STABLE_PYTHON }}
217
235
uses : actions/setup-python@v5
218
236
with :
219
- python-version : " 3.13 "
237
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
220
238
cache : ' pip'
221
239
- name : Install system dependencies.
222
240
run : |
@@ -238,10 +256,10 @@ jobs:
238
256
runs-on : ubuntu-latest
239
257
steps :
240
258
- uses : actions/checkout@v4
241
- - name : Set up Python "3.13"
259
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
242
260
uses : actions/setup-python@v5
243
261
with :
244
- python-version : " 3.13 "
262
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
245
263
cache : ' pip'
246
264
- name : Install system dependencies.
247
265
run : |
@@ -252,10 +270,10 @@ jobs:
252
270
- name : Check autogenerated snippets.
253
271
run : nox -s snippetgen
254
272
unit :
273
+ needs : all_python_setup
255
274
strategy :
256
275
matrix :
257
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
258
-
276
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
259
277
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
260
278
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
261
279
runs-on : ubuntu-22.04
@@ -264,7 +282,7 @@ jobs:
264
282
- name : Set up Python ${{ matrix.python }}
265
283
uses : actions/setup-python@v5
266
284
with :
267
- python-version : ${{ matrix.python }}
285
+ python-version : " ${{ matrix.python }}"
268
286
cache : ' pip'
269
287
- name : Install pandoc
270
288
run : |
@@ -276,9 +294,10 @@ jobs:
276
294
- name : Run unit tests.
277
295
run : nox -s unit-${{ matrix.python }}
278
296
fragment :
297
+ needs : all_python_setup
279
298
strategy :
280
299
matrix :
281
- python : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
300
+ python : ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
282
301
variant : ['', _alternative_templates]
283
302
284
303
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
@@ -333,29 +352,29 @@ jobs:
333
352
runs-on : ubuntu-latest
334
353
steps :
335
354
- uses : actions/checkout@v4
336
- - name : Set up Python 3.13
355
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
337
356
uses : actions/setup-python@v5
338
357
with :
339
- python-version : " 3.13 "
358
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
340
359
cache : ' pip'
341
360
- name : Install nox.
342
361
run : |
343
362
python -m pip install nox
344
363
- name : Run blacken and lint on the generated output.
345
364
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
365
+ nox -f tests/integration/goldens/asset/noxfile.py -s mypy-${{ vars.NEWEST_STABLE_PYTHON }} blacken lint
366
+ nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-${{ vars.NEWEST_STABLE_PYTHON }} blacken lint
367
+ nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-${{ vars.NEWEST_STABLE_PYTHON }} blacken lint
368
+ nox -f tests/integration/goldens/logging/noxfile.py -s mypy-${{ vars.NEWEST_STABLE_PYTHON }} blacken lint
369
+ nox -f tests/integration/goldens/redis/noxfile.py -s mypy-${{ vars.NEWEST_STABLE_PYTHON }} blacken lint
351
370
goldens-unit :
352
371
runs-on : ubuntu-latest
353
372
steps :
354
373
- uses : actions/checkout@v4
355
- - name : Set up Python 3.13
374
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
356
375
uses : actions/setup-python@v5
357
376
with :
358
- python-version : " 3.13 "
377
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
359
378
cache : ' pip'
360
379
- name : Install nox.
361
380
run : |
@@ -365,18 +384,18 @@ jobs:
365
384
# in order to run unit tests
366
385
# See https://github.com/googleapis/gapic-generator-python/issues/1806
367
386
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
387
+ nox -f tests/integration/goldens/credentials/noxfile.py -s unit-${{ vars.NEWEST_STABLE_PYTHON }}
388
+ nox -f tests/integration/goldens/eventarc/noxfile.py -s unit-${{ vars.NEWEST_STABLE_PYTHON }}
389
+ nox -f tests/integration/goldens/logging/noxfile.py -s unit-${{ vars.NEWEST_STABLE_PYTHON }}
390
+ nox -f tests/integration/goldens/redis/noxfile.py -s unit-${{ vars.NEWEST_STABLE_PYTHON }}
372
391
goldens-prerelease :
373
392
runs-on : ubuntu-latest
374
393
steps :
375
394
- uses : actions/checkout@v4
376
- - name : Set up Python 3.13
395
+ - name : Set up Python ${{ vars.PRERELEASE_PYTHON }}
377
396
uses : actions/setup-python@v5
378
397
with :
379
- python-version : " 3.13 "
398
+ python-version : " ${{ vars.PRERELEASE_PYTHON }} "
380
399
cache : ' pip'
381
400
- name : Install nox.
382
401
run : |
@@ -394,10 +413,10 @@ jobs:
394
413
runs-on : ubuntu-latest
395
414
steps :
396
415
- uses : actions/checkout@v4
397
- - name : Set up Python "3.13"
416
+ - name : Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
398
417
uses : actions/setup-python@v5
399
418
with :
400
- python-version : " 3.13 "
419
+ python-version : " ${{ vars.NEWEST_STABLE_PYTHON }} "
401
420
cache : ' pip'
402
421
- name : Install nox.
403
422
run : |
0 commit comments