Skip to content

Commit e6363be

Browse files
authored
Refactor build wheels workflow to build against arbitrary libtiledb refs (#2275)
1 parent f76a955 commit e6363be

File tree

1 file changed

+89
-8
lines changed

1 file changed

+89
-8
lines changed

.github/workflows/build-wheels.yml

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: Version to use are release version
7+
description: Version to use as release version
88
required: true
99
type: string
1010
test_pypi:
1111
description: Upload packages to test.pypi.org
1212
required: false
1313
type: boolean
1414
default: false
15+
libtiledb_ref:
16+
description: 'TileDB branch/tag/commit to build from (optional - uses vcpkg libtiledb if not provided)'
17+
required: false
18+
type: string
19+
libtiledb_version:
20+
description: 'Version string for TileDB build (optional)'
21+
required: false
22+
type: string
1523
push:
1624
tags:
1725
- "*"
@@ -23,10 +31,22 @@ env:
2331
TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }}
2432

2533
jobs:
34+
# Optional: build custom libtiledb if ref is specified
35+
build_libtiledb:
36+
if: inputs.libtiledb_ref != ''
37+
name: Build libtiledb from source
38+
uses: TileDB-Inc/TileDB/.github/workflows/build-artifacts.yml@main
39+
with:
40+
ref: ${{ inputs.libtiledb_ref }}
41+
version: ${{ inputs.libtiledb_version }}
42+
2643
build_wheels:
44+
needs: [build_libtiledb]
45+
if: always() && (needs.build_libtiledb.result == 'success' || needs.build_libtiledb.result == 'skipped')
2746
name: Wheel ${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }}
2847
runs-on: ${{ matrix.buildplat[0] }}
2948
strategy:
49+
fail-fast: false
3050
matrix:
3151
buildplat:
3252
- [ubuntu-22.04, manylinux_x86_64]
@@ -39,6 +59,57 @@ jobs:
3959
steps:
4060
- uses: actions/checkout@v4
4161

62+
# Download and set up custom libtiledb if ref was specified
63+
- name: Determine platform for custom libtiledb
64+
if: inputs.libtiledb_ref != ''
65+
id: platform
66+
run: |
67+
# Map buildplat to platform name
68+
case "${{ matrix.buildplat[1] }}" in
69+
manylinux_x86_64)
70+
echo "platform=linux-x86_64" >> $GITHUB_OUTPUT
71+
;;
72+
manylinux_aarch64)
73+
echo "platform=linux-aarch64" >> $GITHUB_OUTPUT
74+
;;
75+
macosx_x86_64)
76+
echo "platform=macos-x86_64" >> $GITHUB_OUTPUT
77+
;;
78+
macosx_arm64)
79+
echo "platform=macos-arm64" >> $GITHUB_OUTPUT
80+
;;
81+
win_amd64)
82+
echo "platform=windows-x86_64" >> $GITHUB_OUTPUT
83+
;;
84+
esac
85+
shell: bash
86+
87+
- name: Download custom libtiledb artifacts
88+
if: inputs.libtiledb_ref != ''
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: release-${{ steps.platform.outputs.platform }}
92+
path: ${{ github.workspace }}/libtiledb-dist
93+
94+
- name: Unpack custom libtiledb (Unix)
95+
if: inputs.libtiledb_ref != '' && runner.os != 'Windows'
96+
run: |
97+
cd ${{ github.workspace }}/libtiledb-dist
98+
tar xzf tiledb-*.tar.gz
99+
echo "TILEDB_PATH=${{ github.workspace }}/libtiledb-dist" >> $GITHUB_ENV
100+
echo "TILEDB_LIB_PATH=${{ github.workspace }}/libtiledb-dist/lib" >> $GITHUB_ENV
101+
shell: bash
102+
103+
- name: Unpack custom libtiledb (Windows)
104+
if: inputs.libtiledb_ref != '' && runner.os == 'Windows'
105+
run: |
106+
cd "${{ github.workspace }}\libtiledb-dist"
107+
Expand-Archive -Path tiledb-*.zip -DestinationPath .
108+
$TILEDB_PATH = "${{ github.workspace }}\libtiledb-dist".Replace('\', '/')
109+
echo "TILEDB_PATH=$TILEDB_PATH" >> $env:GITHUB_ENV
110+
echo "TILEDB_BIN_PATH=$TILEDB_PATH/bin" >> $env:GITHUB_ENV
111+
shell: powershell
112+
42113
- name: "Brew setup on macOS" # x-ref c8e49ba8f8b9ce
43114
if: ${{ startsWith(matrix.buildplat[0], 'macos-') == true }}
44115
run: |
@@ -49,25 +120,35 @@ jobs:
49120
- name: Build wheels
50121
uses: pypa/[email protected]
51122
env:
52-
CIBW_ENVIRONMENT:
53-
CI_WHEEL_BUILD=1
54123
CIBW_BUILD_VERBOSITY: 3
55-
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB S3_BUCKET TILEDB_TOKEN TILEDB_NAMESPACE RUNNER_TEMP
124+
CIBW_ENVIRONMENT_PASS_LINUX: >
125+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB
126+
S3_BUCKET
127+
TILEDB_TOKEN
128+
TILEDB_NAMESPACE
129+
CIBW_ENVIRONMENT_LINUX: >
130+
CI_WHEEL_BUILD=1
131+
${{ inputs.libtiledb_ref != '' && 'TILEDB_PATH=/project/libtiledb-dist' || '' }}
56132
CIBW_ENVIRONMENT_MACOS: >
57133
CC=clang
58134
CXX=clang++
59-
RUNNER_TEMP=${{ runner.temp }}
60135
CI_WHEEL_BUILD=1
136+
${{ inputs.libtiledb_ref != '' && format('TILEDB_PATH={0}', env.TILEDB_PATH) || '' }}
137+
${{ inputs.libtiledb_ref != '' && format('TILEDB_LIB_PATH={0}', env.TILEDB_LIB_PATH) || '' }}
138+
CIBW_ENVIRONMENT_WINDOWS: >
139+
CI_WHEEL_BUILD=1
140+
${{ inputs.libtiledb_ref != '' && format('TILEDB_PATH={0}', env.TILEDB_PATH) || '' }}
141+
${{ inputs.libtiledb_ref != '' && format('TILEDB_BIN_PATH={0}', env.TILEDB_BIN_PATH) || '' }}
61142
MACOSX_DEPLOYMENT_TARGET: "11.0"
62143
CIBW_ARCHS: all
63144
CIBW_PRERELEASE_PYTHONS: True
64145
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
65146
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
66147
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
67-
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "bash -c 'if [ -n \"$RUNNER_TEMP\" ] && [ -d \"$RUNNER_TEMP/tiledb-external\" ]; then export LD_LIBRARY_PATH=\"$RUNNER_TEMP/tiledb-external:$LD_LIBRARY_PATH\"; fi; auditwheel repair -w {dest_dir} {wheel}'"
68-
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "bash -c 'if [ -n \"$RUNNER_TEMP\" ] && [ -d \"$RUNNER_TEMP/tiledb-external\" ]; then export DYLD_LIBRARY_PATH=\"$RUNNER_TEMP/tiledb-external:$DYLD_LIBRARY_PATH\"; fi; delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}'"
148+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "bash -c 'export LD_LIBRARY_PATH=\"/project/libtiledb-dist/lib:${LD_LIBRARY_PATH}\"; auditwheel repair -w {dest_dir} {wheel}'"
149+
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}'"
69150
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
70-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path \"%RUNNER_TEMP%\\tiledb-external\" -w {dest_dir} {wheel}"
151+
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})\""
71152
# __init__.py interferes with the tests and is included as local file instead of
72153
# used from wheels. To be honest, tests should not be in the source folder at all.
73154
CIBW_BEFORE_TEST: rm {project}/tiledb/__init__.py

0 commit comments

Comments
 (0)