-
-
Notifications
You must be signed in to change notification settings - Fork 1
344 lines (291 loc) 路 10.9 KB
/
Copy pathtests.yml
File metadata and controls
344 lines (291 loc) 路 10.9 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
name: Run Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.event_name == 'workflow_dispatch' && github.run_id || github.ref }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}
jobs:
precheck:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Setup venv and install pip dependencies
run: |
uv venv --python "3.12" \
&& uv sync --all-extras --all-groups --no-cache
- name: Run pre-commit checks
run: uv run prek run --all-files
- name: Run documentation code blocks
run: uv run pytest -vv --tb=long -m "not live_required" README.md django_example_project/README.md AGENTS.md skills docs
live-documentation:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Setup venv and install pip dependencies
run: |
uv venv --python "3.12"
uv sync --all-extras --all-groups --no-cache
- name: Run live documentation code blocks
run: uv run pytest -vv --tb=long -m live_required README.md django_example_project/README.md AGENTS.md skills docs
discover-standard-tests:
runs-on: ubuntu-24.04
timeout-minutes: 20
outputs:
test-shards: ${{ steps.set-matrix.outputs.test-shards }}
playwright-test: ${{ steps.set-matrix.outputs.playwright-test }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: false
- name: Discover and shard standard test files
id: set-matrix
run: uv run --no-project python .github/ci_standard_test_shards.py >> "$GITHUB_OUTPUT"
build:
name: ${{ matrix.target.os_name }} py${{ matrix.target.python_version }} ${{ matrix.shard.name }}
needs: discover-standard-tests
runs-on: ${{ matrix.target.os }}
timeout-minutes: 20
strategy:
fail-fast: false
max-parallel: 20
matrix:
target:
- os: ubuntu-24.04
os_name: linux
python_version: '3.12.13'
- os: ubuntu-24.04
os_name: linux
python_version: '3.13.14'
- os: ubuntu-24.04
os_name: linux
python_version: '3.14.6'
- os: macOS-15
os_name: macOS
python_version: '3.12.10'
- os: macOS-15
os_name: macOS
python_version: '3.13.13'
- os: macOS-15
os_name: macOS
python_version: '3.14.6'
shard: ${{ fromJson(needs.discover-standard-tests.outputs.test-shards) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.target.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Setup venv and install pip dependencies
run: |
uv venv --python "${{ matrix.target.python_version }}"
uv sync --all-extras
- name: Run standard test shard
env:
TEST_PATHS_JSON: ${{ toJson(matrix.shard.paths) }}
run: |
test_paths=()
while IFS= read -r test_path; do
[[ -z "$test_path" ]] || test_paths+=("$test_path")
done < <(uv run --no-project python -c 'import json, os; print(*json.loads(os.environ["TEST_PATHS_JSON"]), sep="\n")')
uv run pytest -vv --tb=long -m "not root_required and not docker_required" "${test_paths[@]}"
playwright:
name: ${{ matrix.target.os_name }} py${{ matrix.target.python_version }} playwrightprovider
needs: discover-standard-tests
runs-on: ${{ matrix.target.os }}
timeout-minutes: 20
strategy:
fail-fast: false
max-parallel: 1
matrix:
target:
- os: ubuntu-24.04
os_name: linux
python_version: '3.12.13'
- os: ubuntu-24.04
os_name: linux
python_version: '3.13.14'
- os: ubuntu-24.04
os_name: linux
python_version: '3.14.6'
- os: macOS-15
os_name: macOS
python_version: '3.12.10'
- os: macOS-15
os_name: macOS
python_version: '3.13.13'
- os: macOS-15
os_name: macOS
python_version: '3.14.6'
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.target.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Setup venv and install pip dependencies
run: |
uv venv --python "${{ matrix.target.python_version }}"
uv sync --all-extras
- name: Run Playwright provider tests
run: uv run pytest -vv --tb=long -m "not root_required and not docker_required" "${{ needs.discover-standard-tests.outputs.playwright-test }}"
discover-live-tests:
runs-on: ubuntu-24.04
timeout-minutes: 20
outputs:
live-tests: ${{ steps.set-matrix.outputs.live-tests }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Discover live integration test files
id: set-matrix
run: |
json_array="["
first=true
for test_file in $(find tests -maxdepth 1 -name 'test_*.py' -type f | sort); do
if ! grep -Eq '@pytest\.mark\.(root_required|docker_required)' "$test_file"; then
continue
fi
test_name=$(basename "$test_file" .py | sed 's/^test_//')
needs_docker=false
if grep -q "@pytest.mark.docker_required" "$test_file"; then
needs_docker=true
fi
os_targets="linux"
for os_target in $os_targets; do
if [ "$os_target" = "linux" ]; then
os_json='"ubuntu-24.04"'
else
os_json='"macOS-15"'
fi
for python_version in 3.12.13 3.13.14 3.14.6; do
entry="{\"name\":\"${test_name}-${os_target}\",\"path\":\"$test_file\",\"os\":${os_json},\"os_name\":\"${os_target}\",\"python_version\":\"${python_version}\",\"needs_docker\":$needs_docker}"
if [ "$first" = true ]; then first=false; else json_array+=","; fi
json_array+="$entry"
done
done
done
json_array+="]"
if [ "$first" = true ]; then
echo "No root_required or docker_required test files were discovered" >&2
exit 1
fi
echo "live-tests=$json_array" >> "$GITHUB_OUTPUT"
echo "$json_array"
live-integration:
name: ${{ matrix.live.name }} py${{ matrix.live.python_version }}
needs: discover-live-tests
runs-on: ${{ matrix.live.os }}
timeout-minutes: 20
if: ${{ needs.discover-live-tests.outputs.live-tests != '[]' }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
live: ${{ fromJson(needs.discover-live-tests.outputs.live-tests) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.live.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Setup venv and install pip dependencies
run: |
uv venv --python "${{ matrix.live.python_version }}"
uv sync --all-extras
- name: Run every privileged provider test
run: uv run pytest -vv --tb=long -m "root_required or docker_required" "${{ matrix.live.path }}"
package:
needs:
- precheck
- live-documentation
- build
- playwright
- live-integration
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "0.10.6"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Build and validate distributions
run: |
uv build --out-dir dist
uv publish --dry-run --trusted-publishing never dist/*.whl dist/*.tar.gz
uv run --no-project python - <<'PY' > dist/SHA256SUMS
from hashlib import sha256
from pathlib import Path
dist = Path("dist")
artifacts = sorted((*dist.glob("*.whl"), *dist.glob("*.tar.gz")))
if len(list(dist.glob("*.whl"))) != 1 or len(list(dist.glob("*.tar.gz"))) != 1:
raise SystemExit(f"Expected one wheel and one sdist, found: {artifacts}")
for artifact in artifacts:
print(f"{sha256(artifact.read_bytes()).hexdigest()} {artifact.name}")
PY
- name: Upload tested distributions
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: abxpkg-dist-${{ github.sha }}
path: |
dist/*.whl
dist/*.tar.gz
dist/SHA256SUMS
if-no-files-found: error
retention-days: 90