ci_script.sh 8.6 KB

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