Skip to content

Commit a78af17

Browse files
authored
Move the GraphQL group over to the tox gen script (#3975)
- remove hardcoded entries for `ariadne`, `gql`, `graphene`, `strawberry` from the tox template - remove them from the ignore list in `populate_tox.py` - run `populate_tox.py` to fill in entries for them - run `split_gh_tox_actions.py` to generate the CI yaml files so that they correspond to the new tox.ini Note that this effectively eliminates the `-latest` tests for the GraphQL group. The script doesn't generate any `-latest` tests since it always makes sure to add a pinned entry for the latest version. So in case all of the integrations in a single group are using the script, the whole `-latest` test category is removed.
1 parent 221f105 commit a78af17

File tree

5 files changed

+76
-167
lines changed

5 files changed

+76
-167
lines changed

.github/workflows/test-integrations-graphql.yml

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -22,82 +22,14 @@ env:
2222
CACHED_BUILD_PATHS: |
2323
${{ github.workspace }}/dist-serverless
2424
jobs:
25-
test-graphql-latest:
26-
name: GraphQL (latest)
27-
timeout-minutes: 30
28-
runs-on: ${{ matrix.os }}
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
python-version: ["3.7","3.8","3.12","3.13"]
33-
# python3.6 reached EOL and is no longer being supported on
34-
# new versions of hosted runners on Github Actions
35-
# ubuntu-20.04 is the last version that supported python3.6
36-
# see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
37-
os: [ubuntu-20.04]
38-
steps:
39-
- uses: actions/[email protected]
40-
- uses: actions/setup-python@v5
41-
with:
42-
python-version: ${{ matrix.python-version }}
43-
allow-prereleases: true
44-
- name: Setup Test Env
45-
run: |
46-
pip install "coverage[toml]" tox
47-
- name: Erase coverage
48-
run: |
49-
coverage erase
50-
- name: Test ariadne latest
51-
run: |
52-
set -x # print commands that are executed
53-
./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne-latest"
54-
- name: Test gql latest
55-
run: |
56-
set -x # print commands that are executed
57-
./scripts/runtox.sh "py${{ matrix.python-version }}-gql-latest"
58-
- name: Test graphene latest
59-
run: |
60-
set -x # print commands that are executed
61-
./scripts/runtox.sh "py${{ matrix.python-version }}-graphene-latest"
62-
- name: Test strawberry latest
63-
run: |
64-
set -x # print commands that are executed
65-
./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry-latest"
66-
- name: Generate coverage XML (Python 3.6)
67-
if: ${{ !cancelled() && matrix.python-version == '3.6' }}
68-
run: |
69-
export COVERAGE_RCFILE=.coveragerc36
70-
coverage combine .coverage-sentry-*
71-
coverage xml --ignore-errors
72-
- name: Generate coverage XML
73-
if: ${{ !cancelled() && matrix.python-version != '3.6' }}
74-
run: |
75-
coverage combine .coverage-sentry-*
76-
coverage xml
77-
- name: Upload coverage to Codecov
78-
if: ${{ !cancelled() }}
79-
uses: codecov/[email protected]
80-
with:
81-
token: ${{ secrets.CODECOV_TOKEN }}
82-
files: coverage.xml
83-
# make sure no plugins alter our coverage reports
84-
plugin: noop
85-
verbose: true
86-
- name: Upload test results to Codecov
87-
if: ${{ !cancelled() }}
88-
uses: codecov/test-results-action@v1
89-
with:
90-
token: ${{ secrets.CODECOV_TOKEN }}
91-
files: .junitxml
92-
verbose: true
9325
test-graphql-pinned:
9426
name: GraphQL (pinned)
9527
timeout-minutes: 30
9628
runs-on: ${{ matrix.os }}
9729
strategy:
9830
fail-fast: false
9931
matrix:
100-
python-version: ["3.7","3.8","3.11","3.12"]
32+
python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"]
10133
# python3.6 reached EOL and is no longer being supported on
10234
# new versions of hosted runners on Github Actions
10335
# ubuntu-20.04 is the last version that supported python3.6

scripts/populate_tox/config.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,28 @@
55
#
66
# See scripts/populate_tox/README.md for more info on the format and examples.
77

8-
TEST_SUITE_CONFIG = {}
8+
TEST_SUITE_CONFIG = {
9+
"ariadne": {
10+
"package": "ariadne",
11+
"deps": {
12+
"*": ["fastapi", "flask", "httpx"],
13+
},
14+
"python": ">=3.8",
15+
},
16+
"gql": {
17+
"package": "gql[all]",
18+
},
19+
"graphene": {
20+
"package": "graphene",
21+
"deps": {
22+
"*": ["blinker", "fastapi", "flask", "httpx"],
23+
"py3.6": ["aiocontextvars"],
24+
},
25+
},
26+
"strawberry": {
27+
"package": "strawberry-graphql[fastapi,flask]",
28+
"deps": {
29+
"*": ["httpx"],
30+
},
31+
},
32+
}

scripts/populate_tox/populate_tox.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"potel",
5757
"aiohttp",
5858
"anthropic",
59-
"ariadne",
6059
"arq",
6160
"asgi",
6261
"asyncpg",
@@ -76,8 +75,6 @@
7675
"fastapi",
7776
"flask",
7877
"gcp",
79-
"gql",
80-
"graphene",
8178
"grpc",
8279
"httpx",
8380
"huey",
@@ -104,7 +101,6 @@
104101
"starlette",
105102
"starlite",
106103
"sqlalchemy",
107-
"strawberry",
108104
"tornado",
109105
"trytond",
110106
"typer",
@@ -464,7 +460,9 @@ def _compare_min_version_with_defined(
464460
)
465461

466462

467-
def _add_python_versions_to_release(integration: str, package: str, release: Version):
463+
def _add_python_versions_to_release(
464+
integration: str, package: str, release: Version
465+
) -> None:
468466
release_pypi_data = fetch_release(package, release)
469467
time.sleep(0.1) # give PYPI some breathing room
470468

@@ -522,10 +520,8 @@ def main() -> None:
522520
test_releases = pick_releases_to_test(releases)
523521

524522
for release in test_releases:
525-
py_versions = _add_python_versions_to_release(
526-
integration, package, release
527-
)
528-
if not py_versions:
523+
_add_python_versions_to_release(integration, package, release)
524+
if not release.python_versions:
529525
print(f" Release {release} has no Python versions, skipping.")
530526

531527
test_releases = [

scripts/populate_tox/tox.jinja

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ envlist =
4343
{py3.8,py3.11,py3.12}-anthropic-v{0.16,0.28,0.40}
4444
{py3.7,py3.11,py3.12}-anthropic-latest
4545

46-
# Ariadne
47-
{py3.8,py3.11}-ariadne-v{0.20}
48-
{py3.8,py3.12,py3.13}-ariadne-latest
49-
5046
# Arq
5147
{py3.7,py3.11}-arq-v{0.23}
5248
{py3.7,py3.12,py3.13}-arq-latest
@@ -140,14 +136,6 @@ envlist =
140136
# GCP
141137
{py3.7}-gcp
142138

143-
# GQL
144-
{py3.7,py3.11}-gql-v{3.4}
145-
{py3.7,py3.12,py3.13}-gql-latest
146-
147-
# Graphene
148-
{py3.7,py3.11}-graphene-v{3.3}
149-
{py3.7,py3.12,py3.13}-graphene-latest
150-
151139
# gRPC
152140
{py3.7,py3.9}-grpc-v{1.39}
153141
{py3.7,py3.10}-grpc-v{1.49}
@@ -276,11 +264,6 @@ envlist =
276264
{py3.7,py3.11}-sqlalchemy-v{2.0}
277265
{py3.7,py3.12,py3.13}-sqlalchemy-latest
278266

279-
# Strawberry
280-
{py3.8,py3.11}-strawberry-v{0.209}
281-
{py3.8,py3.11,py3.12}-strawberry-v{0.222}
282-
{py3.8,py3.12,py3.13}-strawberry-latest
283-
284267
# Tornado
285268
{py3.8,py3.11,py3.12}-tornado-v{6.0}
286269
{py3.8,py3.11,py3.12}-tornado-v{6.2}
@@ -362,13 +345,6 @@ deps =
362345
anthropic-v0.40: anthropic~=0.40.0
363346
anthropic-latest: anthropic
364347
365-
# Ariadne
366-
ariadne-v0.20: ariadne~=0.20.0
367-
ariadne-latest: ariadne
368-
ariadne: fastapi
369-
ariadne: flask
370-
ariadne: httpx
371-
372348
# Arq
373349
arq-v0.23: arq~=0.23.0
374350
arq-v0.23: pydantic<2
@@ -495,18 +471,6 @@ deps =
495471
flask-v3: Flask~=3.0
496472
flask-latest: Flask
497473
498-
# GQL
499-
gql-v{3.4}: gql[all]~=3.4.0
500-
gql-latest: gql[all]
501-
502-
# Graphene
503-
graphene: blinker
504-
graphene: fastapi
505-
graphene: flask
506-
graphene: httpx
507-
graphene-v{3.3}: graphene~=3.3.0
508-
graphene-latest: graphene
509-
510474
# gRPC
511475
grpc: protobuf
512476
grpc: mypy-protobuf
@@ -731,14 +695,6 @@ deps =
731695
sqlalchemy-v2.0: sqlalchemy~=2.0.0
732696
sqlalchemy-latest: sqlalchemy
733697
734-
# Strawberry
735-
strawberry: fastapi
736-
strawberry: flask
737-
strawberry: httpx
738-
strawberry-v0.209: strawberry-graphql[fastapi,flask]~=0.209.0
739-
strawberry-v0.222: strawberry-graphql[fastapi,flask]~=0.222.0
740-
strawberry-latest: strawberry-graphql[fastapi,flask]
741-
742698
# Tornado
743699
# Tornado <6.4.1 is incompatible with Pytest ≥8.2
744700
# See https://github.com/tornadoweb/tornado/pull/3382.

tox.ini

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ envlist =
4343
{py3.8,py3.11,py3.12}-anthropic-v{0.16,0.28,0.40}
4444
{py3.7,py3.11,py3.12}-anthropic-latest
4545

46-
# Ariadne
47-
{py3.8,py3.11}-ariadne-v{0.20}
48-
{py3.8,py3.12,py3.13}-ariadne-latest
49-
5046
# Arq
5147
{py3.7,py3.11}-arq-v{0.23}
5248
{py3.7,py3.12,py3.13}-arq-latest
@@ -140,14 +136,6 @@ envlist =
140136
# GCP
141137
{py3.7}-gcp
142138

143-
# GQL
144-
{py3.7,py3.11}-gql-v{3.4}
145-
{py3.7,py3.12,py3.13}-gql-latest
146-
147-
# Graphene
148-
{py3.7,py3.11}-graphene-v{3.3}
149-
{py3.7,py3.12,py3.13}-graphene-latest
150-
151139
# gRPC
152140
{py3.7,py3.9}-grpc-v{1.39}
153141
{py3.7,py3.10}-grpc-v{1.49}
@@ -276,11 +264,6 @@ envlist =
276264
{py3.7,py3.11}-sqlalchemy-v{2.0}
277265
{py3.7,py3.12,py3.13}-sqlalchemy-latest
278266

279-
# Strawberry
280-
{py3.8,py3.11}-strawberry-v{0.209}
281-
{py3.8,py3.11,py3.12}-strawberry-v{0.222}
282-
{py3.8,py3.12,py3.13}-strawberry-latest
283-
284267
# Tornado
285268
{py3.8,py3.11,py3.12}-tornado-v{6.0}
286269
{py3.8,py3.11,py3.12}-tornado-v{6.2}
@@ -305,6 +288,24 @@ envlist =
305288
# These come from the populate_tox.py script. Eventually we should move all
306289
# integration tests there.
307290

291+
# ~~~ GraphQL ~~~
292+
{py3.8,py3.10,py3.11}-ariadne-v0.20.1
293+
{py3.8,py3.11,py3.12}-ariadne-v0.22
294+
{py3.8,py3.11,py3.12}-ariadne-v0.24.0
295+
{py3.8,py3.11,py3.12}-ariadne-v0.25.2
296+
297+
{py3.6,py3.9,py3.10}-gql-v3.4.1
298+
{py3.7,py3.11,py3.12}-gql-v3.5.0
299+
300+
{py3.6,py3.9,py3.10}-graphene-v3.3
301+
{py3.8,py3.12,py3.13}-graphene-v3.4.3
302+
303+
{py3.8,py3.10,py3.11}-strawberry-v0.209.8
304+
{py3.8,py3.11,py3.12}-strawberry-v0.226.2
305+
{py3.8,py3.11,py3.12}-strawberry-v0.243.1
306+
{py3.9,py3.12,py3.13}-strawberry-v0.259.0
307+
308+
308309

309310
[testenv]
310311
deps =
@@ -352,13 +353,6 @@ deps =
352353
anthropic-v0.40: anthropic~=0.40.0
353354
anthropic-latest: anthropic
354355

355-
# Ariadne
356-
ariadne-v0.20: ariadne~=0.20.0
357-
ariadne-latest: ariadne
358-
ariadne: fastapi
359-
ariadne: flask
360-
ariadne: httpx
361-
362356
# Arq
363357
arq-v0.23: arq~=0.23.0
364358
arq-v0.23: pydantic<2
@@ -485,18 +479,6 @@ deps =
485479
flask-v3: Flask~=3.0
486480
flask-latest: Flask
487481

488-
# GQL
489-
gql-v{3.4}: gql[all]~=3.4.0
490-
gql-latest: gql[all]
491-
492-
# Graphene
493-
graphene: blinker
494-
graphene: fastapi
495-
graphene: flask
496-
graphene: httpx
497-
graphene-v{3.3}: graphene~=3.3.0
498-
graphene-latest: graphene
499-
500482
# gRPC
501483
grpc: protobuf
502484
grpc: mypy-protobuf
@@ -721,14 +703,6 @@ deps =
721703
sqlalchemy-v2.0: sqlalchemy~=2.0.0
722704
sqlalchemy-latest: sqlalchemy
723705

724-
# Strawberry
725-
strawberry: fastapi
726-
strawberry: flask
727-
strawberry: httpx
728-
strawberry-v0.209: strawberry-graphql[fastapi,flask]~=0.209.0
729-
strawberry-v0.222: strawberry-graphql[fastapi,flask]~=0.222.0
730-
strawberry-latest: strawberry-graphql[fastapi,flask]
731-
732706
# Tornado
733707
# Tornado <6.4.1 is incompatible with Pytest ≥8.2
734708
# See https://github.com/tornadoweb/tornado/pull/3382.
@@ -754,6 +728,33 @@ deps =
754728
# These come from the populate_tox.py script. Eventually we should move all
755729
# integration tests there.
756730

731+
# ~~~ GraphQL ~~~
732+
ariadne-v0.20.1: ariadne==0.20.1
733+
ariadne-v0.22: ariadne==0.22
734+
ariadne-v0.24.0: ariadne==0.24.0
735+
ariadne-v0.25.2: ariadne==0.25.2
736+
ariadne: fastapi
737+
ariadne: flask
738+
ariadne: httpx
739+
740+
gql-v3.4.1: gql[all]==3.4.1
741+
gql-v3.5.0: gql[all]==3.5.0
742+
743+
graphene-v3.3: graphene==3.3
744+
graphene-v3.4.3: graphene==3.4.3
745+
graphene: blinker
746+
graphene: fastapi
747+
graphene: flask
748+
graphene: httpx
749+
py3.6-graphene: aiocontextvars
750+
751+
strawberry-v0.209.8: strawberry-graphql[fastapi,flask]==0.209.8
752+
strawberry-v0.226.2: strawberry-graphql[fastapi,flask]==0.226.2
753+
strawberry-v0.243.1: strawberry-graphql[fastapi,flask]==0.243.1
754+
strawberry-v0.259.0: strawberry-graphql[fastapi,flask]==0.259.0
755+
strawberry: httpx
756+
757+
757758

758759
setenv =
759760
PYTHONDONTWRITEBYTECODE=1

0 commit comments

Comments
 (0)