ci_script.sh 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. #!/bin/bash
  2. # Copyright (c) Jupyter Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. set -ex
  5. set -o pipefail
  6. if [[ $GROUP != nonode ]]; then
  7. python -c "from jupyterlab.commands import build_check; build_check()"
  8. fi
  9. if [[ $GROUP == python ]]; then
  10. # Run the python tests
  11. py.test -v --junitxml=junit.xml
  12. fi
  13. if [[ $GROUP == js* ]]; then
  14. if [[ $GROUP == js-* ]]; then
  15. # extract the group name
  16. export PKG="${GROUP#*-}"
  17. jlpm run build:packages:scope --scope "@jupyterlab/$PKG"
  18. jlpm run build:test:scope --scope "@jupyterlab/test-$PKG"
  19. FORCE_COLOR=1 jlpm run test:scope --loglevel success --scope "@jupyterlab/test-$PKG"
  20. else
  21. jlpm build:packages
  22. jlpm build:test
  23. FORCE_COLOR=1 jlpm test --loglevel success
  24. fi
  25. jlpm run clean
  26. fi
  27. if [[ $GROUP == jsscope ]]; then
  28. jlpm build:packages
  29. jlpm build:test
  30. FORCE_COLOR=1 jlpm test:scope --loglevel success --scope $JSTESTGROUP
  31. jlpm run clean
  32. fi
  33. if [[ $GROUP == docs ]]; then
  34. # Build the docs
  35. jlpm build:packages
  36. jlpm docs
  37. # Verify tutorial docs build
  38. pushd docs
  39. pip install sphinx sphinx-copybutton sphinx_rtd_theme recommonmark jsx-lexer
  40. make html
  41. popd
  42. # Run the link check - allow for a link to fail once
  43. py.test --check-links -k .md . || py.test --check-links -k .md --lf .
  44. fi
  45. if [[ $GROUP == integrity ]]; then
  46. # Run the integrity script first
  47. jlpm run integrity --force
  48. # Check yarn.lock file
  49. jlpm check --integrity
  50. # Lint our files.
  51. jlpm run lint:check || (echo 'Please run `jlpm run lint` locally and push changes' && exit 1)
  52. # Build the packages individually.
  53. jlpm run build:src
  54. # Make sure we have CSS that can be converted with postcss
  55. jlpm global add postcss-cli
  56. jlpm config set prefix ~/.yarn
  57. ~/.yarn/bin/postcss packages/**/style/*.css --dir /tmp
  58. # run twine check on the python build assets.
  59. # this must be done before altering any versions below.
  60. python -m pip install -U twine wheel
  61. python setup.py sdist
  62. python setup.py bdist_wheel
  63. twine check dist/*
  64. # Make sure we can bump the version
  65. # This must be done at the end so as not to interfere
  66. # with the other checks
  67. git config --global user.email "you@example.com"
  68. git config --global user.name "CI"
  69. git stash
  70. git checkout -b commit_${BUILD_SOURCEVERSION}
  71. git clean -df
  72. jlpm bumpversion minor --force
  73. jlpm bumpversion major --force
  74. jlpm bumpversion release --force # switch to beta
  75. jlpm bumpversion release --force # switch to rc
  76. jlpm bumpversion build --force
  77. VERSION=$(python setup.py --version)
  78. if [[ $VERSION != *rc1 ]]; then exit 1; fi
  79. # make sure we can patch release
  80. jlpm bumpversion release --force # switch to final
  81. jlpm patch:release --force
  82. # make sure we can bump major JS releases
  83. jlpm bumpversion minor --force
  84. jlpm bump:js:major console --force
  85. jlpm bump:js:major console notebook --force
  86. # Make sure that a prepublish would include the proper files.
  87. jlpm run prepublish:check
  88. fi
  89. if [[ $GROUP == usage ]]; then
  90. # Build the examples.
  91. jlpm run build:packages
  92. jlpm run build:examples
  93. # Test the examples
  94. jlpm run test:examples
  95. # Test the cli apps.
  96. jupyter lab clean --debug
  97. jupyter lab build --debug
  98. jupyter lab path --debug
  99. pushd jupyterlab/tests/mock_packages
  100. jupyter labextension link extension --no-build --debug
  101. jupyter labextension unlink extension --no-build --debug
  102. jupyter labextension link extension --no-build --debug
  103. jupyter labextension unlink @jupyterlab/mock-extension --no-build --debug
  104. jupyter labextension install extension --no-build --debug
  105. jupyter labextension list --debug
  106. jupyter labextension disable @jupyterlab/mock-extension --debug
  107. jupyter labextension enable @jupyterlab/mock-extension --debug
  108. jupyter labextension disable @jupyterlab/notebook-extension --debug
  109. jupyter labextension uninstall @jupyterlab/mock-extension --no-build --debug
  110. jupyter labextension uninstall @jupyterlab/notebook-extension --no-build --debug
  111. popd
  112. jupyter lab workspaces export > workspace.json --debug
  113. jupyter lab workspaces import --name newspace workspace.json --debug
  114. jupyter lab workspaces export newspace > newspace.json --debug
  115. rm workspace.json newspace.json
  116. # Make sure we can call help on all the cli apps.
  117. jupyter lab -h
  118. jupyter lab build -h
  119. jupyter lab clean -h
  120. jupyter lab path -h
  121. jupyter labextension link -h
  122. jupyter labextension unlink -h
  123. jupyter labextension install -h
  124. jupyter labextension uninstall -h
  125. jupyter labextension list -h
  126. jupyter labextension enable -h
  127. jupyter labextension disable -h
  128. # Make sure we can add and remove a sibling package.
  129. # jlpm run add:sibling jupyterlab/tests/mock_packages/extension
  130. # jlpm run build
  131. # jlpm run remove:package extension
  132. # jlpm run build
  133. # jlpm run integrity --force # Should have a clean tree now
  134. # Test cli tools
  135. jlpm run get:dependency mocha
  136. jlpm run update:dependency mocha
  137. jlpm run remove:dependency mocha
  138. jlpm run get:dependency @jupyterlab/buildutils
  139. jlpm run get:dependency typescript
  140. jlpm run get:dependency react-native
  141. # Test theme creation - make sure we can add it as a package, build,
  142. # and run browser
  143. pip install -q pexpect
  144. python scripts/create_theme.py
  145. mv foo packages
  146. jlpm run integrity
  147. jlpm run build:packages
  148. jlpm run build:dev
  149. python -m jupyterlab.browser_check --dev-mode
  150. jlpm run remove:package foo
  151. jlpm run integrity
  152. ## Test app directory support being a symlink
  153. mkdir tmp
  154. pushd tmp
  155. mkdir real_app_dir
  156. ln -s real_app_dir link_app_dir
  157. # verify that app directory is not resolved
  158. env JUPYTERLAB_DIR=./link_app_dir jupyter lab path | grep link_app_dir
  159. popd
  160. # Make sure we can successfully load the dev app.
  161. python -m jupyterlab.browser_check --dev-mode
  162. # Make sure core mode works
  163. jlpm run build:core
  164. # Make sure we have a final released version of JupyterLab server
  165. python -m jupyterlab.browser_check --core-mode
  166. # Make sure we can run the built app.
  167. jupyter labextension install ./jupyterlab/tests/mock_packages/extension --debug
  168. python -m jupyterlab.browser_check
  169. jupyter labextension list --debug
  170. # Make sure we can non-dev install.
  171. virtualenv -p $(which python3) test_install
  172. ./test_install/bin/pip install -q ".[test]" # this populates <sys_prefix>/share/jupyter/lab
  173. ./test_install/bin/python -m jupyterlab.browser_check
  174. # Make sure we can run the build
  175. ./test_install/bin/jupyter lab build
  176. # Make sure we can start and kill the lab server
  177. ./test_install/bin/jupyter lab --no-browser &
  178. TASK_PID=$!
  179. # Make sure the task is running
  180. ps -p $TASK_PID || exit 1
  181. sleep 5
  182. kill $TASK_PID
  183. wait $TASK_PID
  184. # Make sure we can clean various bits of the app dir
  185. jupyter lab clean
  186. jupyter lab clean --extensions
  187. jupyter lab clean --settings
  188. jupyter lab clean --static
  189. jupyter lab clean --all
  190. fi
  191. if [[ $GROUP == nonode ]]; then
  192. # Make sure we can install the wheel
  193. virtualenv -p $(which python3) test_install
  194. ./test_install/bin/pip install -v --pre --no-cache-dir --no-deps jupyterlab --no-index --find-links=dist # Install latest jupyterlab
  195. ./test_install/bin/pip install jupyterlab # Install jupyterlab dependencies
  196. ./test_install/bin/python -m jupyterlab.browser_check --no-chrome-test
  197. # Make sure we can start and kill the lab server
  198. ./test_install/bin/jupyter lab --no-browser &
  199. TASK_PID=$!
  200. # Make sure the task is running
  201. ps -p $TASK_PID || exit 1
  202. sleep 5
  203. kill $TASK_PID
  204. wait $TASK_PID
  205. fi