ci_script.sh 7.8 KB

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