Skip to content

feat(embedded): add native Hnsw class for ann-benchmarks integration #241

feat(embedded): add native Hnsw class for ann-benchmarks integration

feat(embedded): add native Hnsw class for ann-benchmarks integration #241

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
with:
python-version: "3.11"
- run: uv sync
- run: uv run ruff check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
- run: uv run ruff format --check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-packages
- name: Generate proto stubs
run: uv run make proto
- name: Unit tests
run: uv run pytest tests/unit/ -v
build-embedded:
name: Build embedded (CI check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- name: Build (maturin / Linux x86_64)
uses: PyO3/maturin-action@32307a466a178317e8c2ae343b38e73896a047be # v1.47.0
with:
command: build
args: >-
--manifest-path coordinode-embedded/Cargo.toml
--out /tmp/embedded-dist
manylinux: manylinux_2_28
before-script-linux: |
dnf install -y protobuf-compiler
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
with:
python-version: "3.12"
- name: Install wheel + run embedded tests
# The main `test` job skips coordinode_embedded with importorskip
# because that runner doesn't build the wheel. This job has the
# wheel — install it and run the embedded tests here, with
# --strict-markers so a silent skip surfaces as a CI failure.
run: |
set -euo pipefail
WHL=$(ls /tmp/embedded-dist/coordinode_embedded-*.whl | head -1)
test -n "$WHL"
uv venv --python 3.12 /tmp/test-venv
uv pip install --python /tmp/test-venv/bin/python "$WHL" numpy pytest pytest-timeout
/tmp/test-venv/bin/python -m pytest tests/unit/test_hnsw.py -v --strict-markers -ra
# Fail if any test was skipped — importorskip is intentional, but
# in this job the wheel IS installed, so a skip means something is
# genuinely broken (wrong manylinux glibc, missing numpy, ...).
test "$(/tmp/test-venv/bin/python -m pytest tests/unit/test_hnsw.py --collect-only -q 2>&1 | grep -c 'test_')" -gt 0
test-integration:
name: Integration tests
runs-on: ubuntu-latest
services:
coordinode:
image: ghcr.io/structured-world/coordinode:latest
ports:
- 7080:7080
- 7084:7084
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
with:
python-version: "3.11"
- name: Wait for coordinode
run: |
echo "Waiting for coordinode to be ready (HTTP :7084 + gRPC :7080)..."
for i in $(seq 1 30); do
if curl -sf http://localhost:7084/health >/dev/null 2>&1 && \
(echo > /dev/tcp/localhost/7080) 2>/dev/null; then
echo "coordinode is ready (attempt $i)"
exit 0
fi
echo "Attempt $i/30 — not ready yet, sleeping 5s..."
sleep 5
done
echo "Error: coordinode did not become healthy after 150s" >&2
exit 1
- name: Install + generate proto
run: |
uv sync --all-packages
uv run make proto
- name: Integration tests
env:
COORDINODE_ADDR: "localhost:7080"
run: uv run pytest tests/integration/ -v --timeout=30