Files
LEANN/.github/workflows/build-cibuildwheel.yml
Andy Lee 179f30bc36 fix: improve system dependency installation in manylinux containers
- Add yum cache cleaning and updating
- Make package installations more resilient with fallbacks
- Use pkgconfig instead of pkg-config (CentOS 7 naming)
- Handle optional packages that might not be available
- Add error handling for package installation failures
2025-07-25 00:30:29 -07:00

104 lines
3.5 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, macos-latest]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11' # Version for building pure Python packages
# Build each package separately in our monorepo
- name: Build pure Python packages (leann-core, leann)
if: matrix.os == 'ubuntu-latest' # Only build once, they're platform-independent
run: |
# Install build tools
python -m pip install --upgrade pip build
# Build pure Python packages
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.16.2
with:
package-dir: packages/leann-backend-hnsw
output-dir: wheelhouse
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: "*-win32 *-manylinux_i686 pp*"
CIBW_BEFORE_ALL_LINUX: |
yum clean all && yum makecache
yum install -y epel-release || true
yum makecache || true
yum install -y boost-devel protobuf-compiler zeromq-devel pkgconfig openblas-devel || echo "Some packages failed, continuing..."
CIBW_BEFORE_ALL_MACOS: |
brew install llvm libomp boost protobuf zeromq
CIBW_ENVIRONMENT_MACOS: |
CC=$(brew --prefix llvm)/bin/clang
CXX=$(brew --prefix llvm)/bin/clang++
CIBW_TEST_REQUIRES: leann-core numpy pyzmq msgpack
CIBW_TEST_COMMAND: python -c "import leann_backend_hnsw"
- name: Build leann-backend-diskann wheels
uses: pypa/cibuildwheel@v2.16.2
with:
package-dir: packages/leann-backend-diskann
output-dir: wheelhouse
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: "*-win32 *-manylinux_i686 pp*"
CIBW_BEFORE_ALL_LINUX: |
yum clean all && yum makecache
yum install -y epel-release || true
yum makecache || true
yum install -y protobuf-compiler openblas-devel protobuf-devel || echo "Some packages failed, continuing..."
yum install -y libaio-devel || echo "libaio-devel not available, continuing..."
CIBW_BEFORE_ALL_MACOS: |
brew install llvm libomp protobuf
CIBW_ENVIRONMENT_MACOS: |
CC=$(brew --prefix llvm)/bin/clang
CXX=$(brew --prefix llvm)/bin/clang++
CIBW_TEST_REQUIRES: leann-core numpy
CIBW_TEST_COMMAND: python -c "import leann_backend_diskann"
- name: List built packages
run: |
echo "📦 Built packages:"
ls -la wheelhouse/
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl