-
Notifications
You must be signed in to change notification settings - Fork 12
178 lines (146 loc) · 5.33 KB
/
milvus-integration.yml
File metadata and controls
178 lines (146 loc) · 5.33 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Milvus Integration Tests
on:
push:
branches: [ main, develop ]
paths:
- 'server/storage/milvus/**'
- 'docker-compose.milvus.yml'
- '.github/workflows/milvus-integration.yml'
pull_request:
branches: [ main ]
paths:
- 'server/storage/milvus/**'
- 'docker-compose.milvus.yml'
- '.github/workflows/milvus-integration.yml'
workflow_dispatch:
inputs:
run_performance_tests:
description: 'Run performance tests'
required: false
default: 'false'
type: boolean
env:
MILVUS_INTEGRATION_TESTS: true
MILVUS_TEST_HOST: localhost
MILVUS_TEST_PORT: 19530
MILVUS_TEST_USER: ""
MILVUS_TEST_PASSWORD: ""
jobs:
milvus-integration:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libavdevice-dev ffmpeg libsox-fmt-all sox
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.0
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install
poetry run pip install pymilvus
- name: Start Milvus services
run: |
docker compose -f docker-compose.milvus.yml up -d
# Wait for services to be ready
echo "Waiting for services to start..."
sleep 30
# Wait for etcd
timeout 120 bash -c 'until docker exec milvus-etcd etcdctl endpoint health; do sleep 5; done'
# Wait for minio
timeout 120 bash -c 'until curl -f http://localhost:9000/minio/health/live; do sleep 5; done'
# Wait for milvus
timeout 180 bash -c 'until curl -f http://localhost:9091/healthz; do sleep 10; done'
echo "All services are ready!"
- name: Verify Milvus connection
run: |
poetry run python -c "
from pymilvus import connections, utility
try:
connections.connect(host='localhost', port='19530')
version = utility.get_server_version()
print(f'Successfully connected to Milvus version: {version}')
connections.disconnect('default')
except Exception as e:
print(f'Failed to connect to Milvus: {e}')
exit(1)
"
- name: Run Milvus integration tests
run: |
poetry run pytest server/storage/milvus/test_milvus_integration.py -v -m "not performance" --tb=short
- name: Run performance tests
if: ${{ github.event.inputs.run_performance_tests == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
poetry run pytest server/storage/milvus/test_milvus_integration.py -v -m "performance" --tb=short
- name: Show Milvus logs on failure
if: failure()
run: |
echo "=== Milvus logs ==="
docker logs milvus-standalone
echo "=== etcd logs ==="
docker logs milvus-etcd
echo "=== MinIO logs ==="
docker logs milvus-minio
- name: Cleanup
if: always()
run: |
docker compose -f docker-compose.milvus.yml down -v
docker system prune -f
milvus-compatibility:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
strategy:
matrix:
milvus-version: ["v2.4.15", "v2.4.0", "v2.3.0"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install Poetry and dependencies
run: |
pip install poetry==1.8.0
poetry install
poetry run pip install pymilvus
- name: Test with Milvus ${{ matrix.milvus-version }}
run: |
# Modify docker compose to use specific Milvus version
sed -i 's/milvusdb\/milvus:v[0-9.]\+/milvusdb\/milvus:${{ matrix.milvus-version }}/g' docker-compose.milvus.yml
# Start services
docker compose -f docker-compose.milvus.yml up -d
# Wait for services
sleep 60
timeout 180 bash -c 'until curl -f http://localhost:9091/healthz; do sleep 10; done'
# Set test environment
export MILVUS_INTEGRATION_TESTS=true
export MILVUS_TEST_HOST=localhost
export MILVUS_TEST_PORT=19530
# Run basic compatibility tests
poetry run pytest server/storage/milvus/test_milvus_integration.py::TestMilvusIntegration::test_connection_establishment -v
poetry run pytest server/storage/milvus/test_milvus_integration.py::TestMilvusIntegration::test_save_and_retrieve_vcon -v
- name: Cleanup
if: always()
run: |
docker compose -f docker-compose.milvus.yml down -v