77 branches : [ main ]
88
99env :
10- # Mark as CI environment
11- CI : true
12-
13- # Use repository secrets for API keys
1410 TEXT_LLM_API_KEY : ${{ secrets.TEXT_LLM_API_KEY }}
1511 OCR_LLM_API_KEY : ${{ secrets.OCR_LLM_API_KEY }}
16-
17- # Service configuration
18- NEO4J_PASSWORD : testpassword123
19- DJANGO_SETTINGS_MODULE : backend.settings
20-
21- # Mark as GitHub Actions for settings.py
2212 GITHUB_ACTIONS : true
2313
2414jobs :
2515 test :
2616 runs-on : ubuntu-latest
2717
28- services :
29- neo4j :
30- image : neo4j:latest
31- env :
32- NEO4J_AUTH : neo4j/testpassword123
33- NEO4J_apoc_export_file_enabled : true
34- NEO4J_dbms_connector_bolt_listen__address : 0.0.0.0:7687
35- NEO4J_dbms_connector_http_listen__address : 0.0.0.0:7474
36- ports :
37- - 7687:7687
38- - 7474:7474
39- options : >-
40- --health-cmd "wget --no-verbose --tries=1 --spider http://localhost:7474 || exit 1"
41- --health-interval 10s
42- --health-timeout 5s
43- --health-retries 10
44- --health-start-period 30s
45-
46- qdrant :
47- image : qdrant/qdrant:latest
48- ports :
49- - 6333:6333
50- options : >-
51- --health-cmd "wget --no-verbose --tries=1 --spider http://localhost:6333/health || exit 1"
52- --health-interval 10s
53- --health-timeout 5s
54- --health-retries 5
55-
56- redis :
57- image : redis:alpine
58- ports :
59- - 6379:6379
60- options : >-
61- --health-cmd "redis-cli ping"
62- --health-interval 10s
63- --health-timeout 5s
64- --health-retries 5
65-
6618 steps :
67- - uses : actions/checkout@v3
19+ - name : Checkout code
20+ uses : actions/checkout@v3
6821
6922 - name : Set up Python
7023 uses : actions/setup-python@v4
@@ -76,169 +29,28 @@ jobs:
7629 curl -LsSf https://astral.sh/uv/install.sh | sh
7730 echo "$HOME/.cargo/bin" >> $GITHUB_PATH
7831
79- - name : Create virtual environment
80- run : |
81- cd backend
82- uv venv
83-
84- - name : Install dependencies
32+ - name : Start services with docker-compose
8533 run : |
86- cd backend
87- source .venv/bin/activate
88- uv pip install -r ../requirements-test.txt
89- uv pip install -e .
90-
91- - name : Wait for services
92- run : |
93- cd backend
94- source .venv/bin/activate
95- python -c "
96- import time
97- import sys
98- from neo4j import GraphDatabase
99- from qdrant_client import QdrantClient
100- import redis
101-
102- # Wait for Neo4j
103- for i in range(30) :
104- try :
105- driver = GraphDatabase.driver('bolt://localhost:7687', auth=('neo4j', 'testpassword123'))
106- with driver.session() as session :
107- session.run('RETURN 1')
108- driver.close()
109- print('Neo4j is ready')
110- break
111- except Exception as e :
112- if i == 29 :
113- print(f'Neo4j failed to start : {e}')
114- sys.exit(1)
115- time.sleep(2)
34+ docker compose up -d neo4j redis qdrant
11635
117- # Wait for Qdrant
118- for i in range(30) :
119- try :
120- client = QdrantClient(host='localhost', port=6333)
121- client.get_collections()
122- print('Qdrant is ready')
123- break
124- except Exception as e :
125- if i == 29 :
126- print(f'Qdrant failed to start : {e}')
127- sys.exit(1)
128- time.sleep(2)
36+ # Wait for services to be ready
37+ echo "Waiting for services to start..."
38+ sleep 10
12939
130- # Wait for Redis
131- for i in range(30) :
132- try :
133- r = redis.Redis(host='localhost', port=6379)
134- r.ping()
135- r.close()
136- print('Redis is ready')
137- break
138- except Exception as e :
139- if i == 29 :
140- print(f'Redis failed to start : {e}')
141- sys.exit(1)
142- time.sleep(2)
143- "
40+ # Check services are healthy
41+ docker compose ps
14442
145- - name: Run Core Tests
43+ - name : Install backend dependencies
14644 run : |
14745 cd backend
148- source .venv/bin/activate
149- python -m pytest core/tests.py -v --tb=short
150- env:
151- NEO4J_URI: bolt://localhost:7687
152- NEO4J_USERNAME: neo4j
153- NEO4J_PASSWORD: testpassword123
154- QDRANT_HOST: localhost
155- QDRANT_PORT: 6333
156- REDIS_HOST: localhost
157- REDIS_PORT: 6379
46+ uv sync --all-groups
15847
159- - name: Run Processor Tests
48+ - name : Run tests
16049 run : |
16150 cd backend
162- source .venv/bin/activate
163- python -m pytest processor/tests.py -v --tb=short
164- env:
165- NEO4J_URI: bolt://localhost:7687
166- NEO4J_USERNAME: neo4j
167- NEO4J_PASSWORD: testpassword123
168- QDRANT_HOST: localhost
169- QDRANT_PORT: 6333
170- REDIS_HOST: localhost
171- REDIS_PORT: 6379
172-
173- - name: Run Search Tests
174- run: |
175- cd backend
176- source .venv/bin/activate
177- python -m pytest search/tests.py -v --tb=short
178- env:
179- NEO4J_URI: bolt://localhost:7687
180- NEO4J_USERNAME: neo4j
181- NEO4J_PASSWORD: testpassword123
182- QDRANT_HOST: localhost
183- QDRANT_PORT: 6333
184- REDIS_HOST: localhost
185- REDIS_PORT: 6379
186-
187- - name: Run Storage Tests
188- run: |
189- cd backend
190- source .venv/bin/activate
191- python -m pytest storage/tests.py -v --tb=short
192- env:
193- NEO4J_URI: bolt://localhost:7687
194- NEO4J_USERNAME: neo4j
195- NEO4J_PASSWORD: testpassword123
196- QDRANT_HOST: localhost
197- QDRANT_PORT: 6333
198- REDIS_HOST: localhost
199- REDIS_PORT: 6379
200-
201- - name: Cleanup Test Data
202- if: always()
203- run: |
204- cd backend
205- source .venv/bin/activate
206- python -c "
207- from neo4j import GraphDatabase
208- from qdrant_client import QdrantClient
209- import redis
210-
211- try :
212- # Clean Neo4j
213- driver = GraphDatabase.driver('bolt://localhost:7687', auth=('neo4j', 'testpassword123'))
214- with driver.session() as session :
215- session.run('MATCH (n) WHERE n.uid STARTS WITH \"test_\" DETACH DELETE n')
216- driver.close()
217- print('Neo4j cleaned')
218- except :
219- pass
220-
221- try :
222- # Clean Qdrant
223- client = QdrantClient(host='localhost', port=6333)
224- client.delete_collection('test_cv_key_points')
225- print('Qdrant cleaned')
226- except :
227- pass
228-
229- try :
230- # Clean Redis
231- r = redis.Redis(host='localhost', port=6379)
232- for key in r.scan_iter('test_cv:*') :
233- r.delete(key)
234- r.close()
235- print('Redis cleaned')
236- except :
237- pass
238- "
51+ .venv/bin/python manage.py test --verbosity=2
23952
240- - name: Test Report
53+ - name : Stop services
24154 if : always()
24255 run : |
243- echo " Test suite completed"
244- echo "Core, Processor, Search, and Storage tests have been executed"
56+ docker compose down -v
0 commit comments