-
Notifications
You must be signed in to change notification settings - Fork 798
258 lines (258 loc) · 8.43 KB
/
ci.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
name: CI
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- 'bazel/**'
- 'typings/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'bazel/**'
- 'typings/**'
schedule:
- cron: '0 0 * * 1/2'
env:
LINES: 120
COLUMNS: 120
BENTOML_DO_NOT_TRACK: True
PYTEST_PLUGINS: bentoml.testing.pytest.plugin
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
jobs:
unit:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, 3.11, 3.12]
name: unit-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Unit tests
run: nox --session unit-${{ matrix.python-version }}
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.unit.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-unit-data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
integrations:
name: framework-integration-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
framework:
- catboost
- detectron
- diffusers
- easyocr
- fastai
- flax
- keras
- lightgbm
- onnx
- picklable_model
- pytorch
- pytorch_lightning
- sklearn
- tensorflow
- torchscript
- transformers
- xgboost
exclude:
- framework: transformers # NOTE: CI runners doesn't have enough space to run all transformers jobs
- framework: detectron # NOTE: tested locally and the latest PyPI are to obsolete.
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: pip
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run framework integration tests
run: nox --session "framework-integration(framework='${{ matrix.framework }}')"
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.integrations.ubuntu-latest.3.9.${{ matrix.framework }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-integrations-data-${{ matrix.framework }}
path: .coverage.*
include-hidden-files: true
e2e-monitoring:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, 3.11, 3.12]
name: monitoring-e2e-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
env:
BENTOML_BUNDLE_LOCAL_BUILD: True
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up Docker Buildx
if: ${{ matrix.os == 'ubuntu-latest' }}
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run the monitoring tests
run: nox -s e2e-monitoring-${{ matrix.python-version }}
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.monitoring.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-monitoring-data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
e2e-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, 3.11, 3.12]
suite: ['bento_server_http', 'bento_new_sdk']
exclude:
- os: macos-latest
suite: bento_server_http
python-version: 3.12
- os: ubuntu-latest
suite: bento_server_http
python-version: 3.12
name: ${{ matrix.suite }}-e2e-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
env:
BENTOML_BUNDLE_LOCAL_BUILD: True
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up Docker Buildx
if: ${{ matrix.os == 'ubuntu-latest' }}
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run ${{ matrix.suite }} tests
run: nox -s "e2e-testing-${{ matrix.python-version }}(suite='${{ matrix.suite }}')"
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.e2e.${{ matrix.os }}.${{ matrix.python-version }}.${{ matrix.suite }}"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-e2e-data-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.suite }}
path: .coverage.*
include-hidden-files: true
coverage:
name: report-coverage
runs-on: ubuntu-latest
needs:
- e2e-test
- e2e-monitoring
- unit
- integrations
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: '3.11'
- name: Download e2e coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-e2e-data-*
merge-multiple: true
- name: Download monitoring coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-monitoring-data-*
merge-multiple: true
- name: Download integrations coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-integrations-data-*
merge-multiple: true
- name: Download unit coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-unit-data-*
merge-multiple: true
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Export coverage reports and generate summary
run: nox -s coverage
- name: Upload uncovered HTML report
uses: actions/upload-artifact@v4
with:
name: uncovered-html-report
path: htmlcov
- name: Update coverage pull request comment
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
uses: marocchino/sticky-pull-request-comment@v2
with:
path: coverage-report.md
evergreen: # https://github.com/marketplace/actions/alls-green#why
if: github.event_name == 'pull_request'
needs:
- coverage
- e2e-test
- e2e-monitoring
- unit
- integrations
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true