-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
ci_script.sh
257 lines (210 loc) · 8.1 KB
/
ci_script.sh
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
#!/bin/bash
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
set -ex
set -o pipefail
if [[ $GROUP != nonode ]]; then
python -c "from jupyterlab.commands import build_check; build_check()"
fi
if [[ $GROUP == python ]]; then
# Run the python tests
py.test -v --junitxml=junit.xml
fi
if [[ $GROUP == js* ]]; then
if [[ $GROUP == js-* ]]; then
# extract the group name
export PKG="${GROUP#*-}"
jlpm run build:packages:scope --scope "@jupyterlab/$PKG"
jlpm run build:test:scope --scope "@jupyterlab/test-$PKG"
FORCE_COLOR=1 jlpm run test:scope --loglevel success --scope "@jupyterlab/test-$PKG"
else
jlpm build:packages
jlpm build:test
FORCE_COLOR=1 jlpm test --loglevel success
fi
jlpm run clean
fi
if [[ $GROUP == jsscope ]]; then
jlpm build:packages
jlpm build:test
FORCE_COLOR=1 jlpm test:scope --loglevel success --scope $JSTESTGROUP
jlpm run clean
fi
if [[ $GROUP == docs ]]; then
# Run the link check - allow for a link to fail once (--lf means only run last failed)
py.test --check-links -k .md . || py.test --check-links -k .md --lf .
# Build the docs
jlpm build:packages
jlpm docs
# Verify tutorial docs build
pushd docs
pip install sphinx sphinx-copybutton sphinx_rtd_theme recommonmark jsx-lexer
make html
# Remove internal sphinx files and use pytest-check-links on the generated html
rm build/html/genindex.html
rm build/html/search.html
# FIXME: re-enable pending https://github.com/minrk/pytest-check-links/pull/7
#py.test --check-links -k .html build/html || py.test --check-links -k .html --lf build/html
popd
fi
if [[ $GROUP == integrity ]]; then
# Run the integrity script first
jlpm run integrity --force
# Check yarn.lock file
jlpm check --integrity
# Lint our files.
jlpm run lint:check || (echo 'Please run `jlpm run lint` locally and push changes' && exit 1)
# Build the packages individually.
jlpm run build:src
# Make sure we have CSS that can be converted with postcss
jlpm global add postcss-cli
jlpm config set prefix ~/.yarn
~/.yarn/bin/postcss packages/**/style/*.css --dir /tmp
# run twine check on the python build assets.
# this must be done before altering any versions below.
python -m pip install -U twine wheel
python setup.py sdist
python setup.py bdist_wheel
twine check dist/*
# Make sure we can bump the version
# This must be done at the end so as not to interfere
# with the other checks
git config --global user.email "you@example.com"
git config --global user.name "CI"
git stash
git checkout -b commit_${BUILD_SOURCEVERSION}
git clean -df
jlpm bumpversion minor --force
jlpm bumpversion major --force
jlpm bumpversion release --force # switch to beta
jlpm bumpversion release --force # switch to rc
jlpm bumpversion build --force
VERSION=$(python setup.py --version)
if [[ $VERSION != *rc1 ]]; then exit 1; fi
# make sure we can patch release
jlpm bumpversion release --force # switch to final
jlpm patch:release --force
# make sure we can bump major JS releases
jlpm bumpversion minor --force
jlpm bump:js:major console --force
jlpm bump:js:major console notebook --force
# Make sure that a prepublish would include the proper files.
jlpm run prepublish:check
fi
if [[ $GROUP == usage ]]; then
# Build the examples.
jlpm run build:packages
jlpm run build:examples
# Test the examples
jlpm run test:examples
# Test the cli apps.
jupyter lab clean --debug
jupyter lab build --debug
jupyter lab path --debug
pushd jupyterlab/tests/mock_packages
jupyter labextension link extension --no-build --debug
jupyter labextension unlink extension --no-build --debug
jupyter labextension link extension --no-build --debug
jupyter labextension unlink @jupyterlab/mock-extension --no-build --debug
jupyter labextension install extension --no-build --debug
jupyter labextension list --debug
jupyter labextension disable @jupyterlab/mock-extension --debug
jupyter labextension enable @jupyterlab/mock-extension --debug
jupyter labextension disable @jupyterlab/notebook-extension --debug
jupyter labextension uninstall @jupyterlab/mock-extension --no-build --debug
jupyter labextension uninstall @jupyterlab/notebook-extension --no-build --debug
popd
jupyter lab workspaces export > workspace.json --debug
jupyter lab workspaces import --name newspace workspace.json --debug
jupyter lab workspaces export newspace > newspace.json --debug
rm workspace.json newspace.json
# Make sure we can call help on all the cli apps.
jupyter lab -h
jupyter lab build -h
jupyter lab clean -h
jupyter lab path -h
jupyter labextension link -h
jupyter labextension unlink -h
jupyter labextension install -h
jupyter labextension uninstall -h
jupyter labextension list -h
jupyter labextension enable -h
jupyter labextension disable -h
# Make sure we can add and remove a sibling package.
# jlpm run add:sibling jupyterlab/tests/mock_packages/extension
# jlpm run build
# jlpm run remove:package extension
# jlpm run build
# jlpm run integrity --force # Should have a clean tree now
# Test cli tools
jlpm run get:dependency mocha
jlpm run update:dependency mocha
jlpm run remove:dependency mocha
jlpm run get:dependency @jupyterlab/buildutils
jlpm run get:dependency typescript
jlpm run get:dependency react-native
# Test theme creation - make sure we can add it as a package, build,
# and run browser
pip install -q pexpect
python scripts/create_theme.py
mv foo packages
jlpm run integrity
jlpm run build:packages
jlpm run build:dev
python -m jupyterlab.browser_check --dev-mode
jlpm run remove:package foo
jlpm run integrity
## Test app directory support being a symlink
mkdir tmp
pushd tmp
mkdir real_app_dir
ln -s real_app_dir link_app_dir
# verify that app directory is not resolved
env JUPYTERLAB_DIR=./link_app_dir jupyter lab path | grep link_app_dir
popd
# Make sure we can successfully load the dev app.
python -m jupyterlab.browser_check --dev-mode
# Make sure core mode works
jlpm run build:core
# Make sure we have a final released version of JupyterLab server
python -m jupyterlab.browser_check --core-mode
# Make sure we can run the built app.
jupyter labextension install ./jupyterlab/tests/mock_packages/extension --debug
python -m jupyterlab.browser_check
jupyter labextension list --debug
# Make sure we can non-dev install.
virtualenv -p $(which python3) test_install
./test_install/bin/pip install -q ".[test]" # this populates <sys_prefix>/share/jupyter/lab
./test_install/bin/python -m jupyterlab.browser_check
# Make sure we can run the build
./test_install/bin/jupyter lab build
# Make sure we can start and kill the lab server
./test_install/bin/jupyter lab --no-browser &
TASK_PID=$!
# Make sure the task is running
ps -p $TASK_PID || exit 1
sleep 5
kill $TASK_PID
wait $TASK_PID
# Make sure we can clean various bits of the app dir
jupyter lab clean
jupyter lab clean --extensions
jupyter lab clean --settings
jupyter lab clean --static
jupyter lab clean --all
fi
if [[ $GROUP == nonode ]]; then
# Make sure we can install the wheel
virtualenv -p $(which python3) test_install
./test_install/bin/pip install -v --pre --no-cache-dir --no-deps jupyterlab --no-index --find-links=dist # Install latest jupyterlab
./test_install/bin/pip install jupyterlab # Install jupyterlab dependencies
./test_install/bin/python -m jupyterlab.browser_check --no-chrome-test
# Make sure we can start and kill the lab server
./test_install/bin/jupyter lab --no-browser &
TASK_PID=$!
# Make sure the task is running
ps -p $TASK_PID || exit 1
sleep 5
kill $TASK_PID
wait $TASK_PID
fi