Skip to content

feat(assistants): mock api #4471

feat(assistants): mock api

feat(assistants): mock api #4471

Workflow file for this run

name: Run Tests API and Worker
on:
pull_request:
paths:
- "backend/**"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 👀 Checkout code
uses: actions/checkout@v2
- name: 🔨 Install the latest version of rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
working-directory: backend
- name: 🔄 Sync dependencies
run: |
cd backend
UV_INDEX_STRATEGY=unsafe-first-match rye sync --no-lock
- name: 🚤 Install Supabase CLI
run: |
ARCHITECTURE=$(uname -m)
if [ "$ARCHITECTURE" = "x86_64" ]; then
wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb
sudo dpkg -i supabase_1.163.6_linux_amd64.deb
elif [ "$ARCHITECTURE" = "aarch64" ]; then
wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb
sudo dpkg -i supabase_1.163.6_linux_arm64.deb
fi
- name: 😭 Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmagic-dev poppler-utils libreoffice tesseract-ocr pandoc
- name: Install dependencies and run tests
env:
OPENAI_API_KEY: this-is-a-fake-openai-api-key
SUPABASE_URL: http://localhost:54321
SUPABASE_SERVICE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
PG_DATABASE_URL: postgresql://postgres:postgres@localhost:54322/postgres
PG_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost:54322/postgres
ANTHROPIC_API_KEY: null
JWT_SECRET_KEY: super-secret-jwt-token-with-at-least-32-characters-long
AUTHENTICATE: true
TELEMETRY_ENABLED: true
CELERY_BROKER_URL: redis://redis:6379/0
CELEBRY_BROKER_QUEUE_NAME: quivr-preview.fifo
QUIVR_DOMAIN: http://localhost:3000/
BACKEND_URL: http://localhost:5050
EMBEDDING_DIM: 1536
run: |
cd backend
sed -i 's/enabled = true/enabled = false/g' supabase/config.toml
sed -i '/\[db\]/,/\[.*\]/s/enabled = false/enabled = true/' supabase/config.toml
sed -i '/\[storage\]/,/\[.*\]/s/enabled = false/enabled = true/' supabase/config.toml
supabase start
rye run python -c "from unstructured.nlp.tokenize import download_nltk_packages; download_nltk_packages()"
rye run python -c "import nltk;nltk.download('punkt_tab'); nltk.download('averaged_perceptron_tagger_eng')"
rye test -p quivr-api -p quivr-worker