config.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. version: 2.1
  2. parameters:
  3. # This parameter is used to trigger the main workflow
  4. trigger:
  5. type: boolean
  6. default: true
  7. # A parameter per group
  8. backend:
  9. type: boolean
  10. default: false
  11. frontend:
  12. type: boolean
  13. default: false
  14. jobs:
  15. trigger-workflows:
  16. docker:
  17. - image: cimg/base:stable
  18. steps:
  19. - checkout
  20. - run:
  21. name: Trigger workflows
  22. command: .circleci/conditional-builds.sh
  23. backend:
  24. docker:
  25. - image: cimg/python:3.8.11
  26. environment:
  27. PIPENV_VENV_IN_PROJECT: true
  28. steps:
  29. - checkout
  30. - restore_cache:
  31. key: pipenv-v1-{{ checksum "setup.py" }}
  32. # Only install if .venv wasn’t cached.
  33. - run: |
  34. if [[ ! -e ".venv" ]]; then
  35. pipenv install -e .[testing]
  36. fi
  37. - save_cache:
  38. key: pipenv-v1-{{ checksum "setup.py" }}
  39. paths:
  40. - .venv
  41. - run: pipenv run flake8
  42. - run: pipenv run isort --check-only --diff .
  43. # Filter out known false positives, while preserving normal output and error codes.
  44. # See https://github.com/motet-a/jinjalint/issues/18.
  45. # And https://circleci.com/docs/2.0/configuration-reference/#default-shell-options.
  46. - run:
  47. shell: /bin/bash -e
  48. command: pipenv run jinjalint --parse-only wagtail | grep -v 'welcome_page.html:6:70' | tee /dev/tty | wc -l | grep -q '0'
  49. - run: pipenv run doc8 docs
  50. - run: DATABASE_NAME=wagtail.db pipenv run python -u runtests.py
  51. frontend:
  52. docker:
  53. - image: circleci/node:14
  54. steps:
  55. - checkout
  56. - restore_cache:
  57. key: frontend-v1-{{ checksum "package-lock.json" }}
  58. # Only install if node_modules wasn’t cached.
  59. - run: |
  60. if [[ ! -e "node_modules" ]]; then
  61. npm install --no-save --no-optional --no-audit --no-fund --progress=false
  62. fi
  63. - save_cache:
  64. paths:
  65. - node_modules
  66. key: frontend-v1-{{ checksum "package-lock.json" }}
  67. - run: npm run dist
  68. # Save static files for subsequent jobs.
  69. - persist_to_workspace:
  70. root: ~/project
  71. paths:
  72. - wagtail
  73. - run: npm run lint:js
  74. - run: npm run lint:css
  75. - run: npm run test:unit:coverage -- --runInBand
  76. - run: bash <(curl -s https://codecov.io/bash) -F frontend
  77. ui_tests:
  78. docker:
  79. - image: cimg/python:3.8.11-browsers
  80. environment:
  81. PIPENV_VENV_IN_PROJECT: true
  82. DJANGO_SETTINGS_MODULE: wagtail.tests.settings_ui
  83. steps:
  84. - checkout
  85. - attach_workspace:
  86. at: ~/project
  87. - restore_cache:
  88. key: pipenv-v1-{{ checksum "setup.py" }}
  89. # Only install if .venv wasn’t cached.
  90. - run: |
  91. if [[ ! -e ".venv" ]]; then
  92. pipenv install -e .[testing]
  93. fi
  94. - save_cache:
  95. key: pipenv-v1-{{ checksum "setup.py" }}
  96. paths:
  97. - .venv
  98. - restore_cache:
  99. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  100. # Only install if node_modules wasn’t cached.
  101. - run: |
  102. if [[ ! -e "client/tests/integration/node_modules" ]]; then
  103. npm --prefix ./client/tests/integration ci
  104. fi
  105. - save_cache:
  106. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  107. paths:
  108. - client/tests/integration/node_modules
  109. - run: pipenv run ./wagtail/tests/manage.py migrate
  110. - run:
  111. command: pipenv run ./wagtail/tests/manage.py runserver 0:8000
  112. background: true
  113. - run: pipenv run ./wagtail/tests/manage.py createcachetable
  114. - run:
  115. command: pipenv run ./wagtail/tests/manage.py createsuperuser --noinput
  116. environment:
  117. DJANGO_SUPERUSER_EMAIL: admin@example.com
  118. DJANGO_SUPERUSER_USERNAME: admin
  119. DJANGO_SUPERUSER_PASSWORD: changeme
  120. - run:
  121. command: npm run test:integration -- --runInBand --reporters=default --reporters=jest-junit
  122. environment:
  123. JEST_JUNIT_OUTPUT_DIR: reports/jest
  124. - store_test_results:
  125. path: ./reports/jest
  126. nightly-build:
  127. docker:
  128. - image: cimg/python:3.8.11
  129. steps:
  130. - checkout
  131. - run: cd ~ && wget https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-x64.tar.gz
  132. - run: cd /usr/local/ && sudo tar --strip-components 1 -xzf ~/node-v14.17.5-linux-x64.tar.gz
  133. - run: pip install --user wheel boto3
  134. - run: npm install
  135. - run: npm run dist
  136. - run: PYTHONPATH=. python scripts/nightly/get_version.py > __init__.py
  137. - run: mv __init__.py wagtail/__init__.py
  138. - run: python setup.py bdist_wheel
  139. - run: python scripts/nightly/upload.py
  140. workflows:
  141. version: 2
  142. ci:
  143. when: << pipeline.parameters.trigger >>
  144. jobs:
  145. - trigger-workflows
  146. backend:
  147. when: << pipeline.parameters.backend >>
  148. jobs:
  149. - backend
  150. frontend:
  151. when: << pipeline.parameters.frontend >>
  152. jobs:
  153. - frontend
  154. - ui_tests:
  155. requires:
  156. - frontend
  157. nightly:
  158. jobs:
  159. - nightly-build
  160. triggers:
  161. - schedule:
  162. cron: "0 0 * * *"
  163. filters:
  164. branches:
  165. only:
  166. - main