travis_script.sh 4.9 KB

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