-
Notifications
You must be signed in to change notification settings - Fork 120
296 lines (279 loc) · 8.77 KB
/
tests.yaml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: Tests
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- 'main'
paths:
- 'server/**'
- 'python-sdk/**'
- '.github/workflows/tests.yaml'
env:
CARGO_TERM_COLOR: always
jobs:
lint_server:
name: Lint Indexify Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint indexify-server
run: |
cd server
make check
build_server:
name: Build Indexify Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy rust-toolchain
run: cp server/rust-toolchain.toml .
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-directories: |
server/target
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-directories: |
server/target
- name: Build indexify-server
run: |
cd server
cargo build
- name: Lint indexify-server
run: |
cd server
make check
- name: Test indexify-server
run: |
cd server
cargo test --workspace -- --test-threads 1
- name: Upload indexify-server
uses: actions/upload-artifact@v4
with:
name: indexify-server
path: server/target/debug/indexify-server
lint_python_sdk:
name: Lint Indexify Python SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'poetry'
- name: Build python-sdk
run: |
cd python-sdk
make build
- name: Lint python-sdk
run: |
cd python-sdk
make check
acceptance_tests:
name: Run Acceptance Tests
needs: [build_server, lint_python_sdk]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download indexify-server
uses: actions/download-artifact@v4
with:
name: indexify-server
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'poetry'
- name: Build python-sdk
run: |
cd python-sdk
make build
- name: Lint python-sdk
run: |
cd python-sdk
make check
- name: Start Background Indexify Server
uses: JarvusInnovations/background-action@v1
with:
run: |
chmod u+x ./indexify-server
RUST_LOG=debug ./indexify-server &
echo $! > /tmp/indexify-server.pid &
wait-on: |
tcp:localhost:8900
tail: true
wait-for: 30s
log-output: true
# always logging the output to debug test failures.
log-output-if: true
- name: Start Background Indexify Executor
uses: JarvusInnovations/background-action@v1
with:
run: |
cd python-sdk
poetry run indexify-cli executor &
echo $! > /tmp/indexify-executor.pid &
wait-on: |
tcp:localhost:8900
tail: true
wait-for: 10s
log-output: true
# always logging the output to debug test failures.
log-output-if: true
- name: Wait for readiness
run: |
serverReady=false
counter=0
while [ "$serverReady" != true ]; do
output=$(curl --silent --fail http://localhost:8900/internal/executors | jq '. | length' 2>/dev/null)
if [[ $? -eq 0 && "$output" -ge 1 ]]; then
echo "Server ready with executors."
serverReady=true
else
echo 'Waiting for executors to join server...'
counter=$((counter+1))
if [ $counter -gt 6 ]; then
echo "Timeout waiting for executors to join server."
exit 1
fi
sleep 5
fi
done
- name: Run All Tests
run: |
cd python-sdk
export INDEXIFY_URL=http://localhost:8900
make test
- name: Terminate processes
# We want to test clean termination of processes.
run: |
pkill -SIGTERM -F /tmp/indexify-server.pid
pkill -SIGTERM -F /tmp/indexify-executor.pid
- name: Wait for processes termination
run: |
pid_files="/tmp/indexify-server.pid /tmp/indexify-executor.pid"
for pid_file in $pid_files; do
while pkill -0 -F "$pid_file" 2>/dev/null; do
echo "waiting for process $pid_file to exit..."
sleep 1
done
done
- name: Validate that all processes terminated
run: |
if pgrep -f indexify; then
echo "Error: Some Indexify processes are still running."
exit 1
fi
last_release_acceptance_tests:
name: 'Last Release Acceptance Tests (trigger with label: ci_compat_test)'
if: contains(github.event.pull_request.labels.*.name, 'ci_compat_test')
needs: [build_server, lint_python_sdk]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout latest
run: |
git fetch --tags
latestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
git checkout $latestTag
- name: Download indexify-server
uses: actions/download-artifact@v4
with:
name: indexify-server
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'poetry'
- name: Build python-sdk
run: |
cd python-sdk
make build
- name: Start Background Indexify Server
uses: JarvusInnovations/background-action@v1
with:
run: |
chmod u+x ./indexify-server
RUST_LOG=debug ./indexify-server &
echo $! > /tmp/indexify-server.pid &
wait-on: |
tcp:localhost:8900
tail: true
wait-for: 30s
log-output: true
# always logging the output to debug test failures.
log-output-if: true
- name: Start Background Indexify Executor
uses: JarvusInnovations/background-action@v1
with:
run: |
cd python-sdk
poetry run indexify-cli executor &
echo $! > /tmp/indexify-executor.pid &
wait-on: |
tcp:localhost:8900
tail: true
wait-for: 10s
log-output: true
# always logging the output to debug test failures.
log-output-if: true
- name: Wait for readiness
run: |
serverReady=false
counter=0
while [ "$serverReady" != true ]; do
output=$(curl --silent --fail http://localhost:8900/internal/executors | jq '. | length' 2>/dev/null)
if [[ $? -eq 0 && "$output" -ge 1 ]]; then
echo "Server ready with executors."
serverReady=true
else
echo 'Waiting for executors to join server...'
counter=$((counter+1))
if [ $counter -gt 6 ]; then
echo "Timeout waiting for executors to join server."
exit 1
fi
sleep 5
fi
done
- name: Run All Tests
run: |
cd python-sdk
export INDEXIFY_URL=http://localhost:8900
make test
- name: Terminate processes
# We want to test clean termination of processes.
run: |
pkill -SIGTERM -F /tmp/indexify-server.pid
pkill -SIGTERM -F /tmp/indexify-executor.pid
- name: Wait for processes termination
run: |
pid_files="/tmp/indexify-server.pid /tmp/indexify-executor.pid"
for pid_file in $pid_files; do
while pkill -0 -F "$pid_file" 2>/dev/null; do
echo "waiting for process $pid_file to exit..."
sleep 1
done
done
- name: Validate that all processes terminated
run: |
if pgrep -f indexify; then
echo "Error: Some Indexify processes are still running."
exit 1
fi
build_release_packages:
name: Test Building Release Packages
needs: [build_server]
uses: ./.github/workflows/wf_build_indexify_server_release_packages.yaml