-
-
Notifications
You must be signed in to change notification settings - Fork 136
138 lines (124 loc) · 4.65 KB
/
contrib-tests.yml
File metadata and controls
138 lines (124 loc) · 4.65 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
name: CI / Contrib / Tests
on:
push:
pull_request:
types: [opened, synchronize]
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: 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"]
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: .venv
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
run: poetry install --all-extras
- name: Install framework variant
if: matrix.target.spec != ''
run: poetry run pip install "${{ matrix.target.contrib }}${{ matrix.target.spec }}"
- 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 }}