Skip to content

Commit 98be921

Browse files
committed
for testing purposes
1 parent c8b7229 commit 98be921

File tree

1 file changed

+56
-32
lines changed

1 file changed

+56
-32
lines changed

.github/workflows/tests.yaml

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ env:
1818
PROTOC_VERSION: 3.20.2
1919

2020
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
2130
docs:
2231
runs-on: ubuntu-latest
2332
steps:
@@ -34,11 +43,15 @@ jobs:
3443
- name: Build the documentation.
3544
run: nox -s docs
3645
mypy:
46+
needs: all_python_setup
3747
strategy:
3848
matrix:
3949
# Run mypy on all of the supported python versions listed in setup.py
4050
# 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
4255
runs-on: ubuntu-latest
4356
steps:
4457
- uses: actions/checkout@v4
@@ -52,11 +65,12 @@ jobs:
5265
- name: Check type annotations.
5366
run: nox -s mypy-${{ matrix.python }}
5467
showcase:
68+
needs: all_python_setup
5569
strategy:
5670
# Run showcase tests on the lowest and highest supported runtimes
5771
matrix:
5872
# 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]"]
6074
target: [showcase, showcase_w_rest_async]
6175
logging_scope: ["", "google"]
6276

@@ -100,6 +114,7 @@ jobs:
100114
run: nox -s ${{ matrix.target }}-${{ matrix.python }}
101115
showcase-mtls:
102116
if: ${{ false }} # TODO(dovs): reenable when #1218 is fixed
117+
needs: all_python_setup
103118
strategy:
104119
matrix:
105120
target: [showcase_mtls]
@@ -111,10 +126,10 @@ jobs:
111126
run: |
112127
sudo mkdir -p /tmp/workspace/tests/cert/
113128
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]
115130
uses: actions/setup-python@v5
116131
with:
117-
python-version: "3.13"
132+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
118133
cache: 'pip'
119134
- name: Copy mtls files
120135
run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/
@@ -145,9 +160,10 @@ jobs:
145160
nox -s ${{ matrix.target }}
146161
# TODO(yon-mg): add compute unit tests
147162
showcase-unit:
163+
needs: all_python_setup
148164
strategy:
149165
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) }}
151167
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `_w_rest_async` variant when async rest is GA.
152168
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
153169
logging_scope: ["", "google"]
@@ -182,13 +198,14 @@ jobs:
182198
GOOGLE_SDK_PYTHON_LOGGING_SCOPE: ${{ matrix.logging_scope }}
183199
run: nox -s showcase_unit${{ matrix.variant }}-${{ matrix.python }}
184200
showcase-unit-add-iam-methods:
201+
needs: all_python_setup
185202
runs-on: ubuntu-latest
186203
steps:
187204
- uses: actions/checkout@v4
188-
- name: Set up Python "3.13"
205+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
189206
uses: actions/setup-python@v5
190207
with:
191-
python-version: "3.13"
208+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
192209
cache: 'pip'
193210
- name: Install system dependencies.
194211
run: |
@@ -207,16 +224,17 @@ jobs:
207224
- name: Run unit tests.
208225
run: nox -s showcase_unit_add_iam_methods
209226
showcase-mypy:
227+
needs: all_python_setup
210228
runs-on: ubuntu-latest
211229
strategy:
212230
matrix:
213231
variant: ['', _alternative_templates]
214232
steps:
215233
- 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]
217235
uses: actions/setup-python@v5
218236
with:
219-
python-version: "3.13"
237+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
220238
cache: 'pip'
221239
- name: Install system dependencies.
222240
run: |
@@ -235,13 +253,14 @@ jobs:
235253
- name: Typecheck the generated output.
236254
run: nox -s showcase_mypy${{ matrix.variant }}
237255
snippetgen:
256+
needs: all_python_setup
238257
runs-on: ubuntu-latest
239258
steps:
240259
- 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]
242261
uses: actions/setup-python@v5
243262
with:
244-
python-version: "3.13"
263+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
245264
cache: 'pip'
246265
- name: Install system dependencies.
247266
run: |
@@ -252,10 +271,10 @@ jobs:
252271
- name: Check autogenerated snippets.
253272
run: nox -s snippetgen
254273
unit:
274+
needs: all_python_setup
255275
strategy:
256276
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) }}
259278
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
260279
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
261280
runs-on: ubuntu-22.04
@@ -264,7 +283,7 @@ jobs:
264283
- name: Set up Python ${{ matrix.python }}
265284
uses: actions/setup-python@v5
266285
with:
267-
python-version: ${{ matrix.python }}
286+
python-version: "${{ matrix.python }}"
268287
cache: 'pip'
269288
- name: Install pandoc
270289
run: |
@@ -276,9 +295,10 @@ jobs:
276295
- name: Run unit tests.
277296
run: nox -s unit-${{ matrix.python }}
278297
fragment:
298+
needs: all_python_setup
279299
strategy:
280300
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) }}
282302
variant: ['', _alternative_templates]
283303

284304
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
@@ -330,32 +350,34 @@ jobs:
330350
run: bazelisk test //tests/integration/... --test_output=errors
331351

332352
goldens-lint:
353+
needs: all_python_setup
333354
runs-on: ubuntu-latest
334355
steps:
335356
- 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]
337358
uses: actions/setup-python@v5
338359
with:
339-
python-version: "3.13"
360+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
340361
cache: 'pip'
341362
- name: Install nox.
342363
run: |
343364
python -m pip install nox
344365
- name: Run blacken and lint on the generated output.
345366
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
351372
goldens-unit:
373+
needs: all_python_setup
352374
runs-on: ubuntu-latest
353375
steps:
354376
- 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]
356378
uses: actions/setup-python@v5
357379
with:
358-
python-version: "3.13"
380+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
359381
cache: 'pip'
360382
- name: Install nox.
361383
run: |
@@ -365,18 +387,19 @@ jobs:
365387
# in order to run unit tests
366388
# See https://github.com/googleapis/gapic-generator-python/issues/1806
367389
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]
372394
goldens-prerelease:
395+
needs: all_python_setup
373396
runs-on: ubuntu-latest
374397
steps:
375398
- 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]
377400
uses: actions/setup-python@v5
378401
with:
379-
python-version: "3.13"
402+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
380403
cache: 'pip'
381404
- name: Install nox.
382405
run: |
@@ -391,13 +414,14 @@ jobs:
391414
nox -f tests/integration/goldens/logging/noxfile.py -s prerelease_deps
392415
nox -f tests/integration/goldens/redis/noxfile.py -s prerelease_deps
393416
lint:
417+
needs: all_python_setup
394418
runs-on: ubuntu-latest
395419
steps:
396420
- 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]
398422
uses: actions/setup-python@v5
399423
with:
400-
python-version: "3.13"
424+
python-version: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}[-1]
401425
cache: 'pip'
402426
- name: Install nox.
403427
run: |

0 commit comments

Comments
 (0)