Skip to content

fix: correct dim argument passing in create_table_func #144

fix: correct dim argument passing in create_table_func

fix: correct dim argument passing in create_table_func #144

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
lint:
name: Lint and Type Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.14'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --with lint,typing --no-interaction --no-root
- name: Run lint checks
run: |
poetry run ruff check langchain_oceanbase/
poetry run ruff format langchain_oceanbase/ --check
poetry run mypy langchain_oceanbase/ --cache-dir .mypy_cache || true
test:
name: Test Suite
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
db-type: [oceanbase, seekdb]
include:
- db-type: oceanbase
port: 2881
user: root@test
image: oceanbase/oceanbase-ce:4.3.5-lts
mode: mini
- db-type: seekdb
port: 2882
user: root
image: oceanbase/seekdb
mode: mini
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.14'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --with test,test_integration --no-interaction
- name: Start ${{ matrix.db-type }} container
run: |
set -e
echo "Starting ${{ matrix.db-type }} container..."
docker run -d --name "langchain_${{ matrix.db-type }}_test" \
-e MODE=${{ matrix.mode }} \
-p ${{ matrix.port }}:2881 \
${{ matrix.image }}
echo "${{ matrix.db-type }} container started"
# OceanBase: wait for "boot success!"
- name: Wait for OceanBase to be ready (boot success)
if: matrix.db-type == 'oceanbase'
run: |
set -e
echo "Waiting for oceanbase to be ready (log contains 'boot success!')..."
timeout=300 # 5 minutes
interval=5
while [ $timeout -gt 0 ]; do
if ! docker ps | grep -q "langchain_oceanbase_test"; then
echo "OceanBase container stopped unexpectedly."
docker logs "langchain_oceanbase_test" || true
exit 1
fi
if docker logs "langchain_oceanbase_test" 2>&1 | grep -q "boot success!"; then
echo "boot success! detected, OceanBase should be ready."
break
fi
sleep $interval
timeout=$((timeout - interval))
done
if [ $timeout -le 0 ]; then
echo "OceanBase did not become ready in time."
docker logs "langchain_oceanbase_test" || true
exit 1
fi
# SeekDB: wait until port is connectable
- name: Wait for SeekDB to be ready (port check)
if: matrix.db-type == 'seekdb'
run: |
set -e
echo "Waiting for seekdb to be ready (port ${{ matrix.port }} connectable)..."
timeout=300 # 5 minutes
interval=5
while [ $timeout -gt 0 ]; do
if ! docker ps | grep -q "langchain_seekdb_test"; then
echo "SeekDB container stopped unexpectedly."
docker logs "langchain_seekdb_test" || true
exit 1
fi
# Try TCP connect to the mapped port
if timeout 5 bash -c "echo > /dev/tcp/127.0.0.1/${{ matrix.port }}" 2>/dev/null; then
echo "SeekDB port ${{ matrix.port }} is open, SeekDB should be ready."
break
fi
sleep $interval
timeout=$((timeout - interval))
done
if [ $timeout -le 0 ]; then
echo "SeekDB did not become ready in time."
docker logs "langchain_seekdb_test" || true
exit 1
fi
- name: Run comprehensive tests
env:
OB_HOST: 127.0.0.1
OB_PORT: ${{ matrix.port }}
OB_USER: ${{ matrix.user }}
OB_PASSWORD: ""
OB_DB: test
run: |
set -e
echo "Running comprehensive tests with ${{ matrix.db-type }}..."
poetry run python tests/test_comprehensive.py
- name: Run integration tests
env:
OB_HOST: 127.0.0.1
OB_PORT: ${{ matrix.port }}
OB_USER: ${{ matrix.user }}
OB_PASSWORD: ""
OB_DB: test
run: |
set -e
echo "Running integration tests with ${{ matrix.db-type }}..."
poetry run pytest tests/integration_tests/ -v
- name: Cleanup
if: always()
run: |
docker rm -f "langchain_${{ matrix.db-type }}_test" || true
test-embedding:
name: Embedding Vectorization Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --with test --no-interaction --no-root
- name: Test embedding functionality
run: |
poetry run python -c "
from langchain_oceanbase.embedding_utils import DefaultEmbeddingFunctionAdapter
adapter = DefaultEmbeddingFunctionAdapter()
embeddings = adapter.embed_documents(['test document'])
print(f'Embedding test passed: {len(embeddings[0])} dimensions')
"
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [lint, test, test-embedding]
if: always()
steps:
- name: Test Summary
run: |
echo "All jobs finished."
echo "Lint: ${{ needs.lint.result }}"
echo "DB test matrix: ${{ needs.test.result }}"
echo "Embedding tests: ${{ needs.test-embedding.result }}"