-
Notifications
You must be signed in to change notification settings - Fork 1
415 lines (374 loc) · 14.2 KB
/
cd.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
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
name: CD
on:
workflow_dispatch:
release:
types:
- published
schedule:
- cron: "0 0 * * 1"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
CIBW_BUILD_FRONTEND: "build"
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "pp* *musllinux*"
jobs:
sdist:
name: sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: Build source distribution
run: pipx run build --sdist --outdir dist/
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: source_distribution
path: dist
if-no-files-found: error
windows_amd64_wheels:
name: amd64-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23.5"
cache: false
- name: Install MinGW compiler(s)
run: choco install mingw
- uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_WINDOWS: AMD64
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_windows_amd64
path: ./wheelhouse/*.whl
if-no-files-found: error
windows_arm64_wheels: # Not tested
name: arm64-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23.5"
cache: false
check-latest: true
- uses: mlugg/setup-zig@a67e68dc5c8281d9608136d3d7ca1b282213e4ac # v1.2.1
with:
version: 0.13.0
use-cache: false
- name: Build binary distribution (wheel) on Windows (arm64)
# We need to use cibuildwheel because it has experimental support for cross-compiling
# to arm64 and setup-python does not have arm64 support on Windows right now
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for arm64 target via Zig toolchain
env:
USE_ZIG: "1"
GOOS: windows
GOARCH: arm64
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: ARM64
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_SKIP: "*-win_arm64"
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_windows_arm64
path: ./wheelhouse/*.whl
if-no-files-found: error
windows_i686_wheels:
name: i686-windows
runs-on: windows-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23.5"
cache: false
- uses: mlugg/setup-zig@a67e68dc5c8281d9608136d3d7ca1b282213e4ac # v1.2.1
with:
version: 0.13.0
# Note: cibuildwheel will manage installing 32-bit Python on Windows. We
# do not need to do that manually unless we use setup-python instead.
- name: Build binary distribution (wheel) on Windows (i686)
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
# Cross-compile for i686 target via Zig toolchain
env:
USE_ZIG: "1"
GOOS: windows
GOARCH: 386
CIBW_BUILD: "cp312-*"
CIBW_ARCHS_WINDOWS: x86
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_windows_i686
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_amd64_wheels:
name: amd64-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.5.linux-amd64.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_linux_amd64
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_arm64_wheels:
name: arm64-manylinux
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.5.linux-arm64.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_linux_aarch64
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_s390x_wheels:
name: s390x-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
# This should be temporary
# xref https://github.com/docker/setup-qemu-action/issues/188
# xref https://github.com/tonistiigi/binfmt/issues/215
image: tonistiigi/binfmt:qemu-v8.1.5
- name: Build binary distribution (wheel) on Linux (s390x)
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: s390x
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.4.linux-s390x.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_linux_s390x
path: ./wheelhouse/*.whl
if-no-files-found: error
linux_ppc64le_wheels:
name: ppc64le-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
# This should be temporary
# xref https://github.com/docker/setup-qemu-action/issues/188
# xref https://github.com/tonistiigi/binfmt/issues/215
image: tonistiigi/binfmt:qemu-v8.1.5
- name: Build binary distribution (wheel) on Linux (ppc64le)
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_BEFORE_ALL_LINUX: |
tarball="go1.23.4.linux-ppc64le.tar.gz"
curl -LJO https://golang.org/dl/$tarball
mkdir $HOME/go_installed/
tar -C $HOME/go_installed/ -xzf $tarball
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bashrc
export PATH=$PATH:$HOME/go_installed/go/bin >> ~/.bash_profile
go version
CIBW_ENVIRONMENT_LINUX: PATH=$PATH:$HOME/go_installed/go/bin
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_linux_ppc64le
path: ./wheelhouse/*.whl
if-no-files-found: error
macos_amd64_wheels:
name: amd64-macos
runs-on: macos-13
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23.5"
cache: false
check-latest: true
- uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: x86_64
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_macos_x86_64
path: ./wheelhouse/*.whl
if-no-files-found: error
macos_arm64_wheels:
name: arm64-macos
runs-on: macos-14
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23.5"
cache: false
check-latest: true
- uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: .
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: arm64
CIBW_TEST_COMMAND: |
hugo version
hugo env --logLevel debug
- name: Upload wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wheels_macos_arm64
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
needs:
[
sdist,
windows_amd64_wheels,
windows_arm64_wheels,
windows_i686_wheels,
macos_amd64_wheels,
macos_arm64_wheels,
linux_amd64_wheels,
linux_arm64_wheels,
linux_s390x_wheels,
linux_ppc64le_wheels,
]
name: Publish to PyPI or TestPyPI
environment: release
permissions:
# Required by OIDC to publish to PyPI and by Sigstore to sign artifacts
id-token: write
# Required to upload artifacts to a GitHub release identifier
contents: write
# For GHA Attestations
attestations: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download all artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: upload/
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
if: github.event_name == 'release' && github.event.action == 'published'
with:
# Comment this line out to publish to PyPI
# repository-url: https://test.pypi.org/legacy/
packages-dir: upload
- name: Sign artifacts with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
with:
inputs: >-
./upload/*.whl
./upload/*.tar.gz
- name: Generate artifact attestation(s)
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: |
upload/*.whl
upload/*.tar.gz
- name: Publish to GitHub Releases
# Wait for https://github.com/softprops/action-gh-release/issues/556 to be resolved
# before bumping to v2.2.0.
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
if: github.event_name == 'release' && github.event.action == 'published'
with:
# This will contain not only the wheel and sdist, but also the signature files
# generated by the Sigstore action
files: upload/*