- Add ci.yml for continuous integration on every commit - Test builds on Ubuntu/macOS with Python 3.9/3.10/3.11 - Ensure code quality before any release - Add release-manual.yml for controlled releases - Manual trigger prevents accidental releases - Version validation and tag creation - Optional TestPyPI testing before production - Only creates tag after validation passes - Keep build-and-publish.yml for automated PyPI deployment - Triggered by new tags (separation of concerns) - Handles multi-platform wheel building - Allows retry if PyPI upload fails - Update RELEASE.md with clear prerequisites and workflow This setup ensures: 1. Every commit is tested (CI) 2. Releases are deliberate (manual trigger) 3. Failed CI won't create broken tags 4. PyPI publish can be retried independently
105 lines
3.5 KiB
YAML
105 lines
3.5 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']
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
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
|
|
|
|
# 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/
|
|
uv build --wheel
|
|
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@v3
|
|
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." |