forked from shorthills-ai/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 1
384 lines (361 loc) · 13.3 KB
/
master.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
name: MLflow tests
on:
pull_request:
push:
branches:
- master
- branch-[0-9]+.[0-9]+
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
# Use `bash --noprofile --norc -exo pipefail` by default for all `run` steps in this workflow:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
env:
MLFLOW_HOME: /home/runner/work/mlflow/mlflow
# Note miniconda is pre-installed in the virtual environments for GitHub Actions:
# https://github.com/actions/virtual-environments/blob/main/images/linux/scripts/installers/miniconda.sh
MLFLOW_CONDA_HOME: /usr/share/miniconda
SPARK_LOCAL_IP: localhost
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event_name != 'pull_request' && github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
id: setup-python
- name: Add problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/pylint.json"
echo "::add-matcher::.github/workflows/matchers/black.json"
echo "::add-matcher::.github/workflows/matchers/ruff.json"
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
source ./dev/install-common-deps.sh --ml
pip install -r requirements/lint-requirements.txt
- uses: ./.github/actions/pipdeptree
- name: Install pre-commit hooks
run: |
source .venv/bin/activate
pre-commit install -t pre-commit -t prepare-commit-msg
- name: Run pre-commit
id: pre-commit
env:
IS_MAINTAINER: ${{ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association )}}
run: |
source .venv/bin/activate
pre-commit run --all-files
# python-skinny tests cover a subset of mlflow functionality
# that is meant to be supported with a smaller dependency footprint.
# The python skinny tests cover the subset of mlflow functionality
# while also verifying certain dependencies are omitted.
python-skinny:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh --skinny
- name: Run tests
run: |
./dev/run-python-skinny-tests.sh
python:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
source ./dev/install-common-deps.sh --ml
- uses: ./.github/actions/pipdeptree
- name: Import check
run: |
source .venv/bin/activate
python tests/check_mlflow_lazily_imports_ml_packages.py
- name: Run tests
run: |
source .venv/bin/activate
source dev/setup-ssh.sh
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --quiet --requires-ssh \
--ignore-flavors --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate \
tests
database:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- name: Build
run: |
./tests/db/compose.sh pull -q postgresql mysql mssql
./tests/db/compose.sh build --build-arg DEPENDENCIES="$(python setup.py -q dependencies)"
- name: Run tests
run: |
set +e
err=0
trap 'err=1' ERR
for service in $(./tests/db/compose.sh config --services | grep '^mlflow-')
do
# Set `--no-TTY` to show container logs on GitHub Actions:
# https://github.com/actions/virtual-environments/issues/5022
./tests/db/compose.sh run --rm --no-TTY $service pytest \
tests/store/tracking/test_sqlalchemy_store.py \
tests/store/model_registry/test_sqlalchemy_store.py \
tests/db
done
test $err = 0
- name: Run migration check
run: |
set +e
err=0
trap 'err=1' ERR
./tests/db/compose.sh down --volumes --remove-orphans
for service in $(./tests/db/compose.sh config --services | grep '^migration-')
do
./tests/db/compose.sh run --rm --no-TTY $service
done
test $err = 0
- name: Clean up
run: |
./tests/db/compose.sh down --volumes --remove-orphans --rmi all
java:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
cd mlflow/java
mvn clean package -q
flavors:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
source ./dev/install-common-deps.sh --ml
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
source .venv/bin/activate
pytest \
tests/utils/test_model_utils.py \
tests/tracking/fluent/test_fluent_autolog.py \
tests/autologging \
tests/server/auth
# It takes 9 ~ 10 minutes to run tests in `tests/models`. To make CI finish faster,
# run these tests in a separate job.
models:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install pyspark
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} tests/models
# NOTE: numpy is pinned in this suite due to its heavy reliance on shap, which internally uses
# references to the now fully deprecated (as of 1.24.x) numpy types (i.e., np.bool).
# When the shap cross version tests are passing in a new release version of shap, this pin should
# be removed.
evaluate:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install pyspark torch transformers
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
dev/pytest.sh tests/evaluate
pyfunc:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install tensorflow 'pyspark[connect]'
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --durations=30 \
tests/pyfunc --ignore tests/pyfunc/test_spark_connect.py
# test_spark_connect.py fails if it's run with ohter tests, so run it separately.
pytest tests/pyfunc/test_spark_connect.py
sagemaker:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh --ml
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest tests/sagemaker
windows:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: windows-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install python dependencies
run: |
python -m venv .venv
source .venv/Scripts/activate
pip install -r requirements/test-requirements.txt
pip install --no-dependencies tests/resources/mlflow-test-plugin
pip install -e .[extras]
pip install pyspark
pip install mleap
# Install Hugging Face datasets to test Hugging Face usage with MLflow dataset tracking
pip install datasets
# Install TensorFlow to test TensorFlow dataset usage with MLflow dataset tracking
pip install tensorflow
# Install torch and transformers to test metrics
pip install torch transformers
- uses: ./.github/actions/pipdeptree
- name: Download Hadoop winutils for Spark
run: |
git clone https://github.com/cdarlint/winutils /tmp/winutils
- name: Run python tests
env:
# Starting from SQLAlchemy version 2.0, `QueuePool` is the default connection pool
# when creating an `Engine`. `QueuePool` prevents the removal of temporary database
# files created during tests on Windows as it keeps the DB connection open until
# it's explicitly disposed.
MLFLOW_SQLALCHEMYSTORE_POOLCLASS: "NullPool"
run: |
source .venv/Scripts/activate
# Set Hadoop environment variables required for testing Spark integrations on Windows
export HADOOP_HOME=/tmp/winutils/hadoop-3.2.2
export PATH=$PATH:$HADOOP_HOME/bin
# Run Windows tests
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} \
--ignore-flavors --ignore=tests/projects --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate \
tests
# MLeap is incompatible on Windows with PySpark3.4 release.
# Reinstate tests when MLeap has released a fix. [ML-30491]
# pytest tests/mleap