travis_script.sh 4.8 KB

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