-
Notifications
You must be signed in to change notification settings - Fork 391
132 lines (114 loc) · 5.37 KB
/
integration-test-workflow-debian.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: R2R CLI Integration and Regression Test
on:
push:
branches:
- '**' # Trigger on all branches
workflow_dispatch: # Allow manual trigger
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
actions: write
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TELEMETRY_ENABLED: false
POSTGRES_HOST: localhost
POSTGRES_DBNAME: postgres
POSTGRES_PORT: 5432
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
R2R_PROJECT_NAME: r2r_default
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10' # Use a stable Python version
- name: Install Poetry and dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
cd py && poetry install -E core -E ingestion-bundle
- name: Remove pre-installed PostgreSQL
run: |
sudo apt-get purge -y 'postgresql-*'
sudo rm -rf /var/lib/postgresql
sudo rm -rf /var/log/postgresql
sudo rm -rf /etc/postgresql
- name: Add PostgreSQL Apt Repository
run: |
# Add the PostgreSQL Apt repository
echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
# Download and add the repository GPG key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg
- name: Install PostgreSQL 15 and pgvector
run: |
sudo apt-get update
sudo apt-get install -y postgresql-15 postgresql-client-15 postgresql-15-pgvector
- name: Start PostgreSQL 15 service
run: |
sudo systemctl enable postgresql@15-main
sudo systemctl start postgresql@15-main
- name: Configure PostgreSQL
run: |
# Change to a directory accessible by the postgres user to avoid permission warnings
cd /
sudo -u postgres /usr/lib/postgresql/15/bin/psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres /usr/lib/postgresql/15/bin/psql -c "CREATE EXTENSION vector;"
- name: Start R2R server
working-directory: ./py
run: |
poetry run r2r serve &
echo "Waiting for services to start..."
sleep 30
- name: Run CLI Ingestion
working-directory: ./py
run: |
poetry run python tests/integration/harness_cli.py test_ingest_sample_file_cli
poetry run python tests/integration/harness_cli.py test_document_overview_sample_file_cli
poetry run python tests/integration/harness_cli.py test_document_chunks_sample_file_cli
poetry run python tests/integration/harness_cli.py test_delete_and_reingest_sample_file_cli
- name: Run CLI Retrieval
working-directory: ./py
run: |
poetry run python tests/integration/harness_cli.py test_vector_search_sample_file_filter_cli
poetry run python tests/integration/harness_cli.py test_rag_response_sample_file_cli
poetry run python tests/integration/harness_cli.py test_rag_response_stream_sample_file_cli
- name: Run SDK Ingestion
working-directory: ./py
run: |
poetry run python tests/integration/harness_sdk.py test_ingest_sample_file_sdk
poetry run python tests/integration/harness_sdk.py test_reingest_sample_file_sdk
poetry run python tests/integration/harness_sdk.py test_document_overview_sample_file_sdk
poetry run python tests/integration/harness_sdk.py test_document_chunks_sample_file_sdk
poetry run python tests/integration/harness_sdk.py test_delete_and_reingest_sample_file_sdk
poetry run python tests/integration/harness_sdk.py test_ingest_sample_file_with_config_sdk
- name: Run SDK Retrieval
working-directory: ./py
run: |
poetry run python tests/integration/harness_sdk.py test_vector_search_sample_file_filter_sdk
poetry run python tests/integration/harness_sdk.py test_hybrid_search_sample_file_filter_sdk
poetry run python tests/integration/harness_sdk.py test_rag_response_sample_file_sdk
- name: Run SDK Auth
working-directory: ./py
run: |
poetry run python tests/integration/harness_sdk.py test_user_registration_and_login
poetry run python tests/integration/harness_sdk.py test_duplicate_user_registration
poetry run python tests/integration/harness_sdk.py test_token_refresh
poetry run python tests/integration/harness_sdk.py test_user_document_management
poetry run python tests/integration/harness_sdk.py test_user_search_and_rag
poetry run python tests/integration/harness_sdk.py test_user_password_management
poetry run python tests/integration/harness_sdk.py test_user_profile_management
poetry run python tests/integration/harness_sdk.py test_user_logout
- name: Stop R2R server
if: always()
run: ps aux | grep "r2r serve" | awk '{print $2}' | xargs kill || true
- name: Uninstall PostgreSQL after tests (Optional)
if: always()
run: |
sudo apt-get purge -y 'postgresql-*'
sudo rm -rf /var/lib/postgresql
sudo rm -rf /var/log/postgresql
sudo rm -rf /etc/postgresql