2022-01-29 22:31:27 +01:00
|
|
|
name: test
|
2021-09-30 13:36:00 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2022-08-01 01:30:23 +02:00
|
|
|
paths:
|
2023-10-26 18:42:29 +02:00
|
|
|
- src/**
|
2022-08-01 01:30:23 +02:00
|
|
|
- tests/**
|
|
|
|
- config/**
|
2023-02-16 10:12:04 +01:00
|
|
|
- pyproject.toml
|
2023-02-17 19:07:59 +01:00
|
|
|
- .pre-commit-config.yml
|
2022-08-01 01:30:23 +02:00
|
|
|
- .github/workflows/test.yml
|
2021-09-30 13:36:00 +02:00
|
|
|
push:
|
|
|
|
branches:
|
2023-10-26 18:42:29 +02:00
|
|
|
- master
|
2022-08-01 01:30:23 +02:00
|
|
|
paths:
|
2023-02-14 21:50:51 +01:00
|
|
|
- src/khoj/**
|
2022-08-01 01:30:23 +02:00
|
|
|
- tests/**
|
|
|
|
- config/**
|
2023-02-16 10:12:04 +01:00
|
|
|
- pyproject.toml
|
2023-02-17 19:07:59 +01:00
|
|
|
- .pre-commit-config.yml
|
2022-08-01 01:30:23 +02:00
|
|
|
- .github/workflows/test.yml
|
2021-09-30 13:36:00 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2022-08-03 20:50:20 +02:00
|
|
|
name: Run Tests
|
2022-08-03 19:00:37 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-10-26 18:42:29 +02:00
|
|
|
container: ubuntu:jammy
|
2023-02-07 01:05:34 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
python_version:
|
2023-02-07 06:57:42 +01:00
|
|
|
- '3.9'
|
|
|
|
- '3.10'
|
2023-06-29 23:54:51 +02:00
|
|
|
- '3.11'
|
2023-10-26 18:42:29 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-02-07 06:57:42 +01:00
|
|
|
steps:
|
2022-08-03 19:00:37 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-08-17 04:55:46 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-12-15 07:15:49 +01:00
|
|
|
|
2023-02-07 01:05:34 +01:00
|
|
|
- name: Set up Python
|
2022-08-03 19:00:37 +02:00
|
|
|
uses: actions/setup-python@v4
|
2021-09-30 13:36:00 +02:00
|
|
|
with:
|
2023-02-07 01:05:34 +01:00
|
|
|
python-version: ${{ matrix.python_version }}
|
2021-12-15 07:15:49 +01:00
|
|
|
|
2023-10-26 18:42:29 +02:00
|
|
|
- name: Install Git
|
|
|
|
run: |
|
|
|
|
apt update && apt install -y git
|
|
|
|
|
2023-03-01 17:56:39 +01:00
|
|
|
- name: ⏬️ Install Dependencies
|
2023-10-26 18:42:29 +02:00
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
2022-08-03 19:00:37 +02:00
|
|
|
run: |
|
2023-11-06 00:09:40 +01:00
|
|
|
apt update && apt install -y libegl1 sqlite3 libsqlite3-dev libsqlite3-0 ffmpeg libsm6 libxext6
|
2023-10-26 18:42:29 +02:00
|
|
|
|
|
|
|
- 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
|
2022-08-03 19:00:37 +02:00
|
|
|
python -m pip install --upgrade pip
|
2022-08-03 21:37:16 +02:00
|
|
|
|
2023-03-01 17:56:39 +01:00
|
|
|
- name: ⬇️ Install Application
|
2023-10-26 18:42:29 +02:00
|
|
|
run: sed -i 's/dynamic = \["version"\]/version = "0.0.0"/' pyproject.toml && pip install --upgrade .[dev]
|
2021-12-15 07:15:49 +01:00
|
|
|
|
2023-03-01 17:56:39 +01:00
|
|
|
- name: 🧪 Test Application
|
2023-10-26 18:42:29 +02:00
|
|
|
env:
|
|
|
|
POSTGRES_HOST: postgres
|
|
|
|
POSTGRES_PORT: 5432
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: postgres
|
2023-02-17 19:07:59 +01:00
|
|
|
run: pytest
|
2023-08-17 04:55:46 +02:00
|
|
|
timeout-minutes: 10
|