-
Notifications
You must be signed in to change notification settings - Fork 141
539 lines (450 loc) · 17.9 KB
/
test.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
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
name: Test
on:
push:
branches:
- master
tags:
- v*
pull_request:
workflow_dispatch:
schedule:
- cron: '0 6 * * *' # at 06:00 UTC every day
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !(github.ref == 'refs/heads/master') }}
env:
SOLARA_TELEMETRY_SERVER_USER_ID: "install-test"
SOLARA_TELEMETRY_MIXPANEL_TOKEN: adbf863d17cba80db608788e7fce9843
defaults:
run:
shell: bash {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache JS bundle
id: cache-js-bundle-v2
uses: actions/cache@v4
with:
path: |
packages/solara-vuetify-app/dist
packages/solara-vuetify3-app/dist
key: ${{ runner.os }}-js-bundle-${{ hashFiles('packages/solara-vuetify-app/**', 'packages/solara-vuetify3-app/**', 'packages/solara-widget-manager/**', 'packages/solara-widget-manager8/src/**') }}
- name: Build solara widget manager
if: steps.cache-js-bundle-v2.outputs.cache-hit != 'true'
run: |
cd packages/solara-widget-manager
npm install
npm run build
cd ../../
cd packages/solara-widget-manager8
npm install
npm run build
cd ../../
- name: Build solara app package
if: steps.cache-js-bundle-v2.outputs.cache-hit != 'true'
run: |
cd packages/solara-vuetify-app
npm install
npm run build
cd ../../
cd packages/solara-vuetify3-app
npm install
npm run build
- name: Install build tools
run: pip install hatch
- name: Build solara
run: hatch build
- name: Build solara-enterprise
run: (cd packages/solara-enterprise; hatch build)
- name: Upload Test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: solara-builds-${{ github.run_number }}
path: |
dist
packages/solara-enterprise/dist
packages/solara-vuetify-app/dist
packages/solara-vuetify3-app/dist
code-quality:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, "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 }}
- name: Install dependencies
run: |
pip install ".[dev]" mypy==1.6.0 black==22.12.0 codespell==2.2.4 "click<8.1.4" "traitlets<5.10.0" "matplotlib<3.8.0"
mypy --install-types --non-interactive solara
- name: Run codespell
run: codespell
- name: Run black
run: black solara
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'code-quality'
- name: mypy
run: mypy solara
test-install:
needs: [build]
runs-on: ${{ matrix.os }}-${{matrix.os == 'ubuntu' && '20.04' || 'latest' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: ["3.6", "3.10"]
exclude:
- os: windows
python: 3.6
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v2
with:
name: solara-builds-${{ github.run_number }}
- name: Debug
run: ls -R dist
- name: Install
run: pip install dist/*.whl
- name: Test import
run: python -c "import solara"
- name: Run solara create
run: solara create button test.py
- name: Run solara server
run: solara run test.py&
- name: Wait for Solara server to get online
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8765/
timeout: 20000
- name: Install
run: pip install packages/solara-enterprise/dist/*.whl
- name: Test import
run: python -c "import solara_enterprise"
integration-test:
needs: [build, code-quality]
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# just ubuntu and windows give enough confidence
# osx should work fine (and we test that locally often)
os: [ubuntu, windows]
# just 1 version, it's heavy
python-version: [3.8]
ipywidgets: ["7.7", "8.0"]
include:
- ipywidgets: "7.7"
voila: "0.3.0"
- ipywidgets: "8.0"
voila: "0.4.0"
env:
LOCK_FILE_LOCATION: .ci-package-locks/integration/os${{ matrix.os }}-python${{ matrix.python-version }}-voila${{ matrix.voila }}-ipywidgets${{ matrix.ipywidgets }}.txt
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"
- uses: actions/download-artifact@v2
with:
name: solara-builds-${{ github.run_number }}
- name: Link solara app package
run: |
cd packages/solara-vuetify-app
npm run devlink
- name: Prepare
id: prepare
run: |
mkdir test-results
if [ -f ${{ env.LOCK_FILE_LOCATION }} ]; then
echo "::set-output name=locks_exist::true"
else
echo "::set-output name=locks_exist::false"
fi
- name: Install without locking versions
if: github.event_name == 'schedule' || steps.prepare.outputs.locks_exist == 'false'
id: install_no_lock
run: |
mkdir -p .ci-package-locks/integration
for file in ./dist/*.whl; do pip install $file"[dev, documentation, extra, flask, pytest]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install $file"[ssg,auth]"; done
pip install "voila~=${{ matrix.voila }}" "jupyterlab<4" "pydantic<2" "playwright==1.41.2" "ipywidgets~=${{ matrix.ipywidgets }}"
pip freeze > ${{ env.LOCK_FILE_LOCATION }}
git diff --quiet && echo "::set-output name=exit_code::'NO_DIFF'"
- name: Install
if: github.event_name != 'schedule' && steps.prepare.outputs.locks_exist == 'true'
run: |
pip install -r ${{ env.LOCK_FILE_LOCATION }}
for file in ./dist/*.whl; do pip install --no-cache-dir $file"[dev, extra]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install --no-cache-dir $file"[ssg,auth]"; done
- name: Install playwright
run: playwright install
- name: test
if: github.event_name != 'schedule' || steps.install_no_lock.outputs.exit_code != 'NO_DIFF'
env:
AUTH0_USERNAME: [email protected]
AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }}
FIEF_USERNAME: [email protected]
FIEF_PASSWORD: ${{ secrets.FIEF_PASSWORD }}
# TODO: we used to also run the (cheap) unittests, to get better coverage report, but that gives errors
# it seems on CI that the default playwright timeout is not (always?) respected, also, if the --timeout argument
# is shorter than the timeout of playwright, we get no good error message, summary: always keep above 30!
run: pytest tests/integration --timeout=360 --video=retain-on-failure --output=test-results -vv -s --log-cli-level=warning
- name: Upload Test artifacts
if: github.event_name != 'schedule' || steps.install_no_lock.outputs.exit_code != 'NO_DIFF'
uses: actions/upload-artifact@v3
with:
name: test-results
path: test-results
- name: Upload CI package locks
if: (steps.install_no_lock.outputs.exit_code != 'NO_DIFF' && github.event_name == 'schedule') || steps.prepare.outputs.locks_exist == 'false'
uses: actions/upload-artifact@v3
with:
name: ci-package-locks
path: ./**/${{ env.LOCK_FILE_LOCATION }}
integration-test-vue3:
needs: [build, code-quality]
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# just ubuntu and windows give enough confidence
# osx should work fine (and we test that locally often)
os: [ubuntu]
# just 1 version, it's heavy
python-version: [3.8]
ipywidgets: ["8.0"]
include:
- ipywidgets: "8.0"
voila: "0.4.0"
env:
LOCK_FILE_LOCATION: .ci-package-locks/integration-vue3/os${{ matrix.os }}-voila${{ matrix.voila }}-ipywidgets${{ matrix.ipywidgets }}.txt
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"
- uses: actions/download-artifact@v2
with:
name: solara-builds-${{ github.run_number }}
- name: Link solara app package
run: |
(cd packages/solara-vuetify-app; npm run devlink)
(cd packages/solara-vuetify3-app; npm run devlink)
- name: Prepare
id: prepare
run: |
mkdir test-results
if [ -f ${{ env.LOCK_FILE_LOCATION }} ]; then
echo "::set-output name=locks_exist::true"
else
echo "::set-output name=locks_exist::false"
fi
- name: Install without locking versions
id: install_no_lock
if: github.event_name == 'schedule' || steps.prepare.outputs.locks_exist == 'false'
run: |
mkdir -p .ci-package-locks/integration-vue3
for file in ./dist/*.whl; do pip install $file"[dev, documentation, flask, pytest, server]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install $file"[ssg,auth]"; done
pip install "jupyterlab<4" "voila~=${{ matrix.voila }}" "playwright==1.41.2" "pydantic<2" "ipywidgets~=${{ matrix.ipywidgets }}"
pip install jupyter_core jupyter-packaging
pip install --pre ipyvue ipyvuetify
pip freeze > ${{ env.LOCK_FILE_LOCATION }}
git diff --quiet && echo "::set-output name=exit_code::'NO_DIFF'"
- name: Install
if: github.event_name != 'schedule' && steps.prepare.outputs.locks_exist == 'true'
run: |
pip install -r ${{ env.LOCK_FILE_LOCATION }}
for file in ./dist/*.whl; do pip install --no-cache-dir $file"[dev, extra]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install --no-cache-dir $file"[ssg,auth]"; done
- name: Install playwright
run: playwright install
- name: test
if: github.event_name != 'schedule' || steps.install_no_lock.outputs.exit_code != 'NO_DIFF'
env:
AUTH0_USERNAME: [email protected]
AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }}
FIEF_USERNAME: [email protected]
FIEF_PASSWORD: ${{ secrets.FIEF_PASSWORD }}
# TODO: we used to also run the (cheap) unittests, to get better coverage report, but that gives errors
# it seems on CI that the default playwright timeout is not (always?) respected, also, if the --timeout argument
# is shorter than the timeout of playwright, we get no good error message, summary: always keep above 30!
run: pytest tests/integration/widget_test.py --timeout=360 --video=retain-on-failure --output=test-results -vv -s --log-cli-level=warning
- name: Upload Test artifacts
if: github.event_name != 'schedule' || steps.install_no_lock.outputs.exit_code != 'NO_DIFF'
uses: actions/upload-artifact@v3
with:
name: test-results
path: test-results
- name: Upload CI package locks
if: (steps.install_no_lock.outputs.exit_code != 'NO_DIFF' && github.event_name == 'schedule') || steps.prepare.outputs.locks_exist == 'false'
uses: actions/upload-artifact@v3
with:
name: ci-package-locks
path: ./**/${{ env.LOCK_FILE_LOCATION }}
unit-test:
needs: [build, code-quality]
runs-on: ${{ matrix.os }}-${{matrix.os == 'ubuntu' && '20.04' || 'latest' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: [3.6, 3.9]
ipywidgets: ["7.7", "8.0"]
exclude:
- os: windows
python: 3.6
- os: ubuntu
python: 3.6
ipywidgets: "8.0"
- os: macos
python: 3.6
ipywidgets: "8.0"
env:
LOCK_FILE_LOCATION: .ci-package-locks/unit/os${{ matrix.os }}-python${{ matrix.python }}-ipywidgets${{ matrix.ipywidgets }}.txt
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
- name: Prepare
id: prepare
run: |
if [ -f ${{ env.LOCK_FILE_LOCATION }} ]; then
echo "::set-output name=locks_exist::true"
else
echo "::set-output name=locks_exist::false"
fi
- name: Install without locking versions
id: install_no_lock
if: github.event_name == 'schedule' || steps.prepare.outputs.locks_exist == 'false'
run: |
mkdir -p .ci-package-locks/unit
for file in ./dist/*.whl; do pip install $file"[dev, extra]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install $file"[ssg,auth]"; done
pip install "jupyterlab<4" diskcache redis "ipywidgets~=${{ matrix.ipywidgets }}"
pip freeze > ${{ env.LOCK_FILE_LOCATION }}
git diff --quiet && echo "::set-output name=exit_code::'NO_DIFF'"
- name: Install
if: github.event_name != 'schedule' && steps.prepare.outputs.locks_exist == 'true'
run: |
pip install -r ${{ env.LOCK_FILE_LOCATION }}
for file in ./dist/*.whl; do pip install --no-cache-dir $file"[dev, extra]"; done
for file in ./packages/solara-enterprise/dist/*.whl; do pip install --no-cache-dir $file"[ssg,auth]"; done
- name: Start Redis
if: matrix.os != 'windows' && steps.install_no_lock.outputs.exit_code != 'NO_DIFF'
uses: shogo82148/actions-setup-redis@v1
- name: test
run: pytest tests/unit --doctest-modules --timeout=60
- name: Upload CI package locks
if: (steps.install_no_lock.outputs.exit_code != 'NO_DIFF' && github.event_name == 'schedule') || steps.prepare.outputs.locks_exist == 'false'
uses: actions/upload-artifact@v3
with:
name: ci-package-locks
path: ./**/${{ env.LOCK_FILE_LOCATION }}
update-ci-package-locks:
needs: [integration-test, integration-test-vue3, unit-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: Prepare
id: prepare
run: |
if [ -d .ci-package-locks ]; then
echo "::set-output name=locks_exist::true"
else
echo "::set-output name=locks_exist::false"
fi
- uses: actions/download-artifact@v2
with:
name: ci-package-locks
- name: Update CI package locks
if: github.event_name == 'schedule' || steps.prepare.outputs.locks_exist == 'false'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .ci-package-locks
git commit -m "Update CI package locks"
git push
release:
needs: [build, code-quality, test-install, integration-test, integration-test-vue3, unit-test]
if: startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.7
uses: actions/setup-python@v5
with:
python-version: 3.7
- uses: actions/download-artifact@v2
with:
name: solara-builds-${{ github.run_number }}
- name: Install build tools
run: pip install hatch
- name: Install solara
run: pip install dist/*.whl
- name: Test import
run: python -c "import solara; import solara.server.starlette"
- name: Install solara-enterprise
run: pip install packages/solara-enterprise/dist/*.whl
- name: Test import solara-enterprise
run: python -c "import solara_enterprise"
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Build assets
run: (cd packages/assets; hatch build)
- name: Publish solara-enterprise to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.pypi_enterprise }}
run: |
cd packages/solara-enterprise
openssl sha256 dist/*
hatch publish
openssl sha256 dist/*
- name: Publish solara to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.pypi_password }}
run: |
openssl sha256 dist/*
hatch publish
openssl sha256 dist/*
- name: Publish solara-assets to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.pypi_assets }}
run: (cd packages/assets; openssl sha256 dist/*; hatch publish; openssl sha256 dist/*)
- name: remove assets
run: rm -rf packages/assets/dist