forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (161 loc) · 6.29 KB
/
cross-version-tests.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
name: Cross version tests
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
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: ""
flavors:
description: "[Optional] Comma-separated string specifying which flavors to test (e.g. 'sklearn, xgboost'). If unspecified, all flavors are tested."
required: false
default: ""
versions:
description: "[Optional] Comma-separated string specifying which versions to test (e.g. '1.2.3, 4.5.6'). If unspecified, all versions are tested."
required: false
default: ""
schedule:
# Run this workflow daily at 13:00 UTC
- cron: "0 13 * * *"
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
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
jobs:
set-matrix:
runs-on: ubuntu-latest
timeout-minutes: 10
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)
permissions:
issues: read # listLabelsOnIssue
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
is_matrix_empty: ${{ steps.set-matrix.outputs.is_matrix_empty }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- name: Install dependencies
run: |
pip install -r dev/requirements.txt
pip install pytest pytest-cov
- name: Check labels
uses: actions/github-script@v7
id: check-labels
with:
script: |
if (context.eventName !== "pull_request") {
return {
enable_dev_tests: true,
only_latest: false,
};
}
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const labelNames = labels.data.map(({ name }) => name);
return {
enable_dev_tests: labelNames.includes("enable-dev-tests"),
only_latest: labelNames.includes("only-latest"),
};
- name: Test set_matrix.py
run: |
python -m pytest --noconftest dev/tests
- id: set-matrix
name: Set matrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EVENT_NAME="${{ github.event_name }}"
if [ "$EVENT_NAME" = "pull_request" ]; then
REPO="${{ github.repository }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
BASE_REF="${{ github.base_ref }}"
REF_VERSIONS_YAML="https://raw.githubusercontent.com/$REPO/$BASE_REF/mlflow/ml-package-versions.yml"
CHANGED_FILES="$(python dev/list_changed_files.py --repository $REPO --pr-num $PR_NUMBER)"
ENABLE_DEV_TESTS="${{ fromJson(steps.check-labels.outputs.result).enable_dev_tests }}"
NO_DEV_FLAG=$([ "$ENABLE_DEV_TESTS" == "true" ] && echo "" || echo "--no-dev")
ONLY_LATEST="${{ fromJson(steps.check-labels.outputs.result).only_latest }}"
ONLY_LATEST_FLAG=$([ "$ONLY_LATEST" == "true" ] && echo "--only-latest" || echo "")
python dev/set_matrix.py --ref-versions-yaml $REF_VERSIONS_YAML --changed-files "$CHANGED_FILES" $NO_DEV_FLAG $ONLY_LATEST_FLAG
elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then
python dev/set_matrix.py --flavors "${{ github.event.inputs.flavors }}" --versions "${{ github.event.inputs.versions }}"
else
python dev/set_matrix.py
fi
test:
needs: set-matrix
if: ${{ needs.set-matrix.outputs.is_matrix_empty == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/free-disk-space
if: matrix.free_disk_space
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python }}
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
with:
java-version: ${{ matrix.java }}
distribution: "adopt"
- name: Install mlflow & test dependencies
run: |
pip install wheel
pip install .[extras]
pip install -r requirements/test-requirements.txt
- name: Install ${{ matrix.package }} ${{ matrix.version }}
run: |
${{ matrix.install }}
- name: Check package versions
run: |
python dev/show_package_release_dates.py
- name: Pre-test
if: matrix.pre_test
run: |
${{ matrix.pre_test }}
- uses: ./.github/actions/pipdeptree
- name: Run tests
env:
MLFLOW_CONDA_HOME: /usr/share/miniconda
SPARK_LOCAL_IP: localhost
JOHNSNOWLABS_LICENSE_JSON: ${{ secrets.JOHNSNOWLABS_LICENSE_JSON }}
HF_HUB_ENABLE_HF_TRANSFER: 1
run: |
${{ matrix.run }}