ci_script.sh 7.3 KB

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