-
-
Notifications
You must be signed in to change notification settings - Fork 31
302 lines (261 loc) · 8.95 KB
/
test.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
name: Tests
on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 8 * * *"
jobs:
# Run "pre-commit run --all-files --hook-stage=manual"
pre-commit:
name: Run pre-commit hook
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
pip install "jupyterlab>=4.0.0,<5"
pip install -e .
jlpm
- name: Run pre-commit
uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage=manual
- name: Help message if pre-commit fail
if: ${{ failure() }}
run: |
echo "You can install pre-commit hooks to automatically run formatting"
echo "on each commit with:"
echo " pre-commit install"
echo "or you can run by hand on staged files with"
echo " pre-commit run"
echo "or after-the-fact on already committed files with"
echo " pre-commit run --all-files --hook-stage=manual"
- name: Lint frontend
run: |
jlpm run lint:check
test-js:
name: Test JavaScript
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
pip install "jupyterlab>=4.0.0,<5"
pip install -e .
jlpm
- name: Run Tests
run: |
set -eux
jlpm run test
test-py:
name: Test Python
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.11", "3.12"]
# PyPy is not supported because we use the file_id_manager. See:
# https://github.com/jupyter-server/jupyter_server_fileid/issues/44
#include:
# - os: ubuntu-latest
# python-version: "pypy-3.8"
exclude:
- os: windows-latest
python-version: "3.12"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
python -m pip install "jupyterlab>=4.0.0,<5"
pip install -e ".[test]" codecov
- name: List installed packages
run: |
pip freeze
pip check
- name: Run the tests with Coverage
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(runner.os, 'Windows') }}
run: |
python -m pytest -vv --cov jupyter_server_ydoc --cov-branch --cov-report term-missing:skip-covered
#- name: Run the tests on pypy
# if: ${{ startsWith(matrix.python-version, 'pypy') }}
# run: |
# PyPy is not supported because we use the file_id_manager. See:
# https://github.com/jupyter-server/jupyter_server_fileid/issues/44
# python -W ignore::ImportWarning -m pytest -vv
- name: Run the tests on Windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
python -W ignore::ImportWarning -m pytest -vv --cov jupyter_server_ydoc --cov-branch --cov-report term-missing:skip-covered
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
- name: Build the extension
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
shell: bash
run: |
set -eux
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_server_ydoc.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyter/collaboration-extension.*OK"
python -m jupyterlab.browser_check
test_minimum_versions:
name: Test Minimum Versions
needs: [pre-commit, test-js, test-py]
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.8"
dependency_type: minimum
- name: Install the Python dependencies
run: |
pip install -e ".[test]"
- name: Run the unit tests
run: |
pytest -vv -W default || pytest -vv -W default --lf
test_prereleases:
name: Test Prereleases
needs: [pre-commit, test-js, test-py]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
pip install -e ".[test]"
- name: List installed packages
run: |
pip freeze
pip check
- name: Run the tests
run: |
pytest -vv -W default || pytest -vv --lf
make_sdist:
name: Make SDist
needs: [pre-commit, test-js, test-py]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Build SDist
shell: bash
run: |
pip install build
find projects/* -maxdepth 0 -type d | xargs -L 1 python -m build --sdist --outdir dist/
- uses: actions/upload-artifact@v3
with:
name: "sdist"
path: dist/*.tar.gz
test_sdist:
runs-on: ubuntu-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 15
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Download sdist
uses: actions/download-artifact@v3
- name: Install From SDist
shell: bash
run: |
echo "::group::Install from SDist"
set -ex
cd sdist
mkdir test
find *.tar.gz | xargs -L 1 tar -C ./test -zxvf
cd test
python -m pip install "jupyterlab>=4.0.0,<5"
# install each from source, except for `jupyter_collaboration` metapackage
find ./* -maxdepth 0 -type d -not -path './jupyter_collaboration-*' | sed 's/$/[test]/' | xargs -L 1 python -m pip install
echo "::endgroup::"
- name: Run Test
shell: bash
run: |
echo "::group::Run test"
set -ex
cd sdist/test
# for now only `jupyter_server_ydoc` includes python tests
cd jupyter_server_ydoc*
python -m pytest -vv -raXxs --durations 10 --color=yes
cd ..
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_server_ydoc.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyter/collaboration-extension.*OK"
python -m jupyterlab.browser_check --no-browser-test
echo "::endgroup::"
check_links:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
with:
ignore_links: "../api/*.* ./api/* .*/images/[\\w-]+.png https://docs.github.com/en/.* https://mybinder.org/v2/gh/jupyterlab/jupyter_collaboration/.*"
ui_tests:
runs-on: ubuntu-latest
needs: [pre-commit, test-js]
timeout-minutes: 30
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
pip install jupyterlab .
- name: Install playwright
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
jlpm install
working-directory: ui-tests
- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
- name: Install browser
run: jlpm playwright install chromium
working-directory: ui-tests
- name: run tests
working-directory: ui-tests
run: |
jlpm test
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: jupyter-collaboration-playwright-report
path: |
ui-tests/test-results
ui-tests/playwright-report