config.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. # Python CircleCI 2.0 configuration file
  2. #
  3. # Check https://circleci.com/docs/2.0/language-python/ for more details
  4. #
  5. version: 2
  6. jobs:
  7. build:
  8. docker:
  9. # specify the version you desire here
  10. # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
  11. # - image: circleci/python:3.6.1
  12. - image: gethue/hue:latest
  13. # Specify service dependencies here if necessary
  14. # CircleCI maintains a library of pre-built images
  15. # documented at https://circleci.com/docs/2.0/circleci-images/
  16. # - image: circleci/postgres:9.4
  17. working_directory: ~/repo
  18. steps:
  19. - checkout
  20. # Download and cache dependencies
  21. # - restore_cache:
  22. # keys:
  23. # - v1-dependencies-{{ checksum "requirements.txt" }}
  24. # # fallback to using the latest cache if no exact match is found
  25. # - v1-dependencies-
  26. # - run:
  27. # name: install dependencies
  28. # command: |
  29. # python -m venv venv
  30. # . venv/bin/activate
  31. # pip install -r requirements.txt
  32. # - save_cache:
  33. # paths:
  34. # - ./venv
  35. # key: v1-dependencies-{{ checksum "requirements.txt" }}
  36. # Revert to traditional pip install when build refactored, in the meantime:
  37. - run:
  38. name: refresh sources
  39. command: |
  40. rm -r /usr/share/hue/desktop/core/src/desktop
  41. cp -r desktop/core/src/desktop /usr/share/hue/desktop/core/src/desktop
  42. for lib in `ls desktop/libs`
  43. do
  44. rm -r /usr/share/hue/desktop/libs/$lib/src/$lib
  45. cp -r desktop/libs/$lib/src/$lib /usr/share/hue/desktop/libs/$lib/src/$lib
  46. done
  47. for lib in `ls apps | grep -v Makefile`
  48. do
  49. rm -r /usr/share/hue/apps/$lib/src/$lib
  50. cp -r apps/$lib/src/$lib /usr/share/hue/apps/$lib/src/$lib
  51. done
  52. rm -r /usr/share/hue/tools
  53. cp -r tools /usr/share/hue
  54. rm /usr/share/hue/desktop/conf/*.ini
  55. cp desktop/conf/pseudo-distributed.ini.tmpl /usr/share/hue/desktop/conf/pseudo-distributed.ini
  56. cd /usr/share/hue
  57. # make npm-install # Not available
  58. cp ~/repo/.babelrc .
  59. cp ~/repo/jest.config.js .
  60. cp ~/repo/webpack.config*.js .
  61. npm install
  62. npm i eslint-plugin-jest@latest --save-dev # Seems to not be found otherwise
  63. npm run webpack
  64. npm run webpack-login
  65. npm run webpack-workers
  66. ./build/env/bin/hue collectstatic --noinput
  67. # cp -r ~/repo/docs .
  68. # make doc
  69. # hugo --source docs/docs-site
  70. # Run code analyses
  71. - run:
  72. name: run python lints
  73. command: |
  74. cd ~/repo
  75. ./tools/ci/check_for_invalid_characters.sh
  76. - run:
  77. name: run js lint
  78. command: |
  79. cd /usr/share/hue
  80. cp ~/repo/.prettierrc .
  81. cp ~/repo/.eslint* .
  82. cp ~/repo/tools . -r
  83. npm run lint
  84. # Run tests
  85. - run:
  86. name: run python API tests
  87. command: |
  88. cd /usr/share/hue
  89. ./build/env/bin/hue test unit --with-xunit --with-cover
  90. - run:
  91. name: run js tests
  92. command: |
  93. cd /usr/share/hue
  94. # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
  95. sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
  96. npm run test
  97. - store_artifacts:
  98. path: test-reports
  99. destination: test-reports
  100. commit:
  101. docker:
  102. - image: circleci/python:3.6.1
  103. working_directory: ~/repo
  104. steps:
  105. - checkout
  106. - add_ssh_keys:
  107. fingerprints:
  108. - "8c:68:29:28:04:80:38:31:c0:59:d9:3d:65:3e:b7:8c"
  109. - run:
  110. name: push to master
  111. command: |
  112. git push origin HEAD:master
  113. build-py3:
  114. docker:
  115. - image: gethue/hue:latest # Should be circleci/python:3.6.1 at some point
  116. working_directory: ~/repo
  117. steps:
  118. - checkout
  119. # Download and cache dependencies
  120. # - restore_cache:
  121. # keys:
  122. # - v1-dependencies-{{ checksum "desktop/core/requirements_py3.txt" }}
  123. # # fallback to using the latest cache if no exact match is found
  124. # - v1-dependencies-
  125. - run:
  126. name: compile
  127. command: |
  128. apt-get install -y python3.6-dev libsnappy-dev # This should not be needed as some point
  129. export PYTHON_VER=python3.6
  130. make apps
  131. - run:
  132. name: run tests
  133. command: |
  134. ./build/env/bin/hue test unit --with-xunit --with-cover
  135. # - run:
  136. # name: install dependencies
  137. # command: |
  138. # python -m venv venv
  139. # make apps
  140. # - save_cache:
  141. # paths:
  142. # - ./build/venv
  143. # key: v1-dependencies-{{ checksum "esktop/core/requirements_py3.txt" }}
  144. workflows:
  145. version: 2
  146. run-tests-and-rebase-master:
  147. jobs:
  148. - build:
  149. filters:
  150. branches:
  151. ignore:
  152. - master
  153. - py3-ci
  154. - commit:
  155. requires:
  156. - build
  157. filters:
  158. branches:
  159. only:
  160. - /.*ci-commit-master.*/
  161. - build-py3:
  162. filters:
  163. branches:
  164. only:
  165. - py3-ci