mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
14fbf594b2
- RapidOCR for indexing image PDFs doesn't currently support python 3.12. It's an optional dependency anyway, so only install it if python < 3.12 - Run unit tests with python version 3.12 as well Resolves #522
90 lines
2.2 KiB
YAML
90 lines
2.2 KiB
YAML
name: test
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- src/khoj/**
|
|
- tests/**
|
|
- config/**
|
|
- pyproject.toml
|
|
- .pre-commit-config.yml
|
|
- .github/workflows/test.yml
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- src/khoj/**
|
|
- tests/**
|
|
- config/**
|
|
- pyproject.toml
|
|
- .pre-commit-config.yml
|
|
- .github/workflows/test.yml
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
container: ubuntu:jammy
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python_version:
|
|
- '3.9'
|
|
- '3.10'
|
|
- '3.11'
|
|
- '3.12'
|
|
|
|
services:
|
|
postgres:
|
|
image: ankane/pgvector
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_USER: postgres
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python_version }}
|
|
|
|
- name: Install Git
|
|
run: |
|
|
apt update && apt install -y git
|
|
|
|
- name: ⏬️ Install Dependencies
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run: |
|
|
apt update && apt install -y libegl1 sqlite3 libsqlite3-dev libsqlite3-0 ffmpeg libsm6 libxext6
|
|
|
|
- name: ⬇️ Install Postgres
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run : |
|
|
apt install -y postgresql postgresql-client && apt install -y postgresql-server-dev-14
|
|
|
|
- name: ⬇️ Install pip
|
|
run: |
|
|
apt install -y python3-pip
|
|
python -m ensurepip --upgrade
|
|
python -m pip install --upgrade pip
|
|
|
|
- name: ⬇️ Install Application
|
|
run: sed -i 's/dynamic = \["version"\]/version = "0.0.0"/' pyproject.toml && pip install --upgrade .[dev]
|
|
|
|
- name: 🧪 Test Application
|
|
env:
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: 5432
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
run: pytest
|
|
timeout-minutes: 10
|