config.yml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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.1
  6. commands:
  7. build-common:
  8. parameters:
  9. go_arch:
  10. # amd64 or arm64
  11. type: string
  12. hugo_arch:
  13. # 64bit (AMD64) or ARM64
  14. type: string
  15. steps:
  16. - checkout
  17. # Download and cache dependencies
  18. # - restore_cache:
  19. # keys:
  20. # - v1-dependencies-{{ checksum "requirements.txt" }}
  21. # # fallback to using the latest cache if no exact match is found
  22. # - v1-dependencies-
  23. # - run:
  24. # name: install dependencies
  25. # command: |
  26. # python -m venv venv
  27. # . venv/bin/activate
  28. # pip install -r requirements.txt
  29. # - save_cache:
  30. # paths:
  31. # - ./venv
  32. # key: v1-dependencies-{{ checksum "requirements.txt" }}
  33. # Revert to traditional pip install when build refactored, in the meantime:
  34. - run:
  35. name: refresh sources
  36. command: |
  37. if [ ! -d /usr/share/hue ]; then
  38. # Ubuntu 20.04 ARM64
  39. sudo mkdir -p /usr/share/hue
  40. sudo chown -R $USER:$USER /usr/share/hue
  41. fi
  42. rm -rf /usr/share/hue/desktop/core/src/desktop
  43. mkdir -p /usr/share/hue/desktop/core/src/
  44. cp -r desktop/core/src/desktop /usr/share/hue/desktop/core/src/desktop
  45. for lib in `ls desktop/libs`
  46. do
  47. rm -rf /usr/share/hue/desktop/libs/$lib/src/$lib
  48. mkdir -p /usr/share/hue/desktop/libs/$lib/src/
  49. cp -r desktop/libs/$lib/src/$lib /usr/share/hue/desktop/libs/$lib/src/$lib
  50. done
  51. for lib in `ls apps | grep -v Makefile | grep -v logs`
  52. do
  53. rm -rf /usr/share/hue/apps/$lib/src/$lib
  54. mkdir -p /usr/share/hue/apps/$lib/src/
  55. cp -r apps/$lib/src/$lib /usr/share/hue/apps/$lib/src/$lib
  56. done
  57. rm -rf /usr/share/hue/tools
  58. cp -r tools /usr/share/hue
  59. rm -f /usr/share/hue/desktop/conf/*.ini
  60. mkdir -p /usr/share/hue/desktop/conf/
  61. cp desktop/conf/pseudo-distributed.ini.tmpl /usr/share/hue/desktop/conf/pseudo-distributed.ini
  62. # ini configuration tweaks
  63. ## Very slow if on, cuts time in two and does not skip tests
  64. sed -i 's/## has_iam_detection=true/ has_iam_detection=false/g' /usr/share/hue/desktop/conf/pseudo-distributed.ini
  65. # build Hue when using plain Ubuntu image
  66. if [ ! -f /usr/share/hue/build/env/bin/hue ]; then
  67. sudo add-apt-repository --yes ppa:deadsnakes/ppa
  68. sudo apt-get update
  69. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true TZ=UTC sudo apt-get install -y --no-install-recommends python2.7-dev libsnappy-dev asciidoc git ant gcc g++ libffi-dev libkrb5-dev libmysqlclient-dev libsasl2-dev libsasl2-modules-gssapi-mit libsqlite3-dev libssl-dev libxml2-dev libxslt-dev make maven libldap2-dev python-setuptools libgmp3-dev
  70. # see https://docs.gethue.com/administrator/installation/dependencies/#mysql--mariadb
  71. git config user.email "hue+circleci@example.com"
  72. git config user.name "Hue CircleCI"
  73. git cherry-pick 7a9100d4a7f38eaef7bd4bd7c715ac1f24a969a8
  74. git cherry-pick e67c1105b85b815346758ef1b9cd714dd91d7ea3
  75. git clean -fdx
  76. make apps
  77. cp -r build /usr/share/hue/
  78. fi
  79. cd /usr/share/hue
  80. # make npm-install # Not available
  81. cp ~/repo/babel.config.js .
  82. cp ~/repo/tsconfig.json .
  83. cp ~/repo/jest.config.js .
  84. cp ~/repo/.pylintrc .
  85. cp ~/repo/.stylelintrc .
  86. cp ~/repo/webpack.config*.js .
  87. rm -f package.json
  88. cp ~/repo/package.json .
  89. rm -f package-lock.json
  90. cp ~/repo/package-lock.json .
  91. npm install
  92. npm run webpack
  93. npm run webpack-login
  94. npm run webpack-workers
  95. ./build/env/bin/hue collectstatic --noinput
  96. cp -r ~/repo/docs .
  97. # Run documentation lint
  98. - run:
  99. name: run documentation lints
  100. command: |
  101. cd ~/repo
  102. # Installs to move to image building
  103. curl -O https://dl.google.com/go/go1.17.linux-<< parameters.go_arch >>.tar.gz
  104. tar -xvf go1.17.linux-<< parameters.go_arch >>.tar.gz
  105. export GO111MODULE=on
  106. go/bin/go get -u github.com/raviqqe/muffet@v1.5.7
  107. curl --output hugo_0.69.0_Linux.tar.gz -L https://github.com/gohugoio/hugo/releases/download/v0.69.0/hugo_0.69.0_Linux-<< parameters.hugo_arch >>.tar.gz
  108. tar -xvf hugo_0.69.0_Linux.tar.gz
  109. export PATH=$PWD:$HOME/go/bin:$PATH
  110. # Trigger linting if documentation changes
  111. ./tools/ci/check_for_website_dead_links.sh docs/docs-site
  112. # ./tools/ci/check_for_website_dead_links.sh docs/gethue
  113. # Run code lints
  114. - run:
  115. name: run python lints
  116. command: |
  117. cd ~/repo
  118. /usr/share/hue/build/env/bin/pip install pylint==1.7.5 pylint-django==0.7.2 configparser==4.0.2
  119. ./tools/ci/check_for_python_lint.sh /usr/share/hue
  120. # Run tests
  121. - run:
  122. name: run python API tests
  123. command: |
  124. cd /usr/share/hue
  125. PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
  126. - store_artifacts:
  127. path: test-reports
  128. destination: test-reports
  129. build-py-38-common:
  130. steps:
  131. - checkout
  132. - run:
  133. name: compile
  134. command: |
  135. if [ -d /usr/share/hue ]; then
  136. # Running in gethue/hue Docker container
  137. apt-get update
  138. apt-get install -y python3.8-dev python3.8-venv python3.8-distutils libsnappy-dev # This should not be needed as some point
  139. curl -sL https://bootstrap.pypa.io/get-pip.py | python3.8
  140. else
  141. sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
  142. export DEBIAN_FRONTEND=noninteractive
  143. sudo apt-get update
  144. sudo apt-get install -y gcc g++ build-essential python3.8-dev python3.8-venv python3.8-distutils asciidoc rsync curl libkrb5-dev libldap2-dev libsasl2-dev libxml2-dev libxslt-dev libsasl2-modules-gssapi-mit libsnappy-dev libffi-dev
  145. curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && sudo apt-get install -y nodejs
  146. curl -sL https://bootstrap.pypa.io/get-pip.py | sudo python3.8
  147. sudo apt-get install -y libncursesw5-dev libgdbm-dev libc6-dev libssl-dev openssl
  148. fi
  149. export PYTHON_VER=python3.8
  150. export ROOT=$PWD
  151. make apps
  152. - run:
  153. name: run python lints
  154. command: |
  155. ./build/env/bin/pip install pylint==2.5.3 pylint-django==2.3.0 configparser==5.3.0
  156. ./tools/ci/check_for_python_lint.sh
  157. - run:
  158. name: run tests
  159. command: |
  160. PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
  161. jobs:
  162. build:
  163. docker:
  164. # specify the version you desire here
  165. # - image: circleci/python:3.8.0
  166. - image: gethue/hue:latest-py2
  167. # Specify service dependencies here if necessary
  168. # CircleCI maintains a library of pre-built images
  169. # documented at https://circleci.com/docs/2.0/circleci-images/
  170. # - image: circleci/postgres:9.4
  171. working_directory: ~/repo
  172. steps:
  173. - build-common:
  174. go_arch: "amd64"
  175. hugo_arch: "64bit"
  176. build-arm64:
  177. machine:
  178. image: ubuntu-2004:202101-01
  179. resource_class: arm.medium
  180. working_directory: ~/repo
  181. steps:
  182. - build-common:
  183. go_arch: "arm64"
  184. hugo_arch: "ARM64"
  185. commit:
  186. docker:
  187. - image: circleci/python:3.8.0
  188. working_directory: ~/repo
  189. steps:
  190. - checkout
  191. - add_ssh_keys:
  192. fingerprints:
  193. - "8c:68:29:28:04:80:38:31:c0:59:d9:3d:65:3e:b7:8c"
  194. - run:
  195. name: push to master
  196. command: |
  197. git push origin HEAD:master
  198. build-py-38:
  199. docker:
  200. - image: gethue/hue:latest-py2 # Should be circleci/python:3.6 at some point
  201. working_directory: ~/repo
  202. steps:
  203. - build-py-38-common
  204. build-py-38-arm64:
  205. machine:
  206. image: ubuntu-2004:202101-01
  207. resource_class: arm.medium
  208. working_directory: ~/repo
  209. steps:
  210. - build-py-38-common
  211. workflows:
  212. version: 2
  213. run-tests-and-rebase-master:
  214. jobs:
  215. - build:
  216. filters:
  217. branches:
  218. ignore:
  219. - master
  220. - py3-ci
  221. - build-arm64:
  222. filters:
  223. branches:
  224. ignore:
  225. - master
  226. - py3-ci
  227. - commit:
  228. requires:
  229. - build
  230. filters:
  231. branches:
  232. only:
  233. - /.*ci-commit-master.*/
  234. build-python3:
  235. jobs:
  236. - build-py-38:
  237. filters:
  238. branches:
  239. ignore:
  240. - master
  241. - build-py-38-arm64:
  242. filters:
  243. branches:
  244. ignore:
  245. - master