ci_script.sh 9.0 KB

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