config.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. # Run documentation lint
  71. - run:
  72. name: run documentation lints
  73. command: |
  74. cd ~/repo
  75. # Installs to move to image building
  76. curl -O https://dl.google.com/go/go1.11.linux-amd64.tar.gz
  77. tar -xvf go1.11.linux-amd64.tar.gz
  78. go/bin/go get -u github.com/raviqqe/muffet
  79. curl --output hugo_0.69.0_Linux-64bit.tar.gz -L https://github.com/gohugoio/hugo/releases/download/v0.69.0/hugo_0.69.0_Linux-64bit.tar.gz
  80. tar -xvf hugo_0.69.0_Linux-64bit.tar.gz
  81. export PATH=$PWD:$HOME/go/bin:$PATH
  82. # Trigger linting if documentation changes
  83. ./tools/ci/check_for_website_dead_links.sh docs/docs-site
  84. # ./tools/ci/check_for_website_dead_links.sh docs/gethue
  85. # Run code lints
  86. - run:
  87. name: run python lints
  88. command: |
  89. cd ~/repo
  90. ./tools/ci/check_for_invalid_characters.sh
  91. - run:
  92. name: run js lint
  93. command: |
  94. cd /usr/share/hue
  95. cp ~/repo/.prettierrc .
  96. cp ~/repo/.eslint* .
  97. cp ~/repo/tools . -r
  98. npm run lint
  99. - run:
  100. name: run npm license checker
  101. command: |
  102. cd /usr/share/hue
  103. npm run check-license
  104. # Run tests
  105. - run:
  106. name: run python API tests
  107. command: |
  108. cd /usr/share/hue
  109. ./build/env/bin/hue test unit --with-xunit --with-cover
  110. - run:
  111. name: run js tests
  112. command: |
  113. cd /usr/share/hue
  114. # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
  115. sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
  116. npm run test
  117. - store_artifacts:
  118. path: test-reports
  119. destination: test-reports
  120. commit:
  121. docker:
  122. - image: circleci/python:3.8.0
  123. working_directory: ~/repo
  124. steps:
  125. - checkout
  126. - add_ssh_keys:
  127. fingerprints:
  128. - "8c:68:29:28:04:80:38:31:c0:59:d9:3d:65:3e:b7:8c"
  129. - run:
  130. name: push to master
  131. command: |
  132. git push origin HEAD:master
  133. build-py3.6:
  134. docker:
  135. - image: gethue/hue:latest # Should be circleci/python:3.6 at some point
  136. working_directory: ~/repo
  137. steps:
  138. - checkout
  139. # Download and cache dependencies
  140. # - restore_cache:
  141. # keys:
  142. # - v1-dependencies-{{ checksum "desktop/core/requirements_py3.txt" }}
  143. # # fallback to using the latest cache if no exact match is found
  144. # - v1-dependencies-
  145. - run:
  146. name: compile
  147. command: |
  148. apt-get update && apt-get install -y python3.6-dev libsnappy-dev # This should not be needed as some point
  149. export PYTHON_VER=python3.6
  150. make apps
  151. - run:
  152. name: run tests
  153. command: |
  154. ./build/env/bin/hue test unit --with-xunit --with-cover
  155. # - run:
  156. # name: install dependencies
  157. # command: |
  158. # python -m venv venv
  159. # make apps
  160. # - save_cache:
  161. # paths:
  162. # - ./build/venv
  163. # key: v1-dependencies-{{ checksum "esktop/core/requirements_py3.txt" }}
  164. build-py3.8:
  165. docker:
  166. - image: gethue/hue:latest # Should be circleci/python:3.x at some point
  167. working_directory: ~/repo
  168. steps:
  169. - checkout
  170. - run:
  171. name: compile
  172. command: |
  173. apt-get install -y python3.8-dev python3.8-venv python3.8-distutils libsnappy-dev # This should not be needed as some point
  174. export PYTHON_VER=python3.8
  175. make apps
  176. - run:
  177. name: run tests
  178. command: |
  179. ./build/env/bin/hue test unit --with-xunit --with-cover
  180. workflows:
  181. version: 2
  182. run-tests-and-rebase-master:
  183. jobs:
  184. - build:
  185. filters:
  186. branches:
  187. ignore:
  188. - master
  189. - py3-ci
  190. - build-py3.6:
  191. filters:
  192. branches:
  193. ignore:
  194. - master
  195. - py3-ci
  196. - commit:
  197. requires:
  198. - build
  199. - build-py3.6
  200. filters:
  201. branches:
  202. only:
  203. - /.*ci-commit-master.*/
  204. build-python3:
  205. jobs:
  206. - build-py3.8:
  207. filters:
  208. branches:
  209. only:
  210. - py3-ci
  211. - build-py3.6:
  212. filters:
  213. branches:
  214. only:
  215. - py3-ci