forked from mlrun/mlrun
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (229 loc) · 9.7 KB
/
ci.yaml
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
# Copyright 2023 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: CI
on:
pull_request:
branches:
- development
- '[0-9]+.[0-9]+.x'
- 'feature/**'
# Run CI also on push to backport release branches - we sometimes push code there by cherry-picking, meaning it
# doesn't go through CI (no PR)
# For master all code is coming from development where it's coming from PRs (meaning it's passing CI) but there's the
# rare scenario where the combination of merged PRs won't pass CI
push:
branches:
- master
- '[0-9]+.[0-9]+.x'
jobs:
lint:
name: Lint code (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
# 3.9 is the current >= 1.3.0 python version
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip~=24.0
pip install -r dev-requirements.txt
- name: Lint
run: make lint
# perform copyright check here, to avoid spinning up another runner needlessly
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
- name: Check
run: |
deno run --allow-read https://deno.land/x/[email protected]/main.ts
- name: Instructions For Adding Copyright
if: ${{ failure() }}
run: |
echo "
Please add the following lines to the top of your code:
# Copyright 2024 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"
tests:
name: Run Dockerized Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: re-use the next 2 actions instead of duplicating
- name: Extract git branch
id: git_info
run: |
echo "branch=$(echo ${GITHUB_BASE_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Resolve docker cache tag
id: docker_cache
run: |
export version_suffix=$(echo "${{ steps.git_info.outputs.branch }}" | grep -E "^[0-9]+\.[0-9]+\.x$" | tr -d '.')
export unstable_tag=$(if [ -z "$version_suffix" ]; then echo "unstable-cache"; else echo "unstable-cache-$version_suffix";fi)
echo "tag=$(echo $unstable_tag)" >> $GITHUB_OUTPUT
- name: Run Dockerized tests
run: MLRUN_DOCKER_REGISTRY=ghcr.io/ MLRUN_DOCKER_CACHE_FROM_TAG=${{ steps.docker_cache.outputs.tag }} make test-dockerized
integration-tests:
name: Run Dockerized Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: re-use the next 2 actions instead of duplicating
- name: Extract git branch
id: git_info
run: |
echo "branch=$(echo ${GITHUB_BASE_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Resolve docker cache tag
id: docker_cache
run: |
export version_suffix=$(echo "${{ steps.git_info.outputs.branch }}" | grep -E "^[0-9]+\.[0-9]+\.x$" | tr -d '.')
export unstable_tag=$(if [ -z "$version_suffix" ]; then echo "unstable-cache"; else echo "unstable-cache-$version_suffix";fi)
echo "tag=$(echo $unstable_tag)" >> $GITHUB_OUTPUT
- name: Run Dockerized tests
run: MLRUN_DOCKER_REGISTRY=ghcr.io/ MLRUN_DOCKER_CACHE_FROM_TAG=${{ steps.docker_cache.outputs.tag }} make test-integration-dockerized
timeout-minutes: 90
migrations-tests:
name: Run Dockerized Migrations Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: re-use the next 2 actions instead of duplicating
- name: Extract git branch
id: git_info
run: |
echo "branch=$(echo ${GITHUB_BASE_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Resolve docker cache tag
id: docker_cache
run: |
export version_suffix=$(echo "${{ steps.git_info.outputs.branch }}" | grep -E "^[0-9]+\.[0-9]+\.x$" | tr -d '.')
export unstable_tag=$(if [ -z "$version_suffix" ]; then echo "unstable-cache"; else echo "unstable-cache-$version_suffix";fi)
echo "tag=$(echo $unstable_tag)" >> $GITHUB_OUTPUT
- name: Run Dockerized DB Migration tests
run: MLRUN_DOCKER_REGISTRY=ghcr.io/ MLRUN_DOCKER_CACHE_FROM_TAG=${{ steps.docker_cache.outputs.tag }} make test-migrations-dockerized
package-tests:
name: Run package tests (Python ${{ matrix.python-version }}; Pipeline ${{ matrix.pipeline-adapter }})
runs-on: ubuntu-latest
strategy:
matrix:
# 3.9 is the current >= 1.3.0 python version
python-version: [3.9]
default-pipeline-adapter: ["kfp-v1-8"]
pipeline-adapter: ["kfp-v1-8", "kfp-v2"]
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Change default pipeline adapter for MLRun
if: matrix.default-pipeline-adapter != matrix.pipeline-adapter
run: sed -i -e 's/${{ matrix.default-pipeline-adapter }}/${{ matrix.pipeline-adapter }}/g' requirements.txt
- name: Install automation scripts dependencies and add mlrun to dev packages
run: pip install -r automation/requirements.txt && pip install -e .
- name: Test package
run: MLRUN_PYTHON_VERSION=${{ matrix.python-version }} make test-package
docs:
name: Build Project Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: re-use the next 2 actions instead of duplicating
- name: Extract git branch
id: git_info
run: |
echo "branch=$(echo ${GITHUB_BASE_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Resolve docker cache tag
id: docker_cache
run: |
export version_suffix=$(echo "${{ steps.git_info.outputs.branch }}" | grep -E "^[0-9]+\.[0-9]+\.x$" | tr -d '.')
export unstable_tag=$(if [ -z "$version_suffix" ]; then echo "unstable-cache"; else echo "unstable-cache-$version_suffix";fi)
echo "tag=$(echo $unstable_tag)" >> $GITHUB_OUTPUT
- name: Generate HTML docs
run: MLRUN_DOCKER_REGISTRY=ghcr.io/ MLRUN_DOCKER_CACHE_FROM_TAG=${{ steps.docker_cache.outputs.tag }} make html-docs-dockerized
- name: Upload generated docs
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/html
backward-compatibility-tests:
name: Run Backward Compatibility Tests
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
env:
MLRUN_BC_TESTS_HOME_PATH: /home/runner/work/mlrun/mlrun
MLRUN_BC_TESTS_BASE_CODE_PATH: /home/runner/work/mlrun/mlrun/base/mlrun
MLRUN_BC_TESTS_HEAD_CODE_PATH: /home/runner/work/mlrun/mlrun/head/mlrun
MLRUN_DOCKER_REGISTRY: ghcr.io/
steps:
- id: resolve_base_branch
run: |
echo "branch=$(echo ${GITHUB_BASE_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Checkout PR Base (target) Branch
uses: actions/checkout@v4
with:
ref: ${{ steps.resolve_base_branch.outputs.branch }}
path: base/mlrun
- name: Checkout Merge Commit (requested branch merged with the target branch)
uses: actions/checkout@v4
with:
path: head/mlrun
- name: Resolve docker cache tag
id: docker_cache
run: |
export version_suffix=$(echo "${{ steps.git_info.outputs.branch }}" | grep -E "^[0-9]+\.[0-9]+\.x$" | tr -d '.')
export unstable_tag=$(if [ -z "$version_suffix" ]; then echo "unstable-cache"; else echo "unstable-cache-$version_suffix";fi)
echo "tag=$(echo $unstable_tag)" >> $GITHUB_OUTPUT
- name: Run Backward Compatibility Tests
run: |
cd head/mlrun
MLRUN_DOCKER_CACHE_FROM_TAG=${{ steps.docker_cache.outputs.tag }} make test-backward-compatibility-dockerized
verify-compatible-requirements-one-after-one:
name: Verify compatible requirements (one after one)
runs-on: ubuntu-latest
strategy:
matrix:
# 3.9 is the current >= 1.3.0 python version
python-version: [3.9]
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install requirements ${{ matrix.python-version }}
run: make install-requirements
- name: Install Complete Requirements ${{ matrix.python-version }}
run: make install-complete-requirements
- name: Install All Requirements ${{ matrix.python-version }}
run: make install-all-requirements