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. if [[ $GROUP == js:* ]]; then
  17. # extract the group name
  18. FORCE_COLOR=1 jlpm test:scope --loglevel success --scope "@jupyterlab/test-${GROUP#*:}"
  19. else
  20. FORCE_COLOR=1 jlpm test --loglevel success
  21. fi
  22. jlpm run clean
  23. fi
  24. if [[ $GROUP == jsscope ]]; then
  25. jlpm build:packages
  26. jlpm build:test
  27. FORCE_COLOR=1 jlpm test:scope --loglevel success --scope $JSTESTGROUP
  28. jlpm run clean
  29. fi
  30. if [[ $GROUP == docs ]]; then
  31. # Run the link check - allow for a link to fail once
  32. py.test --check-links -k .md . || py.test --check-links -k .md --lf .
  33. # Build the docs
  34. jlpm build:packages
  35. jlpm docs
  36. # Verify tutorial docs build
  37. pushd docs
  38. pip install sphinx sphinx-copybutton sphinx_rtd_theme recommonmark jsx-lexer
  39. make linkcheck
  40. make html
  41. popd
  42. fi
  43. if [[ $GROUP == integrity ]]; then
  44. # Run the integrity script first
  45. jlpm run integrity --force
  46. # Check yarn.lock file
  47. jlpm check --integrity
  48. # Lint our files.
  49. jlpm run lint:check || (echo 'Please run `jlpm run lint` locally and push changes' && exit 1)
  50. # Build the packages individually.
  51. jlpm run build:src
  52. # Make sure we have CSS that can be converted with postcss
  53. jlpm global add postcss-cli
  54. jlpm config set prefix ~/.yarn
  55. ~/.yarn/bin/postcss packages/**/style/*.css --dir /tmp
  56. # run twine check on the python build assets.
  57. # this must be done before altering any versions below.
  58. python -m pip install -U twine wheel
  59. python setup.py sdist
  60. python setup.py bdist_wheel
  61. twine check dist/*
  62. # Make sure we can bump the version
  63. # This must be done at the end so as not to interfere
  64. # with the other checks
  65. git config --global user.email "you@example.com"
  66. git config --global user.name "CI"
  67. git stash
  68. git checkout -b commit_${BUILD_SOURCEVERSION}
  69. git clean -df
  70. jlpm bumpversion minor --force
  71. jlpm bumpversion major --force
  72. jlpm bumpversion release --force # switch to beta
  73. jlpm bumpversion release --force # switch to rc
  74. jlpm bumpversion build --force
  75. VERSION=$(python setup.py --version)
  76. if [[ $VERSION != *rc1 ]]; then exit 1; fi
  77. # make sure we can patch release
  78. jlpm bumpversion release --force # switch to final
  79. jlpm patch:release --force
  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. # Make sure we can successfully load the dev app.
  159. python -m jupyterlab.browser_check --dev-mode
  160. # Make sure core mode works
  161. jlpm run build:core
  162. # Make sure we have a final released version of JupyterLab server
  163. python -m jupyterlab.browser_check --core-mode
  164. # Make sure we can run the built app.
  165. jupyter labextension install ./jupyterlab/tests/mock_packages/extension --debug
  166. python -m jupyterlab.browser_check
  167. jupyter labextension list --debug
  168. # Make sure we can non-dev install.
  169. virtualenv -p $(which python3) test_install
  170. ./test_install/bin/pip install -q ".[test]" # this populates <sys_prefix>/share/jupyter/lab
  171. ./test_install/bin/python -m jupyterlab.browser_check
  172. # Make sure we can run the build
  173. ./test_install/bin/jupyter lab build
  174. # Make sure we can start and kill the lab server
  175. ./test_install/bin/jupyter lab --no-browser &
  176. TASK_PID=$!
  177. # Make sure the task is running
  178. ps -p $TASK_PID || exit 1
  179. sleep 5
  180. kill $TASK_PID
  181. wait $TASK_PID
  182. # Make sure we can clean various bits of the app dir
  183. jupyter lab clean
  184. jupyter lab clean --extensions
  185. jupyter lab clean --settings
  186. jupyter lab clean --static
  187. jupyter lab clean --all
  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