ci_script.sh 8.1 KB

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