Files
LEANN/.github/workflows/ci.yml
Andy Lee 2684ee71dc fix: ensure uv build uses correct Python version in CI
- Add --python python flag to uv build commands
- This ensures wheels are built with the correct Python version (cp313 for Python 3.13, etc)
- Fixes issue where Python 3.13 CI was building cp311 wheels
- Also adds Python version verification before build
2025-07-24 13:44:02 -07:00

110 lines
3.7 KiB
YAML

name: CI - Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libomp-dev libboost-all-dev libzmq3-dev \
pkg-config libopenblas-dev patchelf \
libaio-dev protobuf-compiler libprotobuf-dev libabsl-dev
# Install Intel MKL for DiskANN
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/79153e0f-74d7-45af-b8c2-258941adf58a/intel-onemkl-2025.0.0.940.sh
sudo sh intel-onemkl-2025.0.0.940.sh -a --components intel.oneapi.lin.mkl.devel --action install --eula accept -s
source /opt/intel/oneapi/setvars.sh
echo "MKLROOT=/opt/intel/oneapi/mkl/latest" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/latest/lib/intel64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp boost zeromq protobuf
- name: Build all packages
run: |
echo "🔨 Building on ${{ matrix.os }} with Python ${{ matrix.python-version }}..."
export UV_SYSTEM_PYTHON=1
# Verify Python version
python --version
which python
# Build each package
for pkg in leann-core leann-backend-hnsw leann-backend-diskann leann; do
echo "Building $pkg..."
cd packages/$pkg
rm -rf dist/ build/ _skbuild/
# Use explicit python interpreter
uv build --wheel --python python
if [ ! -f dist/*.whl ]; then
echo "❌ Failed to build $pkg!"
exit 1
fi
echo "✅ $pkg built successfully"
cd ../..
done
- name: Install and test packages
run: |
# Create clean test environment
python -m venv test_env
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
source test_env/Scripts/activate
else
source test_env/bin/activate
fi
# Install built packages
pip install packages/*/dist/*.whl
# Basic import test
python -c "import leann; print('✅ LEANN imported successfully')"
python -c "import leann_backend_hnsw; print('✅ HNSW backend imported')"
python -c "import leann_backend_diskann; print('✅ DiskANN backend imported')"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: packages/*/dist/*.whl
retention-days: 7
# Summary job to ensure all builds pass
ci-success:
needs: build-test
runs-on: ubuntu-latest
steps:
- name: CI Success
run: |
echo "✅ All CI builds passed!"
echo "Ready for manual release when needed."