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, windows-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' # 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_28 for better compatibility CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 # Install dependencies before building CIBW_BEFORE_ALL_LINUX: | dnf install -y epel-release dnf install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake CIBW_BEFORE_ALL_MACOS: | brew install boost zeromq openblas cmake CIBW_BEFORE_ALL_WINDOWS: | choco install cmake -y # Test the wheel CIBW_TEST_COMMAND: | python -c "import leann_backend_hnsw; print('HNSW backend imported successfully')" # Environment variables for build CIBW_ENVIRONMENT: | CMAKE_BUILD_PARALLEL_LEVEL=8 - 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_28 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 CIBW_BEFORE_ALL_LINUX: | dnf install -y epel-release dnf install -y gcc-c++ boost-devel zeromq-devel openblas-devel cmake CIBW_BEFORE_ALL_MACOS: | brew install boost zeromq openblas cmake CIBW_BEFORE_ALL_WINDOWS: | choco install cmake -y CIBW_TEST_COMMAND: | python -c "import leann_backend_diskann; print('DiskANN backend imported successfully')" CIBW_ENVIRONMENT: | CMAKE_BUILD_PARALLEL_LEVEL=8 - uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }} path: ./wheelhouse/*.whl