-
-
Notifications
You must be signed in to change notification settings - Fork 561
273 lines (239 loc) · 9.18 KB
/
Copy pathtest.yml
File metadata and controls
273 lines (239 loc) · 9.18 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
name: test
on:
push:
branches:
- master
# Renovate "automerge" branches -- there is no PR, so branch tests are used instead
- "renovate/lock-file-maintenance"
pull_request:
workflow_dispatch:
env:
UV_FROZEN: true # https://docs.astral.sh/uv/configuration/environment/#uv_frozen
UV_NO_SYNC: true # prevent `uv run` cmd from bringing very dev dependencies
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mypy-self-check:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run mypy on plugin code
run: uv run mypy mypy_django_plugin
- name: Run mypy on ext code
run: uv run mypy ext
- name: Run mypy on scripts and utils
run: uv run mypy scripts
- name: Run mypy on stubs
run: uv run mypy --cache-dir=/dev/null --no-incremental django-stubs
- name: Run mypy on the test cases
run: uv run mypy tests
test:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Cache apt packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: /var/cache/apt/archives
key: apt-gdal-${{ runner.os }}
- name: Setup system dependencies
run: |
sudo apt-get update || true
sudo apt-get install -y --no-install-recommends libgdal-dev libproj-dev
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
# Must match `shard` definition in the test matrix:
- name: Run pytest tests
run: uv run pytest --num-shards=4 --shard-id=${{ matrix.shard }} -n auto tests
test-older-django:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Cache apt packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: /var/cache/apt/archives
key: apt-gdal-${{ runner.os }}
- name: Setup system dependencies
run: |
sudo apt-get update || true
sudo apt-get install -y --no-install-recommends libgdal-dev libproj-dev
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.10'
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Downgrade Django
run: uv pip install django==5.0.0
# Exit 1 only if ont of the pytest error is a mypy crash
- name: Run pytest tests
run: "! uv run pytest --num-shards=4 --shard-id=${{ matrix.shard }} -n auto tests | grep 'pytest_mypy_plugins.utils.TypecheckAssertionError: Critical error occurred'"
stubtest:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Cache apt packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: /var/cache/apt/archives
key: apt-gdal-${{ runner.os }}
- name: Setup system dependencies
run: |
sudo apt-get update || true
sudo apt-get install -y --no-install-recommends libgdal-dev libproj-dev
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run stubtest
run: uv run ./scripts/stubtest.sh
run-pyright:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12'] # TODO: enable on other versions
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group pyright
# See https://github.com/jakebailey/pyright-action#providing-a-pyright-version-sourced-from-preexisting-dependencies
- name: Add venv to path
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run pyright on the test cases
uses: jakebailey/pyright-action@8ec14b5cfe41f26e5f41686a31eb6012758217ef # v3
with:
version: PATH
run-pyrefly:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group pyrefly
- name: Add venv to path
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run pyrefly on the test cases
run: pyrefly check tests/assert_type
run-ty:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
fail-fast: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group ty
- name: Add venv to path
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run ty on the test cases
run: ty check tests/assert_type
matrix-test:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
django-version: ['5.0', '5.1', '5.2']
include:
- python-version: '3.12'
django-version: '6.0'
- python-version: '3.13'
django-version: '6.0'
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run django-stubs-ext tests
run: uv run --with "django==${{ matrix.django-version }}" pytest ext
build-and-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-tags: true
- name: Install uv & Python
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: "3.13"
- name: Ensure uv.lock is up to date
run: env --unset=UV_FROZEN uv lock --check
- name: Build
run: uv build --all-packages