travis_script.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #!/bin/bash
  2. # Copyright (c) Jupyter Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. set -ex
  5. export DISPLAY=:99.0
  6. sh -e /etc/init.d/xvfb start || true
  7. export PATH="$MINICONDA_DIR/bin:$PATH"
  8. source activate test
  9. if [[ $GROUP == py2 || $GROUP == py3 ]]; then
  10. # Run the python tests
  11. py.test -v
  12. fi
  13. if [[ $GROUP == js ]]; then
  14. jlpm build:packages
  15. jlpm build:test
  16. # Allow the tests to fail once due to slow CI.
  17. jlpm test || jlpm test
  18. jlpm run clean
  19. fi
  20. if [[ $GROUP == js_cov ]]; then
  21. jlpm run build:packages
  22. jlpm run build:test
  23. # Allow the tests to fail once due to slow CI.
  24. jlpm run coverage || jlpm run coverage
  25. # Run the services node example.
  26. pushd packages/services/examples/node
  27. python main.py
  28. popd
  29. jlpm run clean
  30. fi
  31. if [[ $GROUP == js_services ]]; then
  32. jlpm build:packages
  33. jlpm build:test
  34. # Allow the tests to fail once due to slow CI.
  35. jlpm run test:services || jlpm run test:services
  36. fi
  37. if [[ $GROUP == docs ]]; then
  38. # Run the link check - allow for a link to fail once
  39. py.test --check-links -k .md . || py.test --check-links -k .md --lf .
  40. # Build the api docs
  41. jlpm run docs
  42. # Verify tutorial docs build
  43. pushd docs
  44. conda remove --name test_docs --all || true
  45. conda env create -n test_docs -f environment.yml
  46. source activate test_docs
  47. make html
  48. source deactivate
  49. popd
  50. fi
  51. if [[ $GROUP == integrity ]]; then
  52. # Build the packages individually.
  53. jlpm run build:src
  54. # Make sure the examples build
  55. jlpm run build:examples
  56. # Run a tslint check
  57. ./node_modules/.bin/tslint -c tslint.json -e '**/*.d.ts' -e 'node_modules/**/*.ts' -e 'jupyterlab/**/*.ts' '**/*.ts'
  58. # Make sure we have CSS that can be converted with postcss
  59. jlpm global add postcss-cli
  60. jlpm config set prefix ~/.yarn
  61. ~/.yarn/bin/postcss packages/**/style/*.css --dir /tmp
  62. # Make sure we can successfully load the dev app.
  63. python -m jupyterlab.selenium_check --dev-mode
  64. # Make sure we can run the built app.
  65. jupyter labextension install ./jupyterlab/tests/mock_packages/extension
  66. python -m jupyterlab.selenium_check
  67. jupyter labextension list
  68. # Make sure we can non-dev install.
  69. conda remove --name test_install --all || true
  70. conda create -n test_install notebook python=3.5
  71. source activate test_install
  72. pip install ".[test]" # this populates <sys_prefix>/share/jupyter/lab
  73. python -m jupyterlab.selenium_check
  74. # Make sure we can start and kill the lab server
  75. 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. source deactivate
  83. fi
  84. if [[ $GROUP == cli ]]; then
  85. # Test the cli apps.
  86. jupyter lab clean
  87. jupyter lab build
  88. jupyter lab path
  89. pushd jupyterlab/tests/mock_packages
  90. jupyter labextension link extension --no-build
  91. jupyter labextension unlink extension --no-build
  92. jupyter labextension link extension --no-build
  93. jupyter labextension unlink @jupyterlab/mock-extension --no-build
  94. jupyter labextension install extension --no-build
  95. jupyter labextension list
  96. jupyter labextension disable @jupyterlab/mock-extension
  97. jupyter labextension enable @jupyterlab/mock-extension
  98. jupyter labextension disable @jupyterlab/notebook-extension
  99. jupyter labextension uninstall @jupyterlab/mock-extension --no-build
  100. jupyter labextension uninstall @jupyterlab/notebook-extension --no-build
  101. popd
  102. # Make sure we can call help on all the cli apps.
  103. jupyter lab -h
  104. jupyter lab build -h
  105. jupyter lab clean -h
  106. jupyter lab path -h
  107. jupyter labextension link -h
  108. jupyter labextension unlink -h
  109. jupyter labextension install -h
  110. jupyter labextension uninstall -h
  111. jupyter labextension list -h
  112. jupyter labextension enable -h
  113. jupyter labextension disable -h
  114. # Make sure we can add and remove a sibling package.
  115. jlpm run add:sibling jupyterlab/tests/mock_packages/extension
  116. jlpm run build
  117. jlpm run remove:package extension
  118. jlpm run build
  119. jlpm run integrity
  120. # Test cli tools
  121. jlpm run get:dependency mocha
  122. jlpm run update:dependency mocha
  123. jlpm run remove:dependency mocha
  124. jlpm run get:dependency @jupyterlab/buildutils
  125. jlpm run get:dependency typescript
  126. jlpm run get:dependency react-native
  127. # Test theme creation - make sure we can add it as a package, build,
  128. # and run selenium
  129. pip install pexpect
  130. python scripts/create_theme.py
  131. mv foo packages
  132. jlpm run integrity || exit 0
  133. jlpm run build:packages
  134. jlpm run build:dev
  135. python -m jupyterlab.selenium_check --dev-mode
  136. rm -rf packages/foo
  137. jlpm run integrity || exit 0
  138. fi