-
Notifications
You must be signed in to change notification settings - Fork 5
300 lines (289 loc) · 8.56 KB
/
ci.yml
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
jobs:
Merge-Dependabot:
if: github.event_name == 'pull_request'
timeout-minutes: 1
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/[email protected]
with:
merge-method: merge
use-github-auto-merge: true
Verify:
name: 'Verify requirement pinning'
timeout-minutes: 2
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup python
uses: actions/[email protected]
with:
python-version: "3.13"
- name: Install requirements
run: |
python -m pip install -U pip
# Optimistically assume SHA checks won't change much
python -m pip install pip-compile-multi
- name: Verify requirements
run: pip-compile-multi verify
Blacken:
name: 'Formatting and linting'
timeout-minutes: 2
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup python
uses: actions/[email protected]
with:
cache: pip
cache-dependency-path: requirements/lint.txt
python-version: "3.13"
- name: Install requirements
run: |
python -m pip install -U pip
python -m pip install -r requirements/lint.txt
- name: Run Black
id: black
run: black --check --diff trio_parallel _trio_parallel_workers
continue-on-error: true
- name: Run flake8
id: flake8
run: |
flake8 --extend-ignore=D,E,W,F401,F403,F405,F821,F822,ASYNC114 \
--extend-select=ASYNC900,ASYNC910,ASYNC911
continue-on-error: true
- name: Fail on error
if: steps.black.outcome != 'success' || steps.flake8.outcome != 'success'
run: exit 1
Build:
name: Build
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
settings: ${{ steps.outputs.outputs.settings }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Build inspect and upload
id: baipp
uses: hynek/[email protected]
- name: Set outputs
id: outputs
run: |
echo "settings=$(
tar cz \
pyproject.toml \
requirements/install.txt \
requirements/test.txt \
| base64 -w 0
)" >> $GITHUB_OUTPUT
cd ${{ steps.baipp.outputs.dist }} && sha256sum *.* >> $GITHUB_STEP_SUMMARY
Test:
name: 'Test ${{ matrix.os }} (${{ matrix.python }})'
needs: Build
timeout-minutes: 10
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
experimental: [ false ]
test-timeout: [ 10 ]
os:
- windows-latest
- ubuntu-latest
- macos-latest
python: ${{ fromJson(needs.Build.outputs.python-versions) }}
include:
# pypy/linux is comparable to cpy/win
- os: ubuntu-latest
python: 'pypy-3.10'
experimental: false
test-timeout: 10
# - os: ubuntu-latest
# python: '3.13-dev'
# experimental: true
# test-timeout: 3
steps:
- name: Input settings
run: echo "${{ needs.Build.outputs.settings }}" | base64 -d | tar xz
shell: bash
- name: Setup python
uses: actions/[email protected]
with:
python-version: '${{ matrix.python }}'
- name: Setup and Cache UV
uses: hynek/[email protected]
with:
cache-suffix: '-${{ matrix.python }}'
cache-dependency-path: '**/requirements/test.txt'
- name: Download build artifact
uses: actions/[email protected]
with:
name: Packages
path: dist
- name: Install requirements
run: |
uv pip install --system -r requirements/test.txt
- name: Install wheel
shell: bash
run: |
uv pip install --system `echo ./dist/*.whl` --no-deps
- name: Run tests
timeout-minutes: ${{ matrix.test-timeout }}
run: |
pytest trio_parallel --cov-report xml:coverage-${{ matrix.os }}-${{ matrix.python }}.xml
coverage report
mv .coverage .coverage.${{ matrix.os }}-${{ matrix.python }}
shell: bash
- name: Upload coverage
if: always()
uses: actions/[email protected]
with:
name: Coverage-${{ matrix.os }}-${{ matrix.python }}
path: "*coverage*${{ matrix.os }}-${{ matrix.python }}*"
if-no-files-found: error
Examples:
name: 'Test examples ${{ matrix.os }} (${{ matrix.python }})'
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
python:
- '3.13'
- 'pypy-3.10'
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup python
uses: actions/[email protected]
with:
cache: pip
cache-dependency-path: requirements/test.txt
python-version: '${{ matrix.python }}'
- name: Install requirements
run: |
python -m pip install -U pip
python -m pip install -r requirements/test.txt
- name: Install editable source
run: |
python -m pip install -e . --no-deps
- name: Run tests
run: |
python -m pytest --no-cov docs/source
Extras:
name: 'Test [test] extra'
timeout-minutes: 5
runs-on: ubuntu-latest
needs: Build
steps:
- name: Setup python
uses: actions/[email protected]
with:
python-version: '3.13'
- name: Download build artifact
uses: actions/[email protected]
with:
name: Packages
path: dist
- name: Run tests
shell: bash
run: |
wheel=`echo ./dist/*.whl`
python -m pip install $wheel[test]
pytest --pyargs trio_parallel
Coverage:
name: Coverage
if: always()
needs: Test
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Download coverage artifact
uses: actions/[email protected]
with:
pattern: Coverage-*
merge-multiple: true
- name: Setup python
uses: actions/[email protected]
with:
cache: pip
cache-dependency-path: requirements/coverage.txt
python-version: "3.13"
- name: Install coverage
run: |
pip install -U pip
pip install -r requirements/coverage.txt
- name: Run coverage
run: |
coverage combine
coverage html
coverage report --fail-under=100 --show-missing --format markdown \
>> $GITHUB_STEP_SUMMARY
- name: Upload report
if: always()
uses: actions/[email protected]
with:
name: Report
path: htmlcov/
if-no-files-found: error
All:
name: All checks and tests
if: always()
timeout-minutes: 1
needs: [ Verify, Blacken, Build, Examples, Test, Extras, Coverage ]
runs-on: ubuntu-latest
steps:
- name: Check all needs have passed
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
Release:
name: Release on PyPI, Attest, and Update GitHub
if: github.event.action == 'published'
needs: All
timeout-minutes: 2
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/trio-parallel
permissions:
id-token: write
contents: write
steps:
- name: Download build artifact
uses: actions/[email protected]
with:
name: Packages
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
- name: Upload to GitHub
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref_name }} dist/* --repo ${{ github.repository }}