config.yml 4.6 KB

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