-
Notifications
You must be signed in to change notification settings - Fork 393
435 lines (378 loc) · 19.3 KB
/
tests.yml
File metadata and controls
435 lines (378 loc) · 19.3 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
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
name: Runnability tests for DAIv3 oak-examples
on:
workflow_dispatch:
inputs:
distinct_id:
description: 'run identifier'
required: false
dai_versions:
description: "DepthAI & depthai-nodes versions in the form: depthai=<ver>,nodes=<ver> (e.g. depthai=2.26.0,nodes=1.9.0). Each key is optional."
required: false
python_version:
description: 'Python version to use. By default 3.8, 3.10 and 3.12 are used but you can use only one by passing only `3.8`, `3.10` or `3.12`.'
default: "all"
required: false
log_level:
description: 'Log level to use for pytest.'
type: choice
options:
- ERROR
- INFO
- DEBUG
default: INFO
required: false
reservation_name:
description: 'Reservation name - usually usually unique identifier of root CI run'
required: false
type: string
platform:
description: 'Platform to use for testing. By default both RVC2 and RVC4 are used but you can use only one by passing only `rvc2` or `rvc4`(use lowercase).'
default: "all"
required: false
root_dir:
decription: 'One or more space-separated paths to example directories you want to test. Defaults to "." (all).'
default: "."
required: false
strict_mode:
description: "If set to 'yes', tests will fail on DepthAI warnings."
type: choice
options:
- "yes"
- "no"
default: "no"
required: false
additional_options:
required: false
type: string
subtests:
description: "System OS and type of tests (e.g. os=windows,subtests=peripheral). Each key is optional and defaults to all."
required: false
type: string
default: "os=all,subtests=all"
jobs:
id:
name: Workflow ID Provider
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
setup:
runs-on: ubuntu-latest
outputs:
matrix_platform: ${{ steps.set-matrix.outputs.platform }}
matrix_python: ${{ steps.set-matrix.outputs.python }}
dai_version: ${{ steps.set-matrix.outputs.dai_version }}
dai_nodes_version: ${{ steps.set-matrix.outputs.dai_nodes_version }}
os: ${{ steps.set-matrix.outputs.os }}
subtests: ${{ steps.set-matrix.outputs.subtests_kind }}
steps:
- id: set-matrix
env:
INPUT_PLATFORM: ${{ github.event.inputs.platform }}
INPUT_PYTHON: ${{ github.event.inputs.python_version }}
INPUT_DAI_VERSIONS: ${{ github.event.inputs.dai_versions }}
INPUT_SUBTESTS: ${{ github.event.inputs.subtests }}
run: |
# Matrix platform
if [ "$INPUT_PLATFORM" = "all" ] || [ -z "$INPUT_PLATFORM" ]; then
echo 'platform=["rvc2","rvc4"]' >> "$GITHUB_OUTPUT"
else
echo "platform=[\"$INPUT_PLATFORM\"]" >> "$GITHUB_OUTPUT"
fi
# Matrix python
if [ "$INPUT_PYTHON" = "all" ] || [ -z "$INPUT_PYTHON" ]; then
echo 'python=["3.8", "3.10", "3.12"]' >> "$GITHUB_OUTPUT"
else
echo "python=[\"$INPUT_PYTHON\"]" >> "$GITHUB_OUTPUT"
fi
# Parse combined versions input like: depthai=2.26.0,nodes=1.9.0
DAI_VERSION=""
DAI_NODES_VERSION=""
if [ -n "$INPUT_DAI_VERSIONS" ]; then
S="$(echo "$INPUT_DAI_VERSIONS" | tr -d '[:space:]')" # strip spaces
if echo "$S" | grep -qi 'depthai='; then
DAI_VERSION="$(printf '%s' "$S" | sed -n 's/.*depthai=\([^,]*\).*/\1/p')"
fi
if echo "$S" | grep -qi 'nodes='; then
DAI_NODES_VERSION="$(printf '%s' "$S" | sed -n 's/.*nodes=\([^,]*\).*/\1/p')"
fi
fi
echo "dai_version=$DAI_VERSION" >> "$GITHUB_OUTPUT"
echo "dai_nodes_version=$DAI_NODES_VERSION" >> "$GITHUB_OUTPUT"
# Parse subtests input like: os=windows,subtests=peripheral
OS_VAL=""
SUBTESTS_KIND=""
if [ -n "$INPUT_SUBTESTS" ]; then
S2="$(echo "$INPUT_SUBTESTS" | tr -d '[:space:]')" # strip spaces
if echo "$S2" | grep -qi 'os='; then
OS_VAL="$(printf '%s' "$S2" | sed -n 's/.*os=\([^,]*\).*/\1/p')"
fi
if echo "$S2" | grep -qi 'subtests='; then
SUBTESTS_KIND="$(printf '%s' "$S2" | sed -n 's/.*subtests=\([^,]*\).*/\1/p')"
fi
fi
echo "os=$OS_VAL" >> "$GITHUB_OUTPUT"
echo "subtests_kind=$SUBTESTS_KIND" >> "$GITHUB_OUTPUT"
test_peripheral:
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'linux') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'peripheral')
strategy:
matrix:
python-version: ${{ fromJSON(needs.setup.outputs.matrix_python) }}
platform: ${{ fromJSON(needs.setup.outputs.matrix_platform) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Set model variable
run: |
if [ "${{ matrix.platform }}" = "rvc2" ]; then
echo "MODEL=oak_d_s2" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "rvc4" ]; then
echo "MODEL=oak4_pro or oak4_d" >> $GITHUB_ENV
fi
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}-${{ matrix.platform }}"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
ENV_VARS="\
--env PLATFORM=${{ matrix.platform }} \
--env DAI_VERSION=${{ needs.setup.outputs.dai_version }} \
--env DAI_NODES_VERSION=${{ needs.setup.outputs.dai_nodes_version }} \
--env PYTHON_VERSION_ENV=${{ matrix.python-version }} \
--env LOG_LEVEL=${{ github.event.inputs.log_level }} \
--env ROOT_DIR='${{ github.event.inputs.root_dir }}' \
--env STRICT_MODE='${{ github.event.inputs.strict_mode }}' "
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --models "$MODEL" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --sync-workspace \
--dockerfile ./tests/Dockerfile_peripheral \
--docker-build-args "--build-arg PYTHON_VERSION=${{ matrix.python-version }}" \
--docker-run-args "$ENV_VARS"
test_peripheral_windows:
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'windows') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'peripheral')
strategy:
matrix:
python-version: ["3.12"]
platform: ["rvc4"] #for now
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Set model variable
run: |
if [ "${{ matrix.platform }}" = "rvc2" ]; then
echo "MODEL=oak_d_s2" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "rvc4" ]; then
echo "MODEL=oak4_pro or oak4_d" >> $GITHUB_ENV
fi
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}-${{ matrix.platform }}-windows"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --models "$MODEL" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --sync-workspace -os windows --basic-sanity \
--commands "cd %TEMP%\oak-examples && tests\run_tests_peripheral.cmd ${{ matrix.python-version }} ${{ matrix.platform }} ${{ github.event.inputs.strict_mode }} ${{ github.event.inputs.root_dir }} ${{ github.event.inputs.log_level }} ${{ needs.setup.outputs.dai_version }} ${{ needs.setup.outputs.dai_nodes_version }}"
test_peripheral_mac:
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'mac') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'peripheral')
strategy:
matrix:
python-version: ["3.12"]
platform: ["rvc4"] #for now
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Set model variable
run: |
if [ "${{ matrix.platform }}" = "rvc2" ]; then
echo "MODEL=oak_d_s2" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "rvc4" ]; then
echo "MODEL=oak4_pro or oak4_d" >> $GITHUB_ENV
fi
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}-${{ matrix.platform }}-mac"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --models "$MODEL" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --sync-workspace -os mac --basic-sanity \
--commands "cd /tmp/oak-examples && tests/run_tests_peripheral.sh ${{ matrix.python-version }} ${{ matrix.platform }} ${{ github.event.inputs.strict_mode }} ${{ github.event.inputs.root_dir }} ${{ github.event.inputs.log_level }} ${{ needs.setup.outputs.dai_version }} ${{ needs.setup.outputs.dai_nodes_version }}"
test_standalone:
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'linux') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'standalone')
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#standalone"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
ENV_VARS="\
--env PLATFORM="rvc4" \
--env DAI_VERSION=${{ needs.setup.outputs.dai_version }} \
--env DAI_NODES_VERSION=${{ needs.setup.outputs.dai_nodes_version }} \
--env PYTHON_VERSION_ENV="3.10" \
--env LOG_LEVEL=${{ github.event.inputs.log_level }} \
--env ROOT_DIR='${{ github.event.inputs.root_dir }}' \
--env STRICT_MODE='${{ github.event.inputs.strict_mode }}' \
--env DEVICE_PASSWORD=${{ secrets.DEVICE_PASSWORD }}\
--env LOCAL_STATIC_REGISTRY=${{ secrets.LOCAL_STATIC_REGISTRY }}"
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --models "oak4_pro or oak4_d" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --oakctl --sync-workspace \
--dockerfile ./tests/Dockerfile_standalone \
--docker-build-args "--build-arg PYTHON_VERSION=3.12" \
--docker-run-args "$ENV_VARS"
test_standalone_windows:
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'windows') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'standalone')
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#standalone-windows"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --no-shell --models "oak4_pro or oak4_d" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --sync-workspace -os windows --basic-sanity --oakctl \
--commands "cd %TEMP%\oak-examples && tests\run_tests_standalone.cmd 3.10 rvc4 ${{ secrets.DEVICE_PASSWORD }} ${{ secrets.LOCAL_STATIC_REGISTRY }} ${{ github.event.inputs.root_dir }} ${{ github.event.inputs.log_level }} ${{ needs.setup.outputs.dai_version }} ${{ needs.setup.outputs.dai_nodes_version }}"
test_standalone_mac:
if: >
(needs.setup.outputs.os == 'all' || needs.setup.outputs.os == 'mac') &&
(needs.setup.outputs.subtests == 'all' || needs.setup.outputs.subtests == 'standalone')
needs: [setup]
runs-on: ["self-hosted", "testbed-runner"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install HIL
run: |
pip install hil_framework --upgrade --index-url https://__token__:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/api/v4/projects/213/packages/pypi/simple
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#standalone-mac"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
if [[ "${{ github.event.inputs.reservation_name }}" == https://github.com/luxonis/* ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ -n "${{ github.event.inputs.additional_options }}" ]]; then
ADDITIONAL_OPTIONS="${{ github.event.inputs.additional_options }}"
fi
exec hil_runner --models "oak4_pro or oak4_d" $RESERVATION_OPTION $HOLD_RESERVATION --wait $ADDITIONAL_OPTIONS --sync-workspace -os mac --basic-sanity --oakctl \
--commands "cd /tmp/oak-examples && tests/run_tests_standalone.sh 3.10 rvc4 ${{ secrets.DEVICE_PASSWORD }} ${{ secrets.LOCAL_STATIC_REGISTRY }} ${{ github.event.inputs.root_dir }} ${{ github.event.inputs.log_level }} ${{ needs.setup.outputs.dai_version }} ${{ needs.setup.outputs.dai_nodes_version }}"