travis_script.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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
  10. fi
  11. if [[ $GROUP == js ]]; then
  12. jlpm build:packages
  13. jlpm build:test
  14. jlpm test --loglevel success > /dev/null
  15. jlpm run clean
  16. fi
  17. if [[ $GROUP == js_cov ]]; then
  18. jlpm run build:packages
  19. jlpm run build:test
  20. jlpm run coverage --loglevel success > /dev/null
  21. # Run the services node example.
  22. pushd packages/services/examples/node
  23. python main.py
  24. popd
  25. jlpm run clean
  26. fi
  27. if [[ $GROUP == js_services ]]; then
  28. jlpm build:packages
  29. jlpm build:test
  30. jlpm run test:services || jlpm run test:services
  31. fi
  32. if [[ $GROUP == docs ]]; then
  33. # Run the link check - allow for a link to fail once
  34. py.test --check-links -k .md . || py.test --check-links -k .md --lf .
  35. # Build the api docs
  36. jlpm run docs
  37. # Verify tutorial docs build
  38. pushd docs
  39. pip install "sphinx<1.8" sphinx_rtd_theme recommonmark
  40. make html
  41. popd
  42. fi
  43. if [[ $GROUP == integrity ]]; then
  44. # Run the integrity script first
  45. jlpm run integrity
  46. # Lint our files.
  47. jlpm run lint:check || (echo 'Please run `jlpm run lint` locally and push changes' && exit 1)
  48. # Build the packages individually.
  49. jlpm run build:src
  50. # Make sure the examples build
  51. jlpm run build:examples
  52. # Make sure we have CSS that can be converted with postcss
  53. jlpm global add postcss-cli
  54. jlpm config set prefix ~/.yarn
  55. ~/.yarn/bin/postcss packages/**/style/*.css --dir /tmp
  56. # Make sure we can successfully load the dev app.
  57. python -m jupyterlab.browser_check --dev-mode
  58. # Make sure core mode works
  59. jlpm run build:core
  60. python -m jupyterlab.browser_check --core-mode
  61. # Make sure we can run the built app.
  62. jupyter labextension install ./jupyterlab/tests/mock_packages/extension
  63. python -m jupyterlab.browser_check
  64. jupyter labextension list
  65. # Make sure the deprecated `selenium_check` command still works
  66. python -m jupyterlab.selenium_check
  67. # Make sure we can non-dev install.
  68. virtualenv -p $(which python3) test_install
  69. ./test_install/bin/pip install -q ".[test]" # this populates <sys_prefix>/share/jupyter/lab
  70. ./test_install/bin/python -m jupyterlab.browser_check
  71. # Make sure we can run the build
  72. ./test_install/bin/jupyter lab build
  73. # Make sure we can start and kill the lab server
  74. ./test_install/bin/jupyter lab --no-browser &
  75. TASK_PID=$!
  76. # Make sure the task is running
  77. ps -p $TASK_PID || exit 1
  78. sleep 5
  79. kill $TASK_PID
  80. wait $TASK_PID
  81. fi
  82. if [[ $GROUP == cli ]]; then
  83. # Test the cli apps.
  84. jupyter lab clean
  85. jupyter lab build
  86. jupyter lab path
  87. pushd jupyterlab/tests/mock_packages
  88. jupyter labextension link extension --no-build
  89. jupyter labextension unlink extension --no-build
  90. jupyter labextension link extension --no-build
  91. jupyter labextension unlink @jupyterlab/mock-extension --no-build
  92. jupyter labextension install extension --no-build
  93. jupyter labextension list
  94. jupyter labextension disable @jupyterlab/mock-extension
  95. jupyter labextension enable @jupyterlab/mock-extension
  96. jupyter labextension disable @jupyterlab/notebook-extension
  97. jupyter labextension uninstall @jupyterlab/mock-extension --no-build
  98. jupyter labextension uninstall @jupyterlab/notebook-extension --no-build
  99. popd
  100. # Make sure we can call help on all the cli apps.
  101. jupyter lab -h
  102. jupyter lab build -h
  103. jupyter lab clean -h
  104. jupyter lab path -h
  105. jupyter labextension link -h
  106. jupyter labextension unlink -h
  107. jupyter labextension install -h
  108. jupyter labextension uninstall -h
  109. jupyter labextension list -h
  110. jupyter labextension enable -h
  111. jupyter labextension disable -h
  112. # Make sure we can add and remove a sibling package.
  113. jlpm run add:sibling jupyterlab/tests/mock_packages/extension
  114. jlpm run build
  115. jlpm run remove:package extension
  116. jlpm run build
  117. jlpm run integrity
  118. # Test cli tools
  119. jlpm run get:dependency mocha
  120. jlpm run update:dependency mocha
  121. jlpm run remove:dependency mocha
  122. jlpm run get:dependency @jupyterlab/buildutils
  123. jlpm run get:dependency typescript
  124. jlpm run get:dependency react-native
  125. # Test theme creation - make sure we can add it as a package, build,
  126. # and run browser
  127. pip install -q pexpect
  128. python scripts/create_theme.py
  129. mv foo packages
  130. jlpm run integrity || exit 0
  131. jlpm run build:packages
  132. jlpm run build:dev
  133. python -m jupyterlab.browser_check --dev-mode
  134. rm -rf packages/foo
  135. jlpm run integrity || exit 0
  136. fi