config.yml 8.1 KB

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