travis_script.sh 6.7 KB

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