-
Notifications
You must be signed in to change notification settings - Fork 0
347 lines (298 loc) · 9.82 KB
/
wheels.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
# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT
name: Build wheels
on:
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "utils/devel/stubgen.py"
- "CMakeLists.txt"
- "conanfile.py"
- "pyproject.toml"
tags:
- "v*.*.*"
pull_request:
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "utils/devel/stubgen.py"
- "CMakeLists.txt"
- "conanfile.py"
- "pyproject.toml"
release:
types:
- published
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
matrix-factory:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-result.outputs.matrix }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install cibuildwheel
run: pip install 'cibuildwheel>=2.21'
- name: Generate matrix
id: set-result
run: |
CIBW_ARCHS_LINUX=x86_64 cibuildwheel \
--print-build-identifiers \
--platform linux |
jq -nRc '{"wheel-config": inputs, "os": "ubuntu-latest", "arch": "x86_64"}' |
tee configs.json
if [ '${{ github.event_name }}' != 'pull_request' ]; then
CIBW_ARCHS_LINUX=aarch64 cibuildwheel \
--print-build-identifiers \
--platform linux |
jq -nRc '{"wheel-config": inputs, "os": "ubuntu-latest", "arch": "aarch64"}' |
tee -a configs.json
fi
CIBW_ARCHS_MACOS=x86_64 cibuildwheel \
--print-build-identifiers \
--platform macos |
jq -nRc '{"wheel-config": inputs, "os": "macos-13", "arch": "x86_64"}' |
tee -a configs.json
CIBW_ARCHS_MACOS=arm64 cibuildwheel \
--print-build-identifiers \
--platform macos |
jq -nRc '{"wheel-config": inputs, "os": "macos-14", "arch": "arm64"}' |
tee -a configs.json
CIBW_ARCHS_WINDOWS=AMD64 cibuildwheel \
--print-build-identifiers \
--platform windows |
jq -nRc '{"wheel-config": inputs, "os": "windows-2019", "arch": "AMD64"}' |
tee -a configs.json
MATRIX="$(jq -sc < configs.json)"
echo "matrix={\"include\": $MATRIX }" | tee -a "$GITHUB_OUTPUT"
build-conan-deps-linux-x86:
name: Build Conan deps (Linux x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: x86_64
os: manylinux_2_28
build-conan-deps-linux-arm64:
name: Build Conan deps (Linux arm64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: aarch64
os: manylinux_2_28
build-conan-deps-macos-x86:
name: Build Conan deps (macOS x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: x86_64
os: macos-13
build-conan-deps-macos-arm64:
name: Build Conan deps (macOS arm64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: arm64
os: macos-14
build-conan-deps-windows-x86:
name: Build Conan deps (Windows x86_64)
uses: paulsengroup/hictkpy/.github/workflows/build-conan-deps.yml@main
with:
arch: AMD64
os: windows-2019
build-sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
build-wheels:
name: Build Wheels
needs:
- matrix-factory
- build-conan-deps-linux-x86
- build-conan-deps-linux-arm64
- build-conan-deps-macos-x86
- build-conan-deps-macos-arm64
- build-conan-deps-windows-x86
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-factory.outputs.matrix) }}
env:
CONAN_HOME: "${{ github.workspace }}/.conan2"
HICTKPY_CONAN_INSTALL_ARGS: "--settings=compiler.cppstd=17;--settings=build_type=Release;--build=never;--options=*/*:shared=False"
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Restore Conan cache (Linux; x86_64)
if: startsWith(matrix.os, 'ubuntu') && matrix.arch == 'x86_64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-linux-x86.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (Linux; aarch64)
if: |
github.event_name != 'pull_request' &&
startsWith(matrix.os, 'ubuntu') &&
matrix.arch == 'aarch64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-linux-arm64.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (macOS; x86_64)
if: startsWith(matrix.os, 'macos') && matrix.arch == 'x86_64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-macos-x86.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (macOS; aarch64)
if: startsWith(matrix.os, 'macos') && matrix.arch == 'arm64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-macos-arm64.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore Conan cache (Windows; AMD64)
if: startsWith(matrix.os, 'windows') && matrix.arch == 'AMD64'
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps-windows-x86.outputs.conan-key }}
path: ${{ needs.build-conan-deps-windows-x86.outputs.conan-home }}\p
fail-on-cache-miss: true
- name: Build wheels
uses: pypa/[email protected]
with:
only: ${{ matrix.wheel-config }}
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT_LINUX: >
PIP_VERBOSE=1
HICTK_CI=1
CONAN_HOME='/host${{ env.CONAN_HOME }}'
CIBW_ENVIRONMENT_MACOS: >
CC=clang
CXX=clang++
PIP_VERBOSE=1
HICTK_CI=1
MACOSX_DEPLOYMENT_TARGET=10.15
HICTKPY_CONAN_INSTALL_ARGS="${{ env.HICTKPY_CONAN_INSTALL_ARGS }};-s:h os.version=${{ env.MACOSX_DEPLOYMENT_TARGET }}"
CIBW_ENVIRONMENT_WINDOWS: >
PIP_VERBOSE=1
HICTK_CI=1
CIBW_ENVIRONMENT_PASS_LINUX: >
CONAN_HOME
HICTKPY_CONAN_INSTALL_ARGS
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
- name: Verify clean directory
run: git diff --exit-code
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: "wheels-${{ matrix.wheel-config }}"
path: wheelhouse/*.whl
if-no-files-found: error
retention-days: 1
package-artifacts:
name: Package artifacts
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Archive artifacts
run: |
mkdir dist/
find artifacts -type f -name "hictkpy*.whl" -exec cp '{}' dist/ \;
find artifacts -type f -name "hictkpy*.tar.gz" -exec cp '{}' dist/ \;
tar -cf dist.tar dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist.tar
if-no-files-found: error
retention-days: 7
pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs: [package-artifacts]
environment:
name: PyPI
url: https://pypi.org/p/hictkpy
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
merge-multiple: true
- name: Extract dist.tar
run: |
tar -xf dist.tar
rm dist.tar
- name: Upload wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
print-hash: true
verbose: true
build-wheels-status-check:
name: Status Check (Build wheels)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels
- package-artifacts
- pypi-publish
steps:
- name: Collect job results
if: |
needs.build-sdist.result != 'success' ||
needs.build-wheels.result != 'success' ||
needs.package-artifacts.result != 'success' ||
(
needs.pypi-publish.result != 'success' &&
needs.pypi-publish.result != 'skipped'
)
run: exit 1