ci_script.sh 7.6 KB

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