ci_script.sh 7.3 KB

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