-
Notifications
You must be signed in to change notification settings - Fork 39
276 lines (247 loc) · 9.83 KB
/
build-wheels.yml
File metadata and controls
276 lines (247 loc) · 9.83 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
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
name: Build and test wheels
on:
workflow_dispatch:
inputs:
version:
description: Version to use as release version
required: true
type: string
test_pypi:
description: Upload packages to test.pypi.org
required: false
type: boolean
default: false
libtiledb_ref:
description: 'TileDB branch/tag/commit to build from (optional - uses vcpkg libtiledb if not provided)'
required: false
type: string
libtiledb_version:
description: 'Version string for TileDB build (optional)'
required: false
type: string
push:
tags:
- "*"
env:
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB: ${{ inputs.version }}
S3_BUCKET: ${{ vars.S3_BUCKET }}
TILEDB_NAMESPACE: ${{ vars.TILEDB_NAMESPACE }}
TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }}
jobs:
# Optional: build custom libtiledb if ref is specified
build_libtiledb:
if: inputs.libtiledb_ref != ''
name: Build libtiledb from source
uses: TileDB-Inc/TileDB/.github/workflows/build-artifacts.yml@main
with:
ref: ${{ inputs.libtiledb_ref }}
version: ${{ inputs.libtiledb_version }}
build_wheels:
needs: [build_libtiledb]
if: always() && (needs.build_libtiledb.result == 'success' || needs.build_libtiledb.result == 'skipped')
name: Wheel ${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64]
- [ubuntu-24.04-arm, manylinux_aarch64]
- [macos-15-intel, macosx_x86_64]
- [macos-26, macosx_arm64]
- [windows-2022, win_amd64]
python: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"]
steps:
- uses: actions/checkout@v6
# Download and set up custom libtiledb if ref was specified
- name: Determine platform for custom libtiledb
if: inputs.libtiledb_ref != ''
id: platform
run: |
# Map buildplat to platform name
case "${{ matrix.buildplat[1] }}" in
manylinux_x86_64)
echo "platform=linux-x86_64" >> $GITHUB_OUTPUT
;;
manylinux_aarch64)
echo "platform=linux-aarch64" >> $GITHUB_OUTPUT
;;
macosx_x86_64)
echo "platform=macos-x86_64" >> $GITHUB_OUTPUT
;;
macosx_arm64)
echo "platform=macos-arm64" >> $GITHUB_OUTPUT
;;
win_amd64)
echo "platform=windows-x86_64" >> $GITHUB_OUTPUT
;;
esac
shell: bash
- name: Download custom libtiledb artifacts
if: inputs.libtiledb_ref != ''
uses: actions/download-artifact@v6
with:
name: release-${{ steps.platform.outputs.platform }}
path: ${{ github.workspace }}/libtiledb-dist
- name: Unpack custom libtiledb (Unix)
if: inputs.libtiledb_ref != '' && runner.os != 'Windows'
run: |
cd ${{ github.workspace }}/libtiledb-dist
tar xzf tiledb-*.tar.gz
echo "TILEDB_PATH=${{ github.workspace }}/libtiledb-dist" >> $GITHUB_ENV
echo "TILEDB_LIB_PATH=${{ github.workspace }}/libtiledb-dist/lib" >> $GITHUB_ENV
shell: bash
- name: Unpack custom libtiledb (Windows)
if: inputs.libtiledb_ref != '' && runner.os == 'Windows'
run: |
cd "${{ github.workspace }}\libtiledb-dist"
Expand-Archive -Path tiledb-*.zip -DestinationPath .
$TILEDB_PATH = "${{ github.workspace }}\libtiledb-dist".Replace('\', '/')
echo "TILEDB_PATH=$TILEDB_PATH" >> $env:GITHUB_ENV
echo "TILEDB_BIN_PATH=$TILEDB_PATH/bin" >> $env:GITHUB_ENV
shell: powershell
# Set up environment for default TileDB (when libtiledb_ref is not provided)
- name: Set default TileDB paths (Unix)
if: inputs.libtiledb_ref == '' && runner.os != 'Windows'
run: |
echo "TILEDB_LIB_PATH=${{ runner.temp }}/tiledb-external" >> $GITHUB_ENV
shell: bash
- name: Set default TileDB paths (Windows)
if: inputs.libtiledb_ref == '' && runner.os == 'Windows'
run: |
echo "TILEDB_BIN_PATH=${{ runner.temp }}/tiledb-external" >> $env:GITHUB_ENV
shell: powershell
- name: "Brew setup on macOS" # x-ref c8e49ba8f8b9ce
if: ${{ startsWith(matrix.buildplat[0], 'macos-') == true }}
run: |
set -e pipefail
brew update
brew install automake pkg-config ninja
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_PASS_LINUX: >
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB
S3_BUCKET
TILEDB_TOKEN
TILEDB_NAMESPACE
CIBW_ENVIRONMENT_LINUX: >
CI_WHEEL_BUILD=1
${{ inputs.libtiledb_ref != '' && 'TILEDB_PATH=/project/libtiledb-dist' || '' }}
CIBW_ENVIRONMENT_MACOS: >
CC=clang
CXX=clang++
CI_WHEEL_BUILD=1
${{ inputs.libtiledb_ref != '' && format('TILEDB_PATH={0}', env.TILEDB_PATH) || '' }}
${{ inputs.libtiledb_ref != '' && format('TILEDB_LIB_PATH={0}', env.TILEDB_LIB_PATH) || '' }}
CIBW_ENVIRONMENT_WINDOWS: >
CI_WHEEL_BUILD=1
${{ inputs.libtiledb_ref != '' && format('TILEDB_PATH={0}', env.TILEDB_PATH) || '' }}
${{ inputs.libtiledb_ref != '' && format('TILEDB_BIN_PATH={0}', env.TILEDB_BIN_PATH) || '' }}
MACOSX_DEPLOYMENT_TARGET: "11.0"
CIBW_ARCHS: all
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "bash -c 'export LD_LIBRARY_PATH=\"/project/libtiledb-dist/lib:${LD_LIBRARY_PATH}\"; auditwheel repair -w {dest_dir} {wheel}'"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "bash -c 'export DYLD_LIBRARY_PATH=\"${TILEDB_LIB_PATH}:${DYLD_LIBRARY_PATH}\"; delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}'"
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "cmd /c \"if defined TILEDB_BIN_PATH (delvewheel repair --add-path \"%TILEDB_BIN_PATH%\" -w {dest_dir} {wheel}) else (delvewheel repair -w {dest_dir} {wheel})\""
# __init__.py interferes with the tests and is included as local file instead of
# used from wheels. To be honest, tests should not be in the source folder at all.
CIBW_BEFORE_TEST: rm {project}/tiledb/__init__.py
with:
output-dir: wheelhouse
- uses: actions/upload-artifact@v5
with:
name: cibw-wheels-${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }}
path: "./wheelhouse/*.whl"
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
env:
RUNNER_TEMP: ""
CI_WHEEL_BUILD: 0
outputs:
sdist_name: ${{ steps.get_sdist_name.outputs.sdist_name }}
steps:
- uses: actions/checkout@v6
- name: Build sdist
run: pipx run build --sdist
- name: Get sdist package name
id: get_sdist_name
run: |
echo "sdist_name=$(ls dist/ | head -n 1)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
test_sdist:
name: Test source distribution package
needs: [build_sdist]
strategy:
matrix:
os:
- macos-15-intel
- macos-26
- windows-2022
- ubuntu-22.04
- ubuntu-24.04-arm
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
env:
CI_WHEEL_BUILD: 0
RUNNER_TEMP: ""
steps:
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Download sdist artifact
uses: actions/download-artifact@v6
with:
name: sdist
path: dist
- name: Install sdist artifact
run: pip install --verbose dist/${{ needs.build_sdist.outputs.sdist_name }}
- uses: actions/checkout@v6
- name: Install test dependencies
run: pip install pytest pytest-rerunfailures hypothesis psutil pyarrow
- name: Run tests
shell: bash
run: |
PROJECT_CWD=$PWD
rm tiledb/__init__.py
cd ..
pytest -vv --showlocals $PROJECT_CWD
- name: "Re-run tests without pandas"
run: |
pip uninstall -y pandas
pytest -vv --showlocals $PROJECT_CWD
upload_pypi:
needs: [build_wheels, test_sdist]
if: always() && (startsWith(github.ref, 'refs/tags/') || inputs.test_pypi) && needs.build_wheels.result == 'success' && needs.test_sdist.result == 'success'
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
outputs:
package_version: ${{ steps.get_package_version.outputs.package_version }}
steps:
- uses: actions/download-artifact@v6
with:
path: dist
merge-multiple: true
- id: get_package_version
run: |
echo "package_version=$(ls dist/ | head -n 1 | cut -d - -f 2)" >> "$GITHUB_OUTPUT"
- name: Upload to test-pypi
if: inputs.test_pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Upload to pypi
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1