forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (115 loc) · 4.8 KB
/
examples.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
name: Examples
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
# Run this action daily at 13:00 UTC
- cron: "0 13 * * *"
workflow_dispatch:
inputs:
repository:
description: >
[Optional] Repository name with owner. For example, mlflow/mlflow.
Defaults to the repository that triggered a workflow.
required: false
default: ""
ref:
description: >
[Optional] The branch, tag or SHA to checkout. When checking out the repository that
triggered a workflow, this defaults to the reference or SHA for that event. Otherwise,
uses the default branch.
required: false
default: ""
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
env:
MLFLOW_HOME: /home/runner/work/mlflow/mlflow
MLFLOW_CONDA_HOME: /usr/share/miniconda
jobs:
examples:
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && github.repository == 'mlflow-automation/mlflow') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- uses: ./.github/actions/free-disk-space
- name: Check diff
id: check-diff
if: github.event_name == 'pull_request'
run: |
REPO="${{ github.repository }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
BASE_REF="${{ github.base_ref }}"
CHANGED_FILES=$(python dev/list_changed_files.py --repository $REPO --pr-num $PR_NUMBER | grep "tests/examples\|examples" || true);
EXAMPLES_CHANGED=$([[ ! -z "$CHANGED_FILES" ]] && echo "true" || echo "false")
echo -e "CHANGED_FILES:\nCHANGED_FILES"
echo "EXAMPLES_CHANGED: $EXAMPLES_CHANGED"
echo "examples_changed=$EXAMPLES_CHANGED" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- name: Install dependencies
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || steps.check-diff.outputs.examples_changed == 'true' }}
run: |
source ./dev/install-common-deps.sh --ml
pip install fastapi uvicorn tf-keras
- name: Run example tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || steps.check-diff.outputs.examples_changed == 'true' }}
env:
SPARK_LOCAL_IP: localhost
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --serve-wheel tests/examples --durations=30
- name: Remove conda environments
run: |
conda remove --all --yes --name test-environment
./dev/remove-conda-envs.sh
- name: Show disk usage
run: |
df -h
docker:
runs-on: ubuntu-latest
timeout-minutes: 120
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && github.repository == 'mlflow-automation/mlflow') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
submodules: recursive
- name: Check diff
id: check-diff
if: github.event_name == 'pull_request'
run: |
REPO="${{ github.repository }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
CHANGED_FILES=$(python dev/list_changed_files.py --repository $REPO --pr-num $PR_NUMBER | grep "Dockerfile\|\.dockerignore" || true);
DOCKER_CHANGED=$([[ ! -z "$CHANGED_FILES" ]] && echo "true" || echo "false")
echo -e "CHANGED_FILES:\nCHANGED_FILES"
echo "DOCKER_CHANGED: $DOCKER_CHANGED"
echo "docker_changed=$DOCKER_CHANGED" >> $GITHUB_OUTPUT
- name: Run docker tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || steps.check-diff.outputs.docker_changed == 'true' }}
run: |
docker build -t mlflow_test_build . && docker images | grep mlflow_test_build
- name: Show disk usage
run: |
df -h