-
-
Notifications
You must be signed in to change notification settings - Fork 136
174 lines (160 loc) · 6.02 KB
/
contrib-tests.yml
File metadata and controls
174 lines (160 loc) · 6.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI / Contrib / Tests
on:
push:
paths:
- openapi_core/**
- tests/integration/contrib/**
- tests/unit/contrib/**
- tests/integration/conftest.py
- tests/integration/data/**
- pyproject.toml
- poetry.lock
- .github/workflows/contrib-tests.yml
pull_request:
types: [opened, synchronize]
paths:
- openapi_core/**
- tests/integration/contrib/**
- tests/unit/contrib/**
- tests/integration/conftest.py
- tests/integration/data/**
- pyproject.toml
- poetry.lock
- .github/workflows/contrib-tests.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
id-token: write
jobs:
contrib_matrix:
name: "${{ matrix.target.label }} / py${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
matrix:
target:
- contrib: aiohttp
integration_path: tests/integration/contrib/aiohttp
unit_path: tests/unit/contrib/aiohttp
spec: ">=3.8,<4.0"
label: "aiohttp-3.x"
- contrib: aiohttp
integration_path: tests/integration/contrib/aiohttp
unit_path: tests/unit/contrib/aiohttp
spec: ">=3.11,<4.0"
label: "aiohttp-3.11+"
- contrib: django
integration_path: tests/integration/contrib/django
unit_path: tests/unit/contrib/django
spec: ">=4.0,<5.0"
label: "django-4.x"
- contrib: django
integration_path: tests/integration/contrib/django
unit_path: tests/unit/contrib/django
spec: ">=5.0,<6.0"
label: "django-5.x"
- contrib: django
integration_path: tests/integration/contrib/django
unit_path: tests/unit/contrib/django
spec: ">=6.0,<7.0"
label: "django-6.x"
- contrib: falcon
integration_path: tests/integration/contrib/falcon
spec: ">=4.0,<5.0"
label: "falcon-4.x"
- contrib: fastapi
integration_path: tests/integration/contrib/fastapi
spec: ">=0.111,<0.120"
label: "fastapi-0.11x"
- contrib: fastapi
integration_path: tests/integration/contrib/fastapi
spec: ">=0.120,<0.129"
label: "fastapi-0.12x"
- contrib: flask
integration_path: tests/integration/contrib/flask
unit_path: tests/unit/contrib/flask
spec: ">=2.0,<3.0"
label: "flask-2.x"
- contrib: flask
integration_path: tests/integration/contrib/flask
unit_path: tests/unit/contrib/flask
spec: ">=3.0,<4.0"
label: "flask-3.x"
- contrib: requests
integration_path: tests/integration/contrib/requests
unit_path: tests/unit/contrib/requests
spec: ""
label: "requests-default"
- contrib: starlette
integration_path: tests/integration/contrib/starlette
spec: ">=0.40.0,<0.50.0"
label: "starlette-0.4x"
- contrib: starlette
integration_path: tests/integration/contrib/starlette
spec: ">=0.50.0,<0.60.0"
label: "starlette-0.5x"
- contrib: werkzeug
integration_path: tests/integration/contrib/werkzeug
spec: ""
label: "werkzeug-default"
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
exclude:
- target:
label: "django-6.x"
python-version: "3.10"
- target:
label: "django-6.x"
python-version: "3.11"
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Get full Python version
id: full-python-version
run: python -c "import sys; print(f\"version={'-'.join(str(v) for v in sys.version_info)}\")" >> "$GITHUB_OUTPUT"
- name: Set up poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: "2.3.1"
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v5
id: cache
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: deps-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ matrix.target.label }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ matrix.target.label }}-
deps-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
run: poetry install --extras "${{ matrix.target.contrib }}"
- name: Install framework variant
if: matrix.target.spec != ''
run: poetry run pip install --upgrade --force-reinstall --no-cache-dir "${{ matrix.target.contrib }}${{ matrix.target.spec }}"
- name: Validate environment
run: |
poetry run python -m pip check
poetry run python -c "import importlib; name='${{ matrix.target.contrib }}'; mod = importlib.import_module(name); print(name, getattr(mod, '__version__', 'unknown'))"
- name: Test
shell: bash
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
paths=("${{ matrix.target.integration_path }}")
unit_path="${{ matrix.target.unit_path }}"
if [ -d "$unit_path" ]; then
paths+=("$unit_path")
fi
poetry run pytest "${paths[@]}"
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
flags: contrib,${{ matrix.target.contrib }},${{ matrix.target.label }},py${{ matrix.python-version }}
name: contrib-${{ matrix.target.contrib }}-${{ matrix.target.label }}-py${{ matrix.python-version }}