config.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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.17.linux-<< parameters.go_arch >>.tar.gz
  105. tar -xvf go1.17.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 update
  174. apt-get install -y python3.8-dev python3.8-venv python3.8-distutils libsnappy-dev # This should not be needed as some point
  175. curl -sL https://bootstrap.pypa.io/get-pip.py | python3.8
  176. else
  177. sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
  178. export DEBIAN_FRONTEND=noninteractive
  179. sudo apt-get update
  180. 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
  181. curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && sudo apt-get install -y nodejs
  182. curl -sL https://bootstrap.pypa.io/get-pip.py | sudo python3.8
  183. sudo apt-get install -y libncursesw5-dev libgdbm-dev libc6-dev libssl-dev openssl
  184. fi
  185. export PYTHON_VER=python3.8
  186. export ROOT=$PWD
  187. make apps
  188. - run:
  189. name: run python lints
  190. command: |
  191. ./build/env/bin/pip install pylint==2.5.3 pylint-django==2.3.0 configparser==5.3.0
  192. ./tools/ci/check_for_python_lint.sh
  193. - run:
  194. name: run tests
  195. command: |
  196. PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
  197. jobs:
  198. build:
  199. docker:
  200. # specify the version you desire here
  201. # - image: circleci/python:3.8.0
  202. - image: gethue/hue:latest-py2
  203. # Specify service dependencies here if necessary
  204. # CircleCI maintains a library of pre-built images
  205. # documented at https://circleci.com/docs/2.0/circleci-images/
  206. # - image: circleci/postgres:9.4
  207. working_directory: ~/repo
  208. steps:
  209. - build-common:
  210. go_arch: "amd64"
  211. hugo_arch: "64bit"
  212. build-arm64:
  213. machine:
  214. image: ubuntu-2004:202101-01
  215. resource_class: arm.medium
  216. working_directory: ~/repo
  217. steps:
  218. - build-common:
  219. go_arch: "arm64"
  220. hugo_arch: "ARM64"
  221. commit:
  222. docker:
  223. - image: circleci/python:3.8.0
  224. working_directory: ~/repo
  225. steps:
  226. - checkout
  227. - add_ssh_keys:
  228. fingerprints:
  229. - "8c:68:29:28:04:80:38:31:c0:59:d9:3d:65:3e:b7:8c"
  230. - run:
  231. name: push to master
  232. command: |
  233. git push origin HEAD:master
  234. build-py-38:
  235. docker:
  236. - image: gethue/hue:latest-py2 # Should be circleci/python:3.6 at some point
  237. working_directory: ~/repo
  238. steps:
  239. - build-py-38-common
  240. build-py-38-arm64:
  241. machine:
  242. image: ubuntu-2004:202101-01
  243. resource_class: arm.medium
  244. working_directory: ~/repo
  245. steps:
  246. - build-py-38-common
  247. workflows:
  248. version: 2
  249. run-tests-and-rebase-master:
  250. jobs:
  251. - build:
  252. filters:
  253. branches:
  254. ignore:
  255. - master
  256. - py3-ci
  257. - build-arm64:
  258. filters:
  259. branches:
  260. ignore:
  261. - master
  262. - py3-ci
  263. - commit:
  264. requires:
  265. - build
  266. filters:
  267. branches:
  268. only:
  269. - /.*ci-commit-master.*/
  270. build-python3:
  271. jobs:
  272. - build-py-38:
  273. filters:
  274. branches:
  275. ignore:
  276. - master
  277. - build-py-38-arm64:
  278. filters:
  279. branches:
  280. ignore:
  281. - master