Repository navigation
227 lines (200 loc) · 8.25 KB
/
Copy pathdeploy.yml
File metadata and controls
227 lines (200 loc) · 8.25 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
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Always a uv-managed interpreter. Otherwise uv picks up whatever Python the
# runner has that matches .python-version - Homebrew's on macOS, which has no
# tkinter, links the system libedit and moves the stdlib behind a symlink.
env:
UV_PYTHON_PREFERENCE: only-managed
permissions:
contents: read
jobs:
# Everything that does not depend on the operating system runs once, here.
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "latest"
enable-cache: false
- name: Install dependencies
run: uv sync
- name: Lint
# `ruff check` and `ruff format` disagree about different things, and
# only the first was enforced -- four files had drifted unnoticed.
run: |
uv run ruff check .
uv run ruff format --check .
uv run zizmor --offline --quiet .github
- name: Type check
run: uv run pyright
- name: Build site
# Not a plain `mkdocs build`: that puts every locale in one tree
# sharing a single search index, which makes search cross-language.
# This builds each locale as its own self-contained site.
run: uv run python scripts/build_site.py
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: 'site'
include-hidden-files: true
# Everything except the stopwatch tests, on Linux, on every supported line.
# Those are correct but not reliable on a shared runner, and a mis-timed
# measurement is not a reason to stop publishing documentation -- three
# deploys were lost that way. They run in the `timing` job below, which does
# not gate the deploy. `make check` still runs the whole suite before a commit.
test-linux:
needs: checks
# A hang otherwise holds the runner for GitHub's six-hour default.
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Every supported line, at or above its CVE-2026-3276 fix release,
# so the timing job's normalization assertion runs on each version.
python: &supported-pythons ["3.11.18", "3.12.16", "3.13.18", "3.14.10", "3.15.2"]
env:
UV_PYTHON: ${{ matrix.python }}
# The runner lacks nothing the suite needs; see tests/conftest.py.
COMPLEXITY_MISSING_CAPABILITIES: ""
# The curses tests need a terminfo entry, and a job has no TERM.
TERM: xterm-256color
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
# An older pinned uv resolves against a build index predating the
# fix releases and cannot fetch the matrix entries.
version: "latest"
enable-cache: false
- name: Install Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest -m "not timing and not serial" -n auto --dist=loadfile
# Runs even when the parallel step fails, so every line reports both.
- name: Run serial tests
if: ${{ !cancelled() }}
run: uv run pytest -m "serial and not timing" -n 0
# The audit inventories the running interpreter, so an API a later
# release removed is checked only on the lines that still have it.
- name: Check documentation API coverage
if: ${{ !cancelled() }}
run: uv run python scripts/audit_documentation.py --check
# The same tests on the other operating systems, on the newest supported
# line. A test with no platform guard must pass on Linux, macOS and Windows,
# so a failure on any one of them fails the run.
test:
needs: checks
# A hang otherwise holds the runner for GitHub's six-hour default.
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
# Its interpreter has no C-library gettext, and links the system
# libedit, which lacks append_history.
- os: macos-latest
missing: "libintl readline-append-history"
# Hosted Windows runners have no sound card, the Windows C runtime
# has no C.UTF-8 locale, and the runner's token holds the restore
# privilege enabled.
- os: windows-latest
missing: "audio c-utf8-locale unprivileged-token"
runs-on: ${{ matrix.os }}
env:
# What this runner lacks. tests/conftest.py fails a skip for any other
# missing capability, because there it would hide a test that should run.
COMPLEXITY_MISSING_CAPABILITIES: ${{ matrix.missing }}
# The curses tests need a terminfo entry, and a job has no TERM.
TERM: xterm-256color
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "latest"
enable-cache: false
- name: Install dependencies
run: uv sync
# Everything except the stopwatch tests; see `test-linux`.
- name: Run tests
run: |
uv run pytest -m "not timing and not serial" -n auto --dist=loadfile
uv run pytest -m "serial and not timing" -n 0
# The stopwatch tests on every supported line. Reports, but deliberately
# does not gate: `deploy` does not need it. A red timing step means a
# complexity claim needs looking at -- check whether the measurement missed
# by a hair (noise) or by a wide margin (the claim).
timing:
# A hang otherwise holds the runner for GitHub's six-hour default.
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: *supported-pythons
env:
UV_PYTHON: ${{ matrix.python }}
# Makes the unpatched-interpreter skip a failure here, so a pin that drifts below a fix
# release cannot quietly put this job back to verifying nothing.
# Local runs still skip, and `make check` stays green off a patch.
COMPLEXITY_REQUIRE_PATCHED_PYTHON: "1"
# The runner lacks nothing the suite needs; see tests/conftest.py.
COMPLEXITY_MISSING_CAPABILITIES: ""
# The curses tests need a terminfo entry, and a job has no TERM.
TERM: xterm-256color
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
# An older pinned uv resolves against a build index predating the
# fix releases and cannot fetch the matrix entries.
version: "latest"
enable-cache: false
- name: Install Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}
- name: Install dependencies
run: uv sync
- name: Run timing tests
run: uv run pytest -m timing -n 0
deploy:
# Serialize publication without allowing a stuck deploy to suppress the
# build and timing checks for later pushes.
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
# Only the job that publishes gets to write Pages and mint an OIDC token.
permissions:
pages: write
id-token: write
needs: [checks, test-linux, test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1