- Use manylinux_2_35 (GLIBC 2.35) instead of manylinux2014 (GLIBC 2.17) - Still compatible with Google Colab (requires ≤2.35) - Benefits: newer toolchain, better performance, modern C++ features - Switch from yum to dnf package manager - Remove pyzmq version cap as manylinux_2_35 has newer ZeroMQ - Update documentation to reflect the change
171 lines
6.1 KiB
YAML
171 lines
6.1 KiB
YAML
name: Build with cibuildwheel
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
description: 'Git ref to build'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
|
|
jobs:
|
|
build_wheels:
|
|
name: Build wheels on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest] # Focus on Linux/manylinux for Colab compatibility
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
submodules: recursive
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
# Build pure Python packages separately
|
|
- name: Build pure Python packages (leann-core, leann)
|
|
if: matrix.os == 'ubuntu-latest' # Only build once
|
|
run: |
|
|
python -m pip install --upgrade pip build
|
|
python -m build packages/leann-core --outdir wheelhouse/
|
|
python -m build packages/leann --outdir wheelhouse/
|
|
|
|
- name: Build leann-backend-hnsw wheels
|
|
uses: pypa/cibuildwheel@v2.20.0
|
|
with:
|
|
package-dir: packages/leann-backend-hnsw
|
|
output-dir: wheelhouse
|
|
env:
|
|
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
|
|
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *musllinux*"
|
|
|
|
# Use manylinux_2_35 for Colab compatibility with modern features
|
|
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_35
|
|
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_35
|
|
|
|
# Linux dependencies - using dnf for manylinux_2_35 (based on AlmaLinux 9)
|
|
CIBW_BEFORE_ALL_LINUX: |
|
|
dnf install -y epel-release
|
|
dnf install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake python3-devel
|
|
|
|
# Install numpy before building
|
|
CIBW_BEFORE_BUILD: |
|
|
pip install numpy
|
|
pip install --upgrade pip setuptools wheel
|
|
|
|
CIBW_BEFORE_BUILD_LINUX: |
|
|
pip install numpy
|
|
pip install --upgrade pip setuptools wheel swig
|
|
|
|
CIBW_BEFORE_ALL_MACOS: |
|
|
brew install boost zeromq openblas cmake libomp
|
|
|
|
# Pre-install test dependencies to avoid compilation
|
|
CIBW_BEFORE_TEST: |
|
|
pip install --only-binary :all: "pyzmq>=23.0.0"
|
|
|
|
# Test command to verify the wheel works
|
|
CIBW_TEST_COMMAND: |
|
|
python -c "import leann_backend_hnsw; print('HNSW backend imported successfully')"
|
|
|
|
# Skip problematic configurations
|
|
CIBW_TEST_SKIP: "*-macosx_arm64" # Skip ARM64 tests on GitHub Actions
|
|
|
|
# Test dependencies
|
|
CIBW_TEST_REQUIRES: "pytest numpy"
|
|
|
|
# Environment variables for build
|
|
CIBW_ENVIRONMENT: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
Python_FIND_VIRTUALENV=ONLY
|
|
Python3_FIND_VIRTUALENV=ONLY
|
|
|
|
# Linux-specific environment variables
|
|
CIBW_ENVIRONMENT_LINUX: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
|
|
# macOS-specific environment variables
|
|
CIBW_ENVIRONMENT_MACOS: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
MACOSX_DEPLOYMENT_TARGET=11.0
|
|
CMAKE_OSX_DEPLOYMENT_TARGET=11.0
|
|
Python_FIND_VIRTUALENV=ONLY
|
|
Python3_FIND_VIRTUALENV=ONLY
|
|
|
|
- name: Build leann-backend-diskann wheels
|
|
uses: pypa/cibuildwheel@v2.20.0
|
|
with:
|
|
package-dir: packages/leann-backend-diskann
|
|
output-dir: wheelhouse
|
|
env:
|
|
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
|
|
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *musllinux*"
|
|
|
|
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_35
|
|
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_35
|
|
|
|
CIBW_BEFORE_ALL_LINUX: |
|
|
dnf install -y epel-release
|
|
dnf install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake python3-devel
|
|
|
|
# Install numpy before building
|
|
CIBW_BEFORE_BUILD: |
|
|
pip install numpy
|
|
pip install --upgrade pip setuptools wheel
|
|
|
|
CIBW_BEFORE_BUILD_LINUX: |
|
|
pip install numpy
|
|
pip install --upgrade pip setuptools wheel swig
|
|
|
|
CIBW_BEFORE_ALL_MACOS: |
|
|
brew install boost zeromq openblas cmake libomp
|
|
|
|
# Pre-install test dependencies to avoid compilation
|
|
CIBW_BEFORE_TEST: |
|
|
pip install --only-binary :all: "pyzmq>=23.0.0"
|
|
|
|
# Test command to verify the wheel works
|
|
CIBW_TEST_COMMAND: |
|
|
python -c "import leann_backend_diskann; print('DiskANN backend imported successfully')"
|
|
|
|
# Skip problematic configurations
|
|
CIBW_TEST_SKIP: "*-macosx_arm64" # Skip ARM64 tests on GitHub Actions
|
|
|
|
# Test dependencies - avoid pyzmq due to manylinux2014 compatibility issues
|
|
CIBW_TEST_REQUIRES: "pytest numpy"
|
|
|
|
CIBW_ENVIRONMENT: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
Python_FIND_VIRTUALENV=ONLY
|
|
Python3_FIND_VIRTUALENV=ONLY
|
|
|
|
# Linux-specific environment variables
|
|
CIBW_ENVIRONMENT_LINUX: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
CMAKE_PREFIX_PATH=$VIRTUAL_ENV
|
|
Python_FIND_VIRTUALENV=ONLY
|
|
Python3_FIND_VIRTUALENV=ONLY
|
|
Python_FIND_STRATEGY=LOCATION
|
|
Python3_FIND_STRATEGY=LOCATION
|
|
Python_EXECUTABLE=$VIRTUAL_ENV/bin/python
|
|
Python3_EXECUTABLE=$VIRTUAL_ENV/bin/python
|
|
|
|
# macOS-specific environment variables
|
|
CIBW_ENVIRONMENT_MACOS: |
|
|
CMAKE_BUILD_PARALLEL_LEVEL=8
|
|
MACOSX_DEPLOYMENT_TARGET=11.0
|
|
CMAKE_OSX_DEPLOYMENT_TARGET=11.0
|
|
Python_FIND_VIRTUALENV=ONLY
|
|
Python3_FIND_VIRTUALENV=ONLY
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-${{ matrix.os }}
|
|
path: ./wheelhouse/*.whl |