-
Notifications
You must be signed in to change notification settings - Fork 172
356 lines (347 loc) · 13.5 KB
/
main.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
name: CI
on:
push:
branches: main
pull_request:
branches: '*'
jobs:
build_extensions:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
example:
- clap-button-message
- cell-toolbar
- codemirror-extension
- command-palette
- commands
- completer
- contentheader
- context-menu
- custom-log-console
- datagrid
- documents
- hello-world
- launcher
- kernel-messaging
- kernel-output
- log-messages
- main-menu
- metadata-form
- notifications
- react-widget
- settings
- shout-button-message
- signals
- state
- toolbar-button
- toparea-text-widget
- widgets
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
working-directory: ${{ matrix.example }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Path filter
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
extension:
- '${{ matrix.example }}/**'
- name: Cache lerna
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
restore-keys: ${{ runner.os }}-lerna-
- name: Check config files
if: steps.filter.outputs.extension == 'true'
run: |
diff ../hello-world/setup.py setup.py
diff ../hello-world/tsconfig.json tsconfig.json
diff ../hello-world/.yarnrc.yml .yarnrc.yml
diff ../hello-world/ui-tests/jupyter_server_test_config.py ./ui-tests/jupyter_server_test_config.py
diff ../hello-world/ui-tests/playwright.config.js ./ui-tests/playwright.config.js
shell: bash
- name: Install node
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
if: steps.filter.outputs.extension == 'true'
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pip
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip "jupyterlab>=4.0.0"
# This is challenging to test in collaboration;
# got trouble with the file ID service and the uncontrolled auto-save
# - if: steps.filter.outputs.extension == 'true' && matrix.example == 'clap-button-message'
# run: |
# python -m pip install jupyter-collaboration
- name: Build the extension
if: steps.filter.outputs.extension == 'true'
run: |
# Same commands as in TL;DR to ensure it works
touch yarn.lock
pip install -e . -v
jupyter labextension develop . --overwrite
shell: bash
- name: Lint the files
if: steps.filter.outputs.extension == 'true'
run: jlpm run lint:check
- name: Check extension installation
if: steps.filter.outputs.extension == 'true'
run: |
jupyter labextension list 2>&1 | tee labextension.list
cat labextension.list | grep -ie "@jupyterlab-examples/*.*OK"
# clap-button-message example will have one plugin failing as it is requiring a
# Jupyter Notebook specific token. This is expected. Hence we need to skip this
# test for that example
- if: steps.filter.outputs.extension == 'true' && matrix.example != 'clap-button-message'
run: |
python -m jupyterlab.browser_check
- name: Install galata
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
working-directory: ${{ matrix.example }}/ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install
- name: Set up browser cache
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install browser
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
run: jlpm playwright install chromium
working-directory: ${{ matrix.example }}/ui-tests
- name: Install kernel-output dependencies
if: steps.filter.outputs.extension == 'true' && matrix.example == 'kernel-output'
run: pip install numpy pandas
- name: Integration tests
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
working-directory: ${{ matrix.example }}/ui-tests
run: jlpm playwright test
- name: Upload UI Test artifacts
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') && always()
uses: actions/upload-artifact@v3
with:
name: ui-test-output
path: |
${{ matrix.example }}/ui-tests/test-results
- name: Uninstall extension
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
export NAME=`python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])"`
pip uninstall -y ${NAME}
build_serverextension:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Path filter
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
extension:
- 'server-extension/**'
- name: Cache lerna
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-lerna-${{ hashFiles('server-extension/package.json') }}
restore-keys: ${{ runner.os }}-lerna-
- name: Install node
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Check config files
if: steps.filter.outputs.extension == 'true'
run: |
diff hello-world/setup.py server-extension/setup.py
diff hello-world/tsconfig.json server-extension/tsconfig.json
diff hello-world/.yarnrc.yml server-extension/.yarnrc.yml
diff hello-world/ui-tests/jupyter_server_test_config.py server-extension/ui-tests/jupyter_server_test_config.py
diff hello-world/ui-tests/playwright.config.js server-extension/ui-tests/playwright.config.js
shell: bash
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
if: steps.filter.outputs.extension == 'true'
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pip
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip jupyterlab~=4.0.0 build
- name: Install the NPM dependencies
if: steps.filter.outputs.extension == 'true'
run: |
cd server-extension
jlpm
- name: Lint the files
if: steps.filter.outputs.extension == 'true'
run: |
cd server-extension
jlpm run lint:check
- name: Build extension as user
if: steps.filter.outputs.extension == 'true'
# Force the usage of the source distribution (good practice)
run: |
cd server-extension
python -m build --sdist
pip install ./dist/jupyterlab_examples_server* --pre --find-links=dist --no-cache-dir
python -m jupyterlab.browser_check
- name: Check extension as dev
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
jupyter server extension list 2>&1 | tee serverextension.list
cat serverextension.list | grep -ie "jupyterlab_examples_server.*OK"
jupyter labextension list 2>&1 | tee labextension.list
cat labextension.list | grep -ie "@jupyterlab-examples/server-extension.*OK"
- name: Clean extension installation
if: steps.filter.outputs.extension == 'true'
run: |
pip uninstall -y jupyterlab_examples_server
jupyter lab clean
jupyter server extension list
jupyter labextension list
- name: Build extension as dev
if: steps.filter.outputs.extension == 'true'
run: |
cd server-extension
pip install .
- name: Check extension as dev
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
jupyter server extension list 2>&1 | tee serverextension.list
cat serverextension.list | grep -ie "jupyterlab_examples_server.*OK"
jupyter labextension list 2>&1 | tee labextension.list
cat labextension.list | grep -ie "@jupyterlab-examples/server-extension.*OK"
python -m jupyterlab.browser_check
- name: Install galata
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
working-directory: server-extension/ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install
- name: Set up browser cache
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install browser
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
run: jlpm playwright install chromium
working-directory: server-extension/ui-tests
- name: Integration tests
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux')
working-directory: server-extension/ui-tests
run: jlpm playwright test
- name: Upload UI Test artifacts
if: steps.filter.outputs.extension == 'true' && startsWith(runner.os, 'Linux') && always()
uses: actions/upload-artifact@v3
with:
name: ui-test-output
path: |
server-extension/ui-tests/test-results
- name: Uninstall extension
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
export NAME=`python -c "import tomllib; print(tomllib.load(open('server-extension/pyproject.toml', 'rb'))['project']['name'])"`
pip uninstall -y ${NAME}
build_all:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache lerna
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
restore-keys: ${{ runner.os }}-lerna-
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: python -m pip install jupyterlab~=4.0.0 pytest pytest-check-links "pytest-jupyter[server]>=0.6.0"
- name: Bootstrap the jlpm deps
run: jlpm
- name: Build all the extensions
run: |
# Check embedded snippets
jlpm lint:check
# Check links as last step as new tutorial may set links not yet valid (like file not yet in main)
jlpm run lerna exec --concurrency 4 -- "pytest --check-links"