fix: use virtual environment in CI instead of system packages
- uv-managed Python environments don't allow --system installs - Create and activate virtual environment before installing packages - Update all CI steps to use the virtual environment
This commit is contained in:
20
.github/workflows/build-reusable.yml
vendored
20
.github/workflows/build-reusable.yml
vendored
@@ -201,16 +201,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Install built packages for testing
|
- name: Install built packages for testing
|
||||||
run: |
|
run: |
|
||||||
|
# Create a virtual environment
|
||||||
|
uv venv
|
||||||
|
source .venv/bin/activate || source .venv/Scripts/activate
|
||||||
|
|
||||||
# Install the built wheels
|
# Install the built wheels
|
||||||
if [[ "${{ matrix.os }}" == ubuntu-* ]]; then
|
if [[ "${{ matrix.os }}" == ubuntu-* ]]; then
|
||||||
uv pip install --system packages/leann-core/dist/*.whl
|
uv pip install packages/leann-core/dist/*.whl
|
||||||
uv pip install --system packages/leann/dist/*.whl
|
uv pip install packages/leann/dist/*.whl
|
||||||
fi
|
fi
|
||||||
uv pip install --system packages/leann-backend-hnsw/dist/*.whl
|
uv pip install packages/leann-backend-hnsw/dist/*.whl
|
||||||
uv pip install --system packages/leann-backend-diskann/dist/*.whl
|
uv pip install packages/leann-backend-diskann/dist/*.whl
|
||||||
|
|
||||||
# Install test dependencies using extras
|
# Install test dependencies using extras
|
||||||
uv pip install --system -e ".[test]"
|
uv pip install -e ".[test]"
|
||||||
|
|
||||||
- name: Run tests with pytest
|
- name: Run tests with pytest
|
||||||
env:
|
env:
|
||||||
@@ -220,11 +224,17 @@ jobs:
|
|||||||
TOKENIZERS_PARALLELISM: false
|
TOKENIZERS_PARALLELISM: false
|
||||||
PYTORCH_ENABLE_MPS_FALLBACK: 0 # Disable MPS on macOS CI to avoid memory issues
|
PYTORCH_ENABLE_MPS_FALLBACK: 0 # Disable MPS on macOS CI to avoid memory issues
|
||||||
run: |
|
run: |
|
||||||
|
# Activate virtual environment
|
||||||
|
source .venv/bin/activate || source .venv/Scripts/activate
|
||||||
|
|
||||||
# Run all tests
|
# Run all tests
|
||||||
pytest tests/
|
pytest tests/
|
||||||
|
|
||||||
- name: Run sanity checks (optional)
|
- name: Run sanity checks (optional)
|
||||||
run: |
|
run: |
|
||||||
|
# Activate virtual environment
|
||||||
|
source .venv/bin/activate || source .venv/Scripts/activate
|
||||||
|
|
||||||
# Run distance function tests if available
|
# Run distance function tests if available
|
||||||
if [ -f test/sanity_checks/test_distance_functions.py ]; then
|
if [ -f test/sanity_checks/test_distance_functions.py ]; then
|
||||||
echo "Running distance function sanity checks..."
|
echo "Running distance function sanity checks..."
|
||||||
|
|||||||
Reference in New Issue
Block a user