-
Notifications
You must be signed in to change notification settings - Fork 2.2k
842 lines (798 loc) · 32.2 KB
/
ci.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
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
name: CI
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
#on:
# push:
# branches-ignore:
# - '**' # temporally ignore all
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
lint-flake-8:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/,jina/resources/,jina/proto/docarray_v1,jina/proto/docarray_v2,jina/serve/consensus/add_voter/pb,jina/serve/consensus/add_voter/pb2
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/,jina/proto/docarray_v1,jina/proto/docarray_v2,jina/serve/consensus/add_voter/pb,jina/serve/consensus/add_voter/pb2
check-docstring:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- id: file_changes
uses: Ana06/[email protected]
- name: docstring check with darglint and pydocstyle
run: ./scripts/docstrings_lint.sh
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }}
check-black:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- id: file_changes
uses: Ana06/[email protected]
- name: check black
run: ./scripts/black.sh
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }}
code-injection:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.8
uses: actions/setup-python@v4
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
python-version: 3.8
- name: Styling
id: styling
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "Jina Dev Bot"
pip install ".[devel,black]"
pip install setuptools
cd scripts && bash ./devbot.sh && cd -
if [[ -z $(git status -s) ]]
then
echo "tree is clean"
else
git add -u
git commit -m "style: fix overload and cli autocomplete"
echo "IS_CHANGED=YES" >> $GITHUB_OUTPUT
fi
- name: Push changes to head ref
uses: ad-m/[email protected]
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
github_token: ${{ secrets.JINA_DEV_BOT }}
branch: ${{ github.head_ref }}
- name: Fail this pipelint
if: ${{ steps.styling.outputs.IS_CHANGED == 'YES' && !github.event.pull_request.head.repo.fork }}
run: exit 1
docker-image-test:
needs: [code-injection]
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
fail-fast: false
matrix:
test-arch: ["linux/amd64", "linux/arm64"]
steps:
# - name: Cancel Previous Runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}
- uses: actions/[email protected]
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
driver-opts: network=host
- run: |
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-aarch64
docker run --rm --privileged tonistiigi/binfmt --install all
- name: Build and test
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/debianx.Dockerfile
platforms: ${{ matrix.test-arch }}
push: true
tags: localhost:5000/jina/multiarch:latest
target: jina
- run: |
docker run --platform ${{ matrix.test-arch }} localhost:5000/jina/multiarch:latest -v
hub-test:
runs-on: ubuntu-latest
needs: [lint-flake-8, code-injection]
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
# - name: Cancel Previous Runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Test hubapp with hubpods
run: |
./tests/jinahub/test_integration.sh
timeout-minutes: 30
env:
JINAHUB_USERNAME: ${{ secrets.JINAHUB_USERNAME }}
JINAHUB_PASSWORD: ${{ secrets.JINAHUB_PASSWORD }}
k8s-flow-test:
needs: [lint-flake-8, code-injection]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
curl -LO https://dl.k8s.io/release/v1.21.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test k8s Flow
run: |
export LINKERD2_VERSION=stable-2.11.4
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
pytest -v -s --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml ./tests/k8s/test_k8s_flow.py
timeout-minutes: 30
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
k8s-deployment-test:
needs: [lint-flake-8, code-injection]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
curl -LO https://dl.k8s.io/release/v1.21.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test k8s Deployment
run: |
export LINKERD2_VERSION=stable-2.11.4
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
pytest -v -s --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml ./tests/k8s/test_k8s_deployment.py
timeout-minutes: 30
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
k8s-graceful-test:
needs: [lint-flake-8, code-injection]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
curl -LO https://dl.k8s.io/release/v1.21.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test graceful request handling on k8s
run: |
export LINKERD2_VERSION=stable-2.11.4
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
pytest -v -s --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml ./tests/k8s/test_k8s_graceful_request_handling.py
timeout-minutes: 45
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
k8s-failures-test:
needs: [ lint-flake-8, code-injection ]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
curl -LO https://dl.k8s.io/release/v1.21.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test k8s failures
run: |
export LINKERD2_VERSION=stable-2.11.4
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh
curl --proto '=https' --tlsv1.2 -sSfL https://linkerd.github.io/linkerd-smi/install | sh
pytest -v -s --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml ./tests/k8s/test_k8s_failures.py
timeout-minutes: 45
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
k8s-otel-test:
needs: [lint-flake-8, code-injection]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
curl -LO https://dl.k8s.io/release/v1.21.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test K8s with OpenTelemetry
run: |
pytest -v -s --cov=jina --cov-report=xml ./tests/k8s_otel
timeout-minutes: 30
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
docker-compose-test:
needs: [lint-flake-8, code-injection]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
pip install ".[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test docker compose
run: |
pytest -v -s --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml ./tests/docker_compose/test_*.py
timeout-minutes: 30
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
prep-testbed:
runs-on: ubuntu-latest
needs: [ lint-flake-8, code-injection]
steps:
- uses: actions/[email protected]
- id: set-matrix
run: |
sudo apt-get install jq
export value=$(bash scripts/get-all-test-paths.sh)
echo "matrix=$value" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
docarray-v-two-test:
needs: prep-testbed
runs-on: ubuntu-latest
env:
JINA_RANDOM_PORT_MIN: 16384
strategy:
fail-fast: false
matrix:
python-version: [3.8]
protobuf-version: ['==3.19.6', '']
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.19.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install git+https://github.com/jina-ai/setuptools-golang.git@feat-align-with-alaeddine-code
pip install cibuildwheel
- name: Build wheels with setuptools-golang-build-manylinux-wheel
run: |
setuptools-golang-build-manylinux-wheels --pythons cp38-cp38
- name: Prepare environment
run: |
docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[common,devel,test]" --no-cache-dir
if [[ "${{ matrix.protobuf-version }}" == "==3.19.6" ]]; then
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.47.5 grpcio-reflection==1.47.5 grpcio-health-checking==1.47.5
else
pip install -U protobuf${{ matrix.protobuf-version }}
fi
jina
export JINA_LOG_LEVEL="ERROR"
- name: Test
id: test
run: |
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/unit/serve/runtimes/test_helper.py
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/test_v2.py
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/deployment_http_composite
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/test_singleton.py
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/test_parameters_as_pydantic.py
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/test_streaming.py
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/csp
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/docarray_v2/docker
echo "flag it as jina for codeoverage"
echo "codecov_flag=jina" >> $GITHUB_OUTPUT
timeout-minutes: 45
env:
JINA_AUTH_TOKEN: "${{ secrets.JINA_AUTH_TOKEN }}"
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
stateful-docarray-v-two-test:
needs: prep-testbed
runs-on: ubuntu-latest
env:
JINA_RANDOM_PORT_MIN: 16384
strategy:
fail-fast: false
matrix:
python-version: [3.8]
protobuf-version: ['==3.19.6', '']
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.19.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install git+https://github.com/jina-ai/setuptools-golang.git@feat-align-with-alaeddine-code
pip install cibuildwheel
- name: Build wheels with setuptools-golang-build-manylinux-wheel
run: |
setuptools-golang-build-manylinux-wheels --pythons cp38-cp38
- name: Prepare environment
run: |
docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[common,devel,test]" --no-cache-dir
if [[ "${{ matrix.protobuf-version }}" == "==3.19.6" ]]; then
pip install -U protobuf${{ matrix.protobuf-version }} grpcio==1.47.5 grpcio-reflection==1.47.5 grpcio-health-checking==1.47.5
else
pip install -U protobuf${{ matrix.protobuf-version }}
fi
jina
export JINA_LOG_LEVEL="ERROR"
- name: Test stateful
id: test_stateful
run: |
JINA_LOG_LEVEL=DEBUG JINA_RANDOM_PORT_MAX="60535" pytest --suppress-no-test-exit-code --maxfail 1 --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/hub_usage/dummyhub*' tests/integration/stateful
echo "flag it as jina for codeoverage"
echo "codecov_flag=jina" >> $GITHUB_OUTPUT
timeout-minutes: 30
env:
JINA_AUTH_TOKEN: "${{ secrets.JINA_AUTH_TOKEN }}"
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
# Build the wheels for Linux and macOS for Python 3.8 and newer
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
# linux
- os: ubuntu-latest
python: '3.7'
python-manylinux-tag: "cp37-cp37m"
- os: ubuntu-latest
python: '3.8'
python-manylinux-tag: "cp38-cp38"
- os: ubuntu-latest
python: '3.9'
python-manylinux-tag: "cp39-cp39"
- os: ubuntu-latest
python: '3.10'
python-manylinux-tag: "cp310-cp310"
- os: ubuntu-latest
python: '3.11'
python-manylinux-tag: "cp311-cp311"
# MacOS emulated
- os: macos-latest
python: '3.8'
python-cibuildwheels: '38'
platform_id: macosx_x86_64
arch: x86_64
goarch: amd64
- os: macos-latest
python: '3.9'
python-cibuildwheels: '39'
platform_id: macosx_x86_64
arch: x86_64
goarch: amd64
- os: macos-latest
python: '3.10'
python-cibuildwheels: '310'
platform_id: macosx_x86_64
arch: x86_64
goarch: amd64
- os: macos-latest
python: '3.11'
python-cibuildwheels: '311'
platform_id: macosx_x86_64
arch: x86_64
goarch: amd64
# MacOS native
- os: macos-latest
python: '3.8'
python-cibuildwheels: '38'
platform_id: macosx_arm64
arch: arm64
goarch: arm64
- os: macos-latest
python: '3.9'
python-cibuildwheels: '39'
platform_id: macosx_arm64
arch: arm64
goarch: arm64
- os: macos-latest
python: '3.10'
python-cibuildwheels: '310'
platform_id: macosx_arm64
arch: arm64
goarch: arm64
- os: macos-latest
python: '3.11'
python-cibuildwheels: '311'
platform_id: macosx_arm64
arch: arm64
goarch: arm64
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.19.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install git+https://github.com/jina-ai/setuptools-golang.git@feat-align-with-alaeddine-code
pip install cibuildwheel
- name: Build wheels with setuptools-golang-build-manylinux-wheel
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
setuptools-golang-build-manylinux-wheels --pythons ${{ matrix.python-manylinux-tag }}
- name: Build wheels with cibuildwheels on macos
env:
CIBW_BUILD: cp${{ matrix.python-cibuildwheels }}-${{ matrix.platform_id }}
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_COMMAND: python -c "import jina; import jraft"
CIBW_BUILD_VERBOSITY: 1
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 1
if: ${{ matrix.os == 'macos-latest' }}
run: |
python -m cibuildwheel --output-dir dist
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v2
with:
path: dist/*.whl
core-test:
needs: [prep-testbed]
runs-on: ubuntu-latest
env:
JINA_RANDOM_PORT_MIN: 16384
strategy:
fail-fast: false
matrix:
python-version: [3.8]
test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}}
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.19.5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install git+https://github.com/jina-ai/setuptools-golang.git@feat-align-with-alaeddine-code
pip install cibuildwheel
- name: Build wheels with setuptools-golang-build-manylinux-wheel
run: |
setuptools-golang-build-manylinux-wheels --pythons cp38-cp38
- name: Prepare environment
run: |
docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip .
python -m pip install --upgrade pip
python -m pip install wheel
WHEEL_FILE=$(ls dist/*whl)
pip install "$WHEEL_FILE[all]" --no-cache-dir
pip install docarray==0.21.0
jina
export JINA_LOG_LEVEL="ERROR"
- name: Test
id: test
run: |
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml --timeout=600 -v -s --ignore-glob='tests/integration/docarray_v2/*' --ignore-glob='tests/integration/stateful/*' --ignore-glob='tests/integration/hub_usage/dummyhub*' ${{ matrix.test-path }}
if [[ "${{ matrix.test-path }}" == *"tests/integration/instrumentation/" ]]
then
echo "sleeping to let open telemetry export daemon thread expire by itself"
sleep 2
fi
echo "flag it as jina for codeoverage"
echo "codecov_flag=jina" >> $GITHUB_OUTPUT
timeout-minutes: 30
env:
JINA_AUTH_TOKEN: "${{ secrets.JINA_AUTH_TOKEN }}"
- name: Check codecov file
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "coverage.xml"
- name: Upload coverage from test to Codecov
uses: codecov/[email protected]
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
with:
file: coverage.xml
name: ${{ matrix.test-path }}-codecov
flags: ${{ steps.test.outputs.codecov_flag }}
fail_ci_if_error: false
import-test:
runs-on: ubuntu-latest
needs: [lint-flake-8, code-injection ]
strategy:
fail-fast: false
matrix:
core: ['', 'true']
perf: ['', 'true']
python-env: ['3.7', '3.8', '3.9', '3.10', '3.11']
exclude:
- core: 'true'
perf: 'true'
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare enviroment
run: |
python -m pip install --upgrade pip
python -m pip install wheel
pip install --no-cache-dir .
env:
JINA_PIP_INSTALL_CORE: ${{ matrix.core }}
JINA_PIP_INSTALL_PERF: ${{ matrix.perf }}
- name: Test basic import
run: python -c 'from jina import Executor,requests,Client,Flow,dynamic_batching,Document,DocumentArray'
- name: Test import all
run: python -c 'from jina import *'
install-jina-ecosystem-test:
runs-on: ubuntu-latest
needs: [lint-flake-8, code-injection ]
strategy:
fail-fast: false
steps:
- uses: actions/[email protected]
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Prepare enviroment
run: |
python -m pip install --upgrade pip
python -m pip install wheel
HUBBLE_VERSION=$(curl -L -s "https://pypi.org/pypi/jina-hubble-sdk/json" | jq -r '.releases | keys | .[]| select(startswith("0."))' | sort -V | tail -1)
DOCARRAY_VERSION=$(curl -L -s "https://pypi.org/pypi/docarray/json" | jq -r '.releases | keys | .[]| select(startswith("0."))' | sort -V | tail -1)
JCLOUD_VERSION=$(curl -L -s "https://pypi.org/pypi/jcloud/json" | jq -r '.releases | keys | .[]| select(startswith("0."))' | sort -V | tail -1)
pip install . jcloud==$JCLOUD_VERSION docarray==$DOCARRAY_VERSION jina-hubble-sdk==$HUBBLE_VERSION
env:
JINA_PIP_INSTALL_CORE: ${{ matrix.core }}
JINA_PIP_INSTALL_PERF: ${{ matrix.perf }}
- name: Test basic import
run: python -c 'from jina import Executor,requests'
- name: Test import all
run: python -c 'from jina import *'
# just for blocking the merge until all parallel core-test are successful
success-all-test:
runs-on: ubuntu-latest
needs: [commit-lint, core-test, docarray-v-two-test, stateful-docarray-v-two-test, import-test, hub-test, k8s-flow-test, k8s-deployment-test, k8s-graceful-test, k8s-failures-test, k8s-otel-test, docker-compose-test, docker-image-test, check-docstring, check-black, code-injection, build-wheels]
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v2
- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
- name: Success
if: ${{ success() }}
run: echo "All Done"