-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (268 loc) · 8.78 KB
/
push-poetry.yaml
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
# Run this workflow to test Python code changes.
name: 🎨 poetry (push)
on:
push:
branches: [main]
tags: [v*]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/poetry
with:
command: lint
groups: main,build,test,lint
test:
strategy:
matrix:
py: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cargo
with:
command: install dicom-storescp
- uses: ./.github/actions/poetry
with:
command: test --error-for-skips
groups: main,build,test
python-version: ${{ matrix.py }}
- if: always()
name: Upload coverage reports to codecov.io
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
check:
outputs:
release: ${{ steps.check.outputs.release }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/poetry
with:
artifacts: ""
command: check-for-prerelease
- id: check
run: printf 'release=%s\n' "$(cat check-for-prerelease.out)"
release:
if: needs.check.outputs.release == 'true'
needs:
- lint
- test
- check
outputs:
new: ${{ steps.semantic-release.outputs.released }}
version: ${{ steps.semantic-release.outputs.version }}
permissions:
id-token: write
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- id: semantic-release
uses: python-semantic-release/[email protected]
with:
commit: false
github_token: ${{ github.token }}
prerelease: true
root_options: --strict -vv
docs:
if: needs.check.outputs.release != 'true'
needs:
- lint
- test
- check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/download-artifact@v4
with:
name: lint-docs-py3.12
path: docs
- uses: actions/download-artifact@v4
with:
name: test-docs-py3.12
path: docs
- uses: ./.github/actions/poetry
with: { artifacts: "", command: setup-versioning }
- uses: ./.github/actions/poetry
with: { artifacts: "", command: dynamic-versioning }
- uses: ./.github/actions/poetry
with:
artifacts: ""
command: docs
- name: Fix permissions
run: |
chmod -c -R +rX "docs/" | while read -r line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: docs
deploy:
if: needs.check.outputs.release != 'true'
environment:
name: GitHub Pages
url: ${{ steps.deploy.outputs.page_url }}
needs:
- check
- docs
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- id: deploy
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
build:
# ref: https://github.com/pydantic/pydantic-core/blob/ba8eab4acba8ad04c45f27a58a5d001c8f212361/.github/workflows/ci.yml#L395-L499
env:
INTERPRETER: ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }}
MANY_LINUX: ${{ contains('linux', matrix.os) && ( matrix.manylinux || 'auto' ) || null }}
OS: ${{ matrix.os || 'linux' }}
name: build ${{ matrix.os }} ${{ matrix.manylinux }} ${{ matrix.target }}
runs-on: ${{ contains('linux', matrix.os) && 'ubuntu' || matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [macos, linux] # default: linux
manylinux: [auto, musllinux_1_1, musllinux_1_2] # default: 'auto' if linux, or 'null' otherwise
python-architecture: [x64] # default: 'x64'
target: [x86_64, aarch64]
# prettier-ignore
exclude:
- { os: macos, manylinux: musllinux_1_1 }
- { os: macos, manylinux: musllinux_1_2 }
- { os: windows, target: aarch64 }
# prettier-ignore
include:
# manylinux for various platforms
- { os: linux, target: i686 }
- { os: linux, target: armv7, interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 }
- { os: linux, target: ppc64le, interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 }
- { os: linux, target: s390x, interpreter: 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 }
# windows
# TODO: build py3.13
- { os: windows, target: i686, interpreter: 3.8 3.9 3.10 3.11 3.12, python-architecture: x86 }
- { os: windows, target: x86, interpreter: 3.8 3.9 3.10 3.11 3.12, python-architecture: x86 }
- { os: windows, target: x86_64, interpreter: 3.8 3.9 3.10 3.11 3.12 }
- { os: windows, target: x64, interpreter: 3.8 3.9 3.10 3.11 3.12 }
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: ./.github/actions/poetry
with: { artifacts: "", command: setup-versioning, groups: build }
- uses: ./.github/actions/poetry
with: { artifacts: "", command: dynamic-versioning, groups: build }
- uses: PyO3/maturin-action@v1
with:
args: --release --out dist --interpreter ${{ env.INTERPRETER }}
manylinux: ${{ env.MANY_LINUX }}
rust-toolchain: stable
sccache: "true"
target: ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: build-${{ env.OS }}-${{ env.MANY_LINUX }}-${{ matrix.target }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: ./.github/actions/poetry
with: { artifacts: "", command: setup-versioning, groups: build }
- uses: ./.github/actions/poetry
with: { artifacts: "", command: dynamic-versioning, groups: build }
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v4
with:
name: build-sdist
path: dist
upload-assets:
if: github.ref_type == 'tag'
needs: [build, docs, sdist]
permissions:
attestations: write
contents: write
id-token: write
packages: read
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: build-*
merge-multiple: true
- id: attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/*
- env:
GH_TOKEN: ${{ github.token }}
run: gh release upload --repo ${{ github.repository }} ${{ github.ref_name }} dist/* ${{ steps.attestation.outputs.bundle-path }}
test-pypi:
environment:
name: test.pypi.org
url: https://test.pypi.org/p/dicom-echo
if: github.ref_type == 'tag'
needs:
- check
- lint
- test
- build
- sdist
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: build-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
pypi:
environment:
name: pypi.org
url: https://pypi.org/p/dicom-echo
if: github.ref_type == 'tag'
needs:
- test-pypi
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: build-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1