forked from opendatahub-io/kserve
-
Notifications
You must be signed in to change notification settings - Fork 1
222 lines (211 loc) · 8.85 KB
/
python-test.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
name: Python package
on:
push:
branches: [master, release*]
pull_request:
branches: []
workflow_dispatch:
jobs:
flake8-lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: flake8 Lint
uses: py-actions/flake8@v1
with:
max-line-length: "120"
exclude: "docs/samples/v1beta1/onnx/assets/*.py,python/kserve/test/test_v1*.py,python/kserve/kserve/__init__.py,python/kserve/test/test_knative*.py,python/kserve/kserve/protocol/grpc/grpc_predict_v2*.py"
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry and version plugin
run: ./test/scripts/gh-actions/setup-poetry.sh
# load poetry cache if cache exists
- name: Load poetry cache
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
# ----------------------------------------Kserve Unit Tests--------------------------------------------------------
# load cached kserve venv if cache exists
- name: Load cached kserve venv
id: cached-kserve-dependencies
uses: actions/cache@v3
with:
path: python/kserve/.venv
key: kserve-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock') }}
# install kserve dependencies if cache does not exist
- name: Install kserve dependencies
if: steps.cached-kserve-dependencies.outputs.cache-hit != 'true'
run: |
cd python/kserve
make install_dependencies
- name: Install kserve
run: |
cd python/kserve
make dev_install
- name: Test kserve
run: |
cd python
source kserve/.venv/bin/activate
pytest --cov=kserve ./kserve
# ----------------------------------------Sklearn Server Unit Tests------------------------------------------------
# load cached sklearn venv if cache exists
- name: Load cached sklearn venv
id: cached-sklearn-dependencies
uses: actions/cache@v3
with:
path: python/sklearnserver/.venv
key: sklearn-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/sklearnserver/poetry.lock') }}
# install sklearn server dependencies if cache does not exist
- name: Install sklearn dependencies
if: steps.cached-sklearn-dependencies.outputs.cache-hit != 'true'
run: |
cd python/sklearnserver
make install_dependencies
- name: Install sklearnserver
run: |
cd python/sklearnserver
make dev_install
- name: Test sklearnserver
run: |
cd python
source sklearnserver/.venv/bin/activate
pytest --cov=sklearnserver ./sklearnserver
# ----------------------------------------Xgb Server Unit Tests------------------------------------------------
# load cached xgb venv if cache exists
- name: Load cached xgb venv
id: cached-xgb-dependencies
uses: actions/cache@v3
with:
path: python/xgbserver/.venv
key: xgb-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/xgbserver/poetry.lock') }}
# install xgb server dependencies if cache does not exist
- name: Install xgb dependencies
if: steps.cached-xgb-dependencies.outputs.cache-hit != 'true'
run: |
cd python/xgbserver
make install_dependencies
- name: Install xgbserver
run: |
cd python/xgbserver
make dev_install
- name: Test xgbserver
run: |
cd python
source xgbserver/.venv/bin/activate
pytest --cov=xgbserver ./xgbserver
# ----------------------------------------Pmml Server Unit Tests------------------------------------------------
# load cached pmml venv if cache exists
- name: Load cached pmml venv
id: cached-pmml-dependencies
uses: actions/cache@v3
with:
path: python/pmmlserver/.venv
key: pmml-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/pmmlserver/poetry.lock') }}
# install pmml server dependencies if cache does not exist
- name: Install pmml dependencies
if: steps.cached-pmml-dependencies.outputs.cache-hit != 'true'
run: |
cd python/pmmlserver
make install_dependencies
- name: Install pmmlserver
run: |
cd python/pmmlserver
make dev_install
- name: Test pmmlserver
run: |
cd python
source pmmlserver/.venv/bin/activate
pytest --cov=pmmlserver ./pmmlserver
# ----------------------------------------Lgb Server Unit Tests------------------------------------------------
# load cached lgb venv if cache exists
- name: Load cached lgb venv
id: cached-lgb-dependencies
uses: actions/cache@v3
with:
path: python/lgbserver/.venv
key: lgb-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/lgbserver/poetry.lock') }}
# install lgb server dependencies if cache does not exist
- name: Install lgb dependencies
if: steps.cached-lgb-dependencies.outputs.cache-hit != 'true'
run: |
cd python/lgbserver
make install_dependencies
- name: Install lgbserver
run: |
cd python/lgbserver
make dev_install
- name: Test lgbserver
run: |
cd python
source lgbserver/.venv/bin/activate
pytest --cov=lgbserver ./lgbserver
# ----------------------------------------Paddle Server Unit Tests------------------------------------------------
# load cached paddle venv if cache exists and paddle test should not run if python version is 3.11
- name: Load cached paddle venv
if: ${{ !startsWith(steps.setup-python.outputs.python-version, '3.11') }}
id: cached-paddle-dependencies
uses: actions/cache@v3
with:
path: python/paddleserver/.venv
key: paddle-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/paddleserver/poetry.lock') }}
# install paddle server dependencies if cache does not exist
- name: Install paddle dependencies
if: ${{ steps.cached-paddle-dependencies.outputs.cache-hit != 'true' && !startsWith(steps.setup-python.outputs.python-version, '3.11') }}
run: |
echo "python version ${{ steps.setup-python.outputs.python-version }}"
cd python/paddleserver
make install_dependencies
- name: Install paddleserver
if: ${{ !startsWith(steps.setup-python.outputs.python-version, '3.11') }}
run: |
cd python/paddleserver
make dev_install
- name: Test paddleserver
if: ${{ !startsWith(steps.setup-python.outputs.python-version, '3.11') }}
run: |
cd python
source paddleserver/.venv/bin/activate
pytest --cov=paddleserver ./paddleserver
# ----------------------------------------Alibi Explainer Unit Tests------------------------------------------------
# load cached alibi venv if cache exists and alibi test should not run if python version is 3.11
- name: Load cached alibi venv
id: cached-alibi-dependencies
uses: actions/cache@v3
with:
path: python/alibiexplainer/.venv
key: alibi-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/kserve/poetry.lock', '**/alibiexplainer/poetry.lock') }}
# install alibi explainer dependencies if cache does not exist
- name: Install alibi dependencies
run: |
cd python/alibiexplainer
make install_dependencies
- name: Install alibiexplainer
run: |
cd python/alibiexplainer
make dev_install
- name: Test alibiexplainer
run: |
cd python
source alibiexplainer/.venv/bin/activate
pytest --cov=alibiexplainer ./alibiexplainer