config.yml 6.5 KB

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