-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (69 loc) · 2.83 KB
/
python-app.yml
File metadata and controls
89 lines (69 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This workflow will install pgvector docker image, Python dependencies, run tests
name: docling_pgvector_test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
services:
pgvector:
image: pgvector/pgvector:pg17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: vectordb
ports:
- 5432:5432
steps:
- uses: actions/checkout@v5
- name: check running containers state
run: docker ps
- name: Check available images
run: docker images
- name: Install postgres client tools required for psql command
run: sudo apt-get install -y postgresql-client
- name: Create vectordb database
run: |
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres \
-c "CREATE DATABASE vectordb;" || echo "DB already exists, continuing..."
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d vectordb \
-c "CREATE EXTENSION IF NOT EXISTS vector;"
- name: Verify database and extension
run: |
# check database exists
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres \
-c "SELECT datname FROM pg_database WHERE datname='vectordb';" \
| grep vectordb && echo "vectordb exists" || exit 1
- name: Install uv
uses: astral-sh/setup-uv@v7 # official uv action
with:
enable-cache: true # caches deps between runs
python-version: "3.12"
- name: Install all dependencies
run: uv sync # reads pyproject.toml + uv.lock
- name: Install all project in editable mode
run: uv pip install -e .
- name: Download test PDF
run: |
mkdir -p ./data
curl -L https://arxiv.org/pdf/1706.03762 -o ./data/test.pdf
ls -la ./data/
- name: Validate pdf file Integrity
run: head -c 5 ./data/test.pdf | grep -q '%PDF-' || (echo "Invalid PDF" && exit 1)
- name: Check if import works
run: uv run python -c "from pgvector_client import PGVectorClient; print('Import OK')"
- name: Run pytest
run: uv run pytest test/pgpytest.py -v -s
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/vectordb
- name: Run internal docling test
run: uv run python -m test.docling_test
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/vectordb
- name: Run internal document processor test
run: uv run python -m test.document_processor_test
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/vectordb