travis_script.sh 4.6 KB

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