Skip to content

Commit c10cec7

Browse files
committed
for testing purposes
1 parent c8b7229 commit c10cec7

File tree

1 file changed

+54
-35
lines changed

1 file changed

+54
-35
lines changed

.github/workflows/tests.yaml

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,46 @@ concurrency:
1616
env:
1717
SHOWCASE_VERSION: 0.35.0
1818
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"
1925

2026
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
2136
docs:
2237
runs-on: ubuntu-latest
2338
steps:
2439
- uses: actions/checkout@v4
2540
- name: Set up Python
2641
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
2942
with:
30-
python-version: "3.10"
43+
python-version: "${{ vars.DOCS_PYTHON }}"
3144
cache: 'pip'
3245
- name: Install nox.
3346
run: python -m pip install nox
3447
- name: Build the documentation.
3548
run: nox -s docs
3649
mypy:
50+
needs: all_python_setup
3751
strategy:
3852
matrix:
3953
# Run mypy on all of the supported python versions listed in setup.py
4054
# 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
4259
runs-on: ubuntu-latest
4360
steps:
4461
- uses: actions/checkout@v4
@@ -56,7 +73,7 @@ jobs:
5673
# Run showcase tests on the lowest and highest supported runtimes
5774
matrix:
5875
# 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 }}"]
6077
target: [showcase, showcase_w_rest_async]
6178
logging_scope: ["", "google"]
6279

@@ -111,10 +128,10 @@ jobs:
111128
run: |
112129
sudo mkdir -p /tmp/workspace/tests/cert/
113130
sudo chown -R ${USER} /tmp/workspace/
114-
- name: Set up Python "3.13"
131+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
115132
uses: actions/setup-python@v5
116133
with:
117-
python-version: "3.13"
134+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
118135
cache: 'pip'
119136
- name: Copy mtls files
120137
run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/
@@ -145,9 +162,10 @@ jobs:
145162
nox -s ${{ matrix.target }}
146163
# TODO(yon-mg): add compute unit tests
147164
showcase-unit:
165+
needs: all_python_setup
148166
strategy:
149167
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) }}
151169
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `_w_rest_async` variant when async rest is GA.
152170
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
153171
logging_scope: ["", "google"]
@@ -185,10 +203,10 @@ jobs:
185203
runs-on: ubuntu-latest
186204
steps:
187205
- uses: actions/checkout@v4
188-
- name: Set up Python "3.13"
206+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
189207
uses: actions/setup-python@v5
190208
with:
191-
python-version: "3.13"
209+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
192210
cache: 'pip'
193211
- name: Install system dependencies.
194212
run: |
@@ -213,10 +231,10 @@ jobs:
213231
variant: ['', _alternative_templates]
214232
steps:
215233
- uses: actions/checkout@v4
216-
- name: Set up Python "3.13"
234+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
217235
uses: actions/setup-python@v5
218236
with:
219-
python-version: "3.13"
237+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
220238
cache: 'pip'
221239
- name: Install system dependencies.
222240
run: |
@@ -238,10 +256,10 @@ jobs:
238256
runs-on: ubuntu-latest
239257
steps:
240258
- uses: actions/checkout@v4
241-
- name: Set up Python "3.13"
259+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
242260
uses: actions/setup-python@v5
243261
with:
244-
python-version: "3.13"
262+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
245263
cache: 'pip'
246264
- name: Install system dependencies.
247265
run: |
@@ -252,10 +270,10 @@ jobs:
252270
- name: Check autogenerated snippets.
253271
run: nox -s snippetgen
254272
unit:
273+
needs: all_python_setup
255274
strategy:
256275
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) }}
259277
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
260278
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
261279
runs-on: ubuntu-22.04
@@ -264,7 +282,7 @@ jobs:
264282
- name: Set up Python ${{ matrix.python }}
265283
uses: actions/setup-python@v5
266284
with:
267-
python-version: ${{ matrix.python }}
285+
python-version: "${{ matrix.python }}"
268286
cache: 'pip'
269287
- name: Install pandoc
270288
run: |
@@ -276,9 +294,10 @@ jobs:
276294
- name: Run unit tests.
277295
run: nox -s unit-${{ matrix.python }}
278296
fragment:
297+
needs: all_python_setup
279298
strategy:
280299
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) }}
282301
variant: ['', _alternative_templates]
283302

284303
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
@@ -333,29 +352,29 @@ jobs:
333352
runs-on: ubuntu-latest
334353
steps:
335354
- uses: actions/checkout@v4
336-
- name: Set up Python 3.13
355+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
337356
uses: actions/setup-python@v5
338357
with:
339-
python-version: "3.13"
358+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
340359
cache: 'pip'
341360
- name: Install nox.
342361
run: |
343362
python -m pip install nox
344363
- name: Run blacken and lint on the generated output.
345364
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
351370
goldens-unit:
352371
runs-on: ubuntu-latest
353372
steps:
354373
- uses: actions/checkout@v4
355-
- name: Set up Python 3.13
374+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
356375
uses: actions/setup-python@v5
357376
with:
358-
python-version: "3.13"
377+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
359378
cache: 'pip'
360379
- name: Install nox.
361380
run: |
@@ -365,18 +384,18 @@ jobs:
365384
# in order to run unit tests
366385
# See https://github.com/googleapis/gapic-generator-python/issues/1806
367386
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 }}
372391
goldens-prerelease:
373392
runs-on: ubuntu-latest
374393
steps:
375394
- uses: actions/checkout@v4
376-
- name: Set up Python 3.13
395+
- name: Set up Python ${{ vars.PRERELEASE_PYTHON }}
377396
uses: actions/setup-python@v5
378397
with:
379-
python-version: "3.13"
398+
python-version: "${{ vars.PRERELEASE_PYTHON }}"
380399
cache: 'pip'
381400
- name: Install nox.
382401
run: |
@@ -394,10 +413,10 @@ jobs:
394413
runs-on: ubuntu-latest
395414
steps:
396415
- uses: actions/checkout@v4
397-
- name: Set up Python "3.13"
416+
- name: Set up Python ${{ vars.NEWEST_STABLE_PYTHON }}
398417
uses: actions/setup-python@v5
399418
with:
400-
python-version: "3.13"
419+
python-version: "${{ vars.NEWEST_STABLE_PYTHON }}"
401420
cache: 'pip'
402421
- name: Install nox.
403422
run: |

0 commit comments

Comments
 (0)