travis_script.sh 4.8 KB

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