config.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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 i eslint-plugin-jest@latest --save-dev # Seems to not be found otherwise
  93. npm run webpack
  94. npm run webpack-login
  95. npm run webpack-workers
  96. ./build/env/bin/hue collectstatic --noinput
  97. cp -r ~/repo/docs .
  98. # Run documentation lint
  99. - run:
  100. name: run documentation lints
  101. command: |
  102. cd ~/repo
  103. # Installs to move to image building
  104. curl -O https://dl.google.com/go/go1.15.linux-<< parameters.go_arch >>.tar.gz
  105. tar -xvf go1.15.linux-<< parameters.go_arch >>.tar.gz
  106. export GO111MODULE=on
  107. go/bin/go get -u github.com/raviqqe/muffet@v1.5.7
  108. 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
  109. tar -xvf hugo_0.69.0_Linux.tar.gz
  110. export PATH=$PWD:$HOME/go/bin:$PATH
  111. # Trigger linting if documentation changes
  112. ./tools/ci/check_for_website_dead_links.sh docs/docs-site
  113. # ./tools/ci/check_for_website_dead_links.sh docs/gethue
  114. # Run code lints
  115. - run:
  116. name: run python lints
  117. command: |
  118. cd ~/repo
  119. /usr/share/hue/build/env/bin/pip install pylint==1.7.5 pylint-django==0.7.2 configparser==4.0.2
  120. ./tools/ci/check_for_python_lint.sh /usr/share/hue
  121. - run:
  122. name: run commit title format check
  123. command: |
  124. cd ~/repo
  125. ./tools/ci/check_for_commit_message.sh
  126. - run:
  127. name: run js lint
  128. command: |
  129. cd /usr/share/hue
  130. cp ~/repo/.prettierrc .
  131. cp ~/repo/.eslint* .
  132. cp ~/repo/tools . -r
  133. npm run lint
  134. - run:
  135. name: run style lint
  136. command: |
  137. cd /usr/share/hue
  138. npm run style-lint
  139. - run:
  140. name: run npm license checker
  141. command: |
  142. cd /usr/share/hue
  143. npm run check-license
  144. - run:
  145. name: run npm absolute path detection
  146. command: |
  147. cd /usr/share/hue
  148. npm run check-absolute-paths
  149. # Run tests
  150. - run:
  151. name: run python API tests
  152. command: |
  153. cd /usr/share/hue
  154. PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
  155. - run:
  156. name: run js tests
  157. command: |
  158. cd /usr/share/hue
  159. # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
  160. sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
  161. npm run test
  162. - store_artifacts:
  163. path: test-reports
  164. destination: test-reports
  165. build-py-38-common:
  166. steps:
  167. - checkout
  168. - run:
  169. name: compile
  170. command: |
  171. if [ -d /usr/share/hue ]; then
  172. # Running in gethue/hue Docker container
  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. curl -sL https://bootstrap.pypa.io/get-pip.py | python3.8
  175. else
  176. sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
  177. export DEBIAN_FRONTEND=noninteractive
  178. sudo apt-get update
  179. 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
  180. curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && sudo apt-get install -y nodejs
  181. curl -sL https://bootstrap.pypa.io/get-pip.py | sudo python3.8
  182. sudo apt-get install -y libncursesw5-dev libgdbm-dev libc6-dev libssl-dev openssl
  183. fi
  184. export PYTHON_VER=python3.8
  185. export ROOT=$PWD
  186. make apps
  187. - run:
  188. name: run tests
  189. command: |
  190. PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
  191. jobs:
  192. build:
  193. docker:
  194. # specify the version you desire here
  195. # - image: circleci/python:3.8.0
  196. - image: gethue/hue:latest-py2
  197. # Specify service dependencies here if necessary
  198. # CircleCI maintains a library of pre-built images
  199. # documented at https://circleci.com/docs/2.0/circleci-images/
  200. # - image: circleci/postgres:9.4
  201. working_directory: ~/repo
  202. steps:
  203. - build-common:
  204. go_arch: "amd64"
  205. hugo_arch: "64bit"
  206. build-arm64:
  207. machine:
  208. image: ubuntu-2004:202101-01
  209. resource_class: arm.medium
  210. working_directory: ~/repo
  211. steps:
  212. - build-common:
  213. go_arch: "arm64"
  214. hugo_arch: "ARM64"
  215. commit:
  216. docker:
  217. - image: circleci/python:3.8.0
  218. working_directory: ~/repo
  219. steps:
  220. - checkout
  221. - add_ssh_keys:
  222. fingerprints:
  223. - "8c:68:29:28:04:80:38:31:c0:59:d9:3d:65:3e:b7:8c"
  224. - run:
  225. name: push to master
  226. command: |
  227. git push origin HEAD:master
  228. build-py-38:
  229. docker:
  230. - image: gethue/hue:latest-py2 # Should be circleci/python:3.6 at some point
  231. working_directory: ~/repo
  232. steps:
  233. - build-py-38-common
  234. build-py-38-arm64:
  235. machine:
  236. image: ubuntu-2004:202101-01
  237. resource_class: arm.medium
  238. working_directory: ~/repo
  239. steps:
  240. - build-py-38-common
  241. workflows:
  242. version: 2
  243. run-tests-and-rebase-master:
  244. jobs:
  245. - build:
  246. filters:
  247. branches:
  248. ignore:
  249. - master
  250. - py3-ci
  251. - build-arm64:
  252. filters:
  253. branches:
  254. ignore:
  255. - master
  256. - py3-ci
  257. - commit:
  258. requires:
  259. - build
  260. filters:
  261. branches:
  262. only:
  263. - /.*ci-commit-master.*/
  264. build-python3:
  265. jobs:
  266. - build-py-38:
  267. filters:
  268. branches:
  269. ignore:
  270. - master
  271. - build-py-38-arm64:
  272. filters:
  273. branches:
  274. ignore:
  275. - master