Repository navigation
369 lines (351 loc) · 11.6 KB
/
Copy pathtest.yml
File metadata and controls
369 lines (351 loc) · 11.6 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint-and-type:
name: Lint and type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.10"
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Run fix checks
run: tox -e fix
- name: Run type checks
run: tox -e type
cli-docs:
name: CLI docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check CLI docs
run: tox -e cli-docs -- --check
- name: Rename coverage file
run: |
import os
import pathlib
target = pathlib.Path(".tox") / ".coverage.cli-docs-ubuntu-latest"
os.replace(pathlib.Path(".tox") / ".coverage.cli-docs", target)
shell: python
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
include-hidden-files: true
name: coverage-cli-docs-ubuntu-latest
path: .tox/.coverage.*
retention-days: 3
readme:
name: README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check README help snapshots
run: tox run -vv --skip-missing-interpreters false -e readme
env:
UV_PYTHON_PREFERENCE: "only-managed"
llms-txt:
name: llms.txt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check llms.txt artifacts
run: tox -e llms-txt -- --check
schema-docs:
name: Schema docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check supported formats docs
run: tox -e schema-docs -- --check
config-types:
name: Config types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Build generated config types
run: tox -e config-types
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Build docs
run: tox -e docs
test:
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
tox-env: py310-parallel
- os: ubuntu-latest
python-version: "3.11"
tox-env: py311-parallel
- os: ubuntu-latest
python-version: "3.12"
tox-env: py312-parallel
- os: ubuntu-latest
python-version: "3.13"
tox-env: py313-parallel
- os: ubuntu-latest
python-version: "3.14"
tox-env: py314-parallel
- os: windows-latest
python-version: "3.10"
tox-env: py310-parallel
- os: windows-latest
python-version: "3.11"
tox-env: py311-parallel
- os: windows-latest
python-version: "3.12"
tox-env: py312-parallel
- os: windows-latest
python-version: "3.13"
tox-env: py313-parallel
- os: windows-latest
python-version: "3.14"
tox-env: py314-parallel
- os: macos-latest
python-version: "3.10"
tox-env: py310-parallel
- os: macos-latest
python-version: "3.11"
tox-env: py311-parallel
- os: macos-latest
python-version: "3.12"
tox-env: py312-parallel
- os: macos-latest
python-version: "3.13"
tox-env: py313-parallel
- os: macos-latest
python-version: "3.14"
tox-env: py314-parallel
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Run tests
run: tox -e ${{ matrix.tox-env }}
- name: Rename coverage file
run: |
import os
import pathlib
env_name = "${{ matrix.tox-env }}"
target = pathlib.Path(".tox") / f".coverage.{env_name}-${{ matrix.os }}"
os.replace(pathlib.Path(".tox") / f".coverage.{env_name}", target)
shell: python
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
include-hidden-files: true
name: coverage-${{ matrix.tox-env }}-${{ matrix.os }}
path: .tox/.coverage.*
retention-days: 3
coverage:
name: Coverage
runs-on: ubuntu-latest
needs:
- test
- cli-docs
- readme
- llms-txt
- schema-docs
- config-types
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Setup coverage environment
run: tox -e coverage --notest
- name: Download coverage artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: .tox
pattern: coverage-*
merge-multiple: true
- name: Combine and report coverage
id: coverage
run: tox -e coverage --skip-pkg-install
continue-on-error: true
- name: Upload HTML coverage report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: htmlcov
path: .tox/htmlcov
- name: Upload coverage to Codecov
if: steps.coverage.outcome == 'success'
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
with:
files: .tox/coverage.xml
flags: unittests
fail_ci_if_error: true
use_pypi: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Fail if coverage check failed
if: steps.coverage.outcome == 'failure'
run: exit 1
package:
name: Package metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Validate package artifacts
run: tox -e pkg_meta
install:
name: Install on Python 3.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.10"
- name: Install package
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .
- name: Validate installed package
run: |
python -m pip check
fastapi-codegen --help
check:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
needs:
- lint-and-type
- cli-docs
- readme
- llms-txt
- schema-docs
- config-types
- docs
- test
- coverage
- package
- install
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}