ci_script.sh 6.8 KB

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