-
Notifications
You must be signed in to change notification settings - Fork 52
368 lines (350 loc) · 12.7 KB
/
build.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
name: build
on:
schedule:
- cron: '44 4 * * *'
pull_request:
branches:
- master
- develop
release:
types:
[published]
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.11
- run: pip install pre-commit
- run: pre-commit --version
- run: pre-commit install
- run: pre-commit run --all-files
pretest:
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [pylint, doc8, docs]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run pre-tests with Tox
run: tox -e ${{ matrix.toxenv }}
test-dashboard-build:
needs: pretest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 16
- name: Compile Dashboard
run: |
cd dashboard/src
yarn
yarn build
rm -rf ../build
mv build ..
cd ../../
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Get gecko driver
run: |
wget https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
tar -xvf geckodriver-v0.31.0-linux64.tar.gz
- name: Create gunicorn_tmp_dir to match orion_config.yaml
run: mkdir -p gunicorn_tmp_dir
- name: Launch backend
run: orion serve -c .github/workflows/orion/orion_config.yaml &
- name: Launch frontend
run: orion frontend &
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
- name: Test frontend
run: PATH=$PATH:$(pwd) pytest tests/functional/serving/test_frontend.py
test:
needs: [pre-commit, pretest]
runs-on: ${{ matrix.platform }}
strategy:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.8, 3.9, '3.10']
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox (and all extra dependencies)
run: tox -e py-all -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
test-long-algos:
needs: [pre-commit, pretest]
runs-on: ${{ matrix.platform }}
continue-on-error: true
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [3.8, 3.9]
algo: [nevergrad, hebo, ax]
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test long algorithms with tox
run: tox -e algo -- tests/unittests/algo/long/${{ matrix.algo }} --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
test_no_extras:
needs: [pre-commit, pretest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox -e py -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
mongodb:
needs: [pre-commit, pretest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Setup MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 6.0
- name: Install MongoShell
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
- name: Configure MongoDB
run: |
mongosh orion_test --eval 'db.createUser({user:"user",pwd:"pass",roles:["readWrite"]});'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox -e mongodb -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: backward
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
backward-compatibility:
needs: [pre-commit, pretest]
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
orion_db_type: [mongodb, pickleddb]
env:
ORION_DB_TYPE: ${{ matrix.orion_db_type }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Setup MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 6.0
- name: Install MongoShell
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
- name: Configure MongoDB
run: |
mongosh orion_test --eval 'db.createUser({user:"user",pwd:"pass",roles:["readWrite"]});'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox -e backward-compatibility -- --color=no
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: backward
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
pypi:
needs: [test, backward-compatibility, test-long-algos, mongodb, test_no_extras] # , test-dashboard-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test packaging
run: tox -e packaging
- name: Build
run: tox -e build
- name: Test dashboard build deployment on normal install
run: |
# Get package path
export ORION_PACKAGE=$( realpath `find dist/ -type f` )
echo Package path: ${ORION_PACKAGE}
# Move to another folder (to prevent any confusion at installation with repo folder)
cd ~
echo Normal install
pip install ${ORION_PACKAGE}
# Get prefix
export ORION_PREFIX=$( python -c "import sys; print(sys.prefix);" )
echo Check if dashboard build is installed
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then true; else false; fi
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then true; else false; fi
echo Check if frontend script can find dashboard build
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();"
echo Check if frontend script can find dashboard build on sys.prefix/local
mkdir -p ${ORION_PREFIX}/local/
mv ${ORION_PREFIX}/orion-dashboard ${ORION_PREFIX}/local/orion-dashboard
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then false; else true; fi
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then true; else false; fi
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();"
echo Move build back to initial installation
mv ${ORION_PREFIX}/local/orion-dashboard ${ORION_PREFIX}/orion-dashboard
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then false; else true; fi
echo Clean-up
pip uninstall -y orion
echo Check if dashboard build is correctly removed
# NB: It seems orion-dashboard build is not deleted,
# but it should be empty after uninstall
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then false; fi
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then false; fi
echo End
cd -
- name: Test dashboard build deployment on user install
run: |
# Get package path
export ORION_PACKAGE=$( realpath `find dist/ -type f` )
echo Package path: ${ORION_PACKAGE}
# Move to another folder (to prevent any confusion at installation with repo folder)
cd ~
echo User install
pip install --user ${ORION_PACKAGE}
# Get prefix
export ORION_PREFIX=$( python -c "import site; print(site.USER_BASE);" )
echo Check if dashboard build is installed
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then true; else false; fi
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then true; else false; fi
echo Check if frontend script can find dashboard build
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();"
echo Clean-up
pip uninstall -y orion
echo Check if dashboard build is correctly removed
# NB: In user install case, it seems folder orion-dashboard itself is not deleted,
# but it should be empty after uninstall
if ( [ -f "${ORION_PREFIX}/orion-dashboard/build/index.html" ] ); then false; fi
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then false; fi
echo End
cd -
- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
conda:
needs: [test, backward-compatibility, test-long-algos] #, test-dashboard-build]
runs-on: ubuntu-latest
env:
ANACONDA_TOKEN: ${{ secrets.anaconda_token }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Build conda
run: ./conda/ci_build.sh
- name: Publish distribution 📦 to Conda
if: startsWith(github.ref, 'refs/tags')
run: ./conda/upload.sh