travis_script.sh 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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_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. # Make sure we can call help on all the cli apps.
  107. jupyter lab -h
  108. jupyter lab build -h
  109. jupyter lab clean -h
  110. jupyter lab path -h
  111. jupyter labextension link -h
  112. jupyter labextension unlink -h
  113. jupyter labextension install -h
  114. jupyter labextension uninstall -h
  115. jupyter labextension list -h
  116. jupyter labextension enable -h
  117. jupyter labextension disable -h
  118. # Make sure we can add and remove a sibling package.
  119. jlpm run add:sibling jupyterlab/tests/mock_packages/extension
  120. jlpm run build
  121. jlpm run remove:package extension
  122. jlpm run build
  123. jlpm run integrity --force # Should have a clean tree now
  124. # Test cli tools
  125. jlpm run get:dependency mocha
  126. jlpm run update:dependency mocha
  127. jlpm run remove:dependency mocha
  128. jlpm run get:dependency @jupyterlab/buildutils
  129. jlpm run get:dependency typescript
  130. jlpm run get:dependency react-native
  131. # Test theme creation - make sure we can add it as a package, build,
  132. # and run browser
  133. pip install -q pexpect
  134. python scripts/create_theme.py
  135. mv foo packages
  136. jlpm run integrity
  137. jlpm run build:packages
  138. jlpm run build:dev
  139. python -m jupyterlab.browser_check --dev-mode
  140. rm -rf packages/foo
  141. jlpm run integrity
  142. ## Test app directory support being a symlink
  143. mkdir tmp
  144. pushd tmp
  145. mkdir real_app_dir
  146. ln -s real_app_dir link_app_dir
  147. # verify that app directory is not resolved
  148. env JUPYTERLAB_DIR=./link_app_dir jupyter lab path | grep link_app_dir
  149. popd
  150. # Build the examples.
  151. jlpm run build:examples
  152. # Test the examples
  153. jlpm run test:examples
  154. # Make sure we can successfully load the dev app.
  155. python -m jupyterlab.browser_check --dev-mode
  156. # Make sure core mode works
  157. jlpm run build:core
  158. # Make sure we have a final released version of JupyterLab server
  159. python -m jupyterlab.browser_check --core-mode
  160. # Make sure we can run the built app.
  161. jupyter labextension install ./jupyterlab/tests/mock_packages/extension
  162. python -m jupyterlab.browser_check
  163. jupyter labextension list
  164. # Make sure the deprecated `selenium_check` command still works
  165. python -m jupyterlab.selenium_check
  166. # Make sure we can non-dev install.
  167. virtualenv -p $(which python3) test_install
  168. ./test_install/bin/pip install -q ".[test]" # this populates <sys_prefix>/share/jupyter/lab
  169. ./test_install/bin/python -m jupyterlab.browser_check
  170. # Make sure we can run the build
  171. ./test_install/bin/jupyter lab build
  172. # Make sure we can start and kill the lab server
  173. ./test_install/bin/jupyter lab --no-browser &
  174. TASK_PID=$!
  175. # Make sure the task is running
  176. ps -p $TASK_PID || exit 1
  177. sleep 5
  178. kill $TASK_PID
  179. wait $TASK_PID
  180. fi