Skip to content

Distributed cache feature using Redis #1113

Distributed cache feature using Redis

Distributed cache feature using Redis #1113

Workflow file for this run

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
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: 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: 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: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true