ci_script.sh 8.3 KB

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