Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Python CI

on:
push:
branches: ['**']
paths:
- 'client/python/**'
- '.github/workflows/python.yml'
pull_request:
branches: ['**']
paths:
- 'client/python/**'
- '.github/workflows/python.yml'

defaults:
run:
working-directory: client/python

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install Package and Dev Deps
run: pip install -e ".[dev]"

- name: Run Tests
run: pytest -v

lint:
name: Lint and Format Check (ruff)
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install Package and Dev Deps
run: pip install -e ".[dev]"

- name: Check Formatting
run: ruff format --check .

- name: Run Ruff Linter
run: ruff check .
84 changes: 83 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
- name: Run Tests
run: cargo test --verbose

- name: Upload Server binary
uses: actions/upload-artifact@v4
with:
name: server-binary
path: target/debug/server

udeps:
name: Unused Dependencies (cargo-udeps)
runs-on: ubuntu-latest
Expand All @@ -58,8 +64,11 @@ jobs:
- name: Install protoc for gRPC server
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

# Using binstall to maximise workflow speed
- name: Install cargo-udeps
run: cargo +nightly install cargo-udeps --locked
uses: taiki-e/install-action@v2
with:
tool: cargo-udeps

- name: Run cargo-udeps
run: cargo +nightly udeps --workspace --all-targets --all-features
Expand All @@ -85,3 +94,76 @@ jobs:

- name: Check TOML formatting with taplo
run: taplo format --check

integration:
name: Integration Test
needs: build_and_test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Download server binary
uses: actions/download-artifact@v4
with:
name: server-binary
path: target/debug

# This is very IMP. Kept crashing without it
# File permissions are not maintained during artifact upload (upload-artifact@v4)
- name: Make binary executable
run: chmod +x target/debug/server

- name: Write keys file
run: |
cat > keys.json <<'EOF'
{"keys":[{"name":"ci-admin","role":"readwrite","key":"my-secret-password"}]}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take this from GitHub secrets

EOF

- name: Start Server
env:
VORTEXDB_KEYS_FILE: keys.json
DIMENSION: "3"
STORAGE_TYPE: inmemory
INDEX_TYPE: flat
GRPC_HOST: 0.0.0.0
GRPC_PORT: "50051"
DISABLE_HTTP: "true"
run: |
./target/debug/server > server.log 2>&1 &
echo $! > server.pid

- name: Wait for server to be ready
run: |
for i in {1..30}; do
if (echo > /dev/tcp/127.0.0.1/50051) 2>/dev/null; then
echo "Server is up"
exit 0
fi
sleep 1
done
echo "Server did not start in time"
cat server.log
exit 1

- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install Package and Dev Deps
working-directory: client/python
run: pip install -e ".[dev]"

- name: Run example scripts
working-directory: client/python
run: pytest examples/all.py -v

- name: Dump server logs on failure
if: failure()
run: cat server.log

- name: Stop server
if: always()
run: kill $(cat server.pid) 2>/dev/null || true
3 changes: 2 additions & 1 deletion client/python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ __pycache__/
.pytest_cache/
.hatch/
.venv/
venv/
venv/
.ruff_cache/
3 changes: 2 additions & 1 deletion client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "vortexdb"
version = "0.1.5"
version = "0.1.0"
description = "Python client for VortexDB"
readme = "README.md"
requires-python = ">=3.10"
Expand Down Expand Up @@ -32,6 +32,7 @@ dependencies = [
dev = [
"grpcio-tools>=1.81.1,<2.0.0",
"pytest>=7.0",
"ruff==0.15.17",
]

[tool.hatch.build.targets.wheel]
Expand Down
Loading