Skip to content

support for lancedb as vectordb (#644) #1247

support for lancedb as vectordb (#644)

support for lancedb as vectordb (#644) #1247

name: Unit test
on:
push:
branches:
- main
- dev
paths:
- 'examples/**'
- 'gptcache/**'
- 'tests/**'
- '!**.md'
- '.github/workflows/**'
pull_request:
branches:
- main
- dev
paths:
- 'examples/**'
- 'gptcache/**'
- 'tests/**'
- '!**.md'
- '.github/workflows/**'
workflow_dispatch:
jobs:
unit-test-main:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
services:
postgres:
image: ankane/pgvector
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis/redis-stack-server
ports:
- 6379:6379
dynamodb:
image: amazon/dynamodb-local:2.0.0
# rebinding to a different port since 8000 is a commonly used port
ports:
- 9999:8000
mongo:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install dependency
shell: bash
run: |
pip install -r requirements.txt
- name: Build and install
shell: bash
timeout-minutes: 10
run: |
python setup.py install
- name: Install test dependency
shell: bash
working-directory: tests
run: |
pip install -r requirements.txt
- name: Download the `en_core_web_sm` model
shell: bash
working-directory: tests
run: |
python3 -m spacy download en_core_web_sm
- name: Remove coverage xml
run: |
rm -rf ./coverage.xml
- name: Normal Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest -k "not embedding and not processor" --cov=gptcache --cov-report xml:coverage.xml --cov-append ./tests/
- name: Processor Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest --cov=gptcache --cov-append --cov-report xml:coverage.xml ./tests/unit_tests/processor/
- name: Embedding Unit Tests
timeout-minutes: 30
shell: bash
run: |
export IS_CI=true
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
python3 -m pytest --cov=gptcache --cov-report xml:coverage.xml --cov-append ./tests/unit_tests/embedding/
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true