config.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. version: 2
  2. jobs:
  3. backend:
  4. docker:
  5. - image: cimg/python:3.12
  6. environment:
  7. PIPENV_VENV_IN_PROJECT: true
  8. steps:
  9. - checkout
  10. - restore_cache:
  11. key: pipenv-v3-{{ checksum "setup.py" }}
  12. # Only install if .venv wasn’t cached.
  13. - run: |
  14. if [[ ! -e ".venv" ]]; then
  15. pipenv install -e .[testing,docs]
  16. fi
  17. - save_cache:
  18. key: pipenv-v3-{{ checksum "setup.py" }}
  19. paths:
  20. - .venv
  21. - run: pipenv run ruff check .
  22. - run: pipenv run ruff format --check .
  23. - run: pipenv run semgrep --config .semgrep.yml --error .
  24. - run: git ls-files '*.html' | xargs pipenv run djhtml --check
  25. - run: pipenv run curlylint --parse-only wagtail
  26. - run: pipenv run doc8 docs
  27. - run:
  28. name: Run tests
  29. command: |
  30. export PYTHONUNBUFFERED=1
  31. WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT=1 pipenv run python -u runtests.py --parallel=2
  32. frontend:
  33. docker:
  34. - image: cimg/node:22.11
  35. steps:
  36. - checkout
  37. - restore_cache:
  38. key: frontend-v1-{{ checksum "package-lock.json" }}
  39. # Only install if node_modules wasn’t cached.
  40. - run: |
  41. if [[ ! -e "node_modules" ]]; then
  42. npm install --no-save --no-optional --no-audit --no-fund --progress=false
  43. fi
  44. - save_cache:
  45. paths:
  46. - node_modules
  47. key: frontend-v1-{{ checksum "package-lock.json" }}
  48. - run: npm run build
  49. # Save static files for subsequent jobs.
  50. - persist_to_workspace:
  51. root: ~/project
  52. paths:
  53. - wagtail
  54. - run: npm run build-storybook
  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.12-browsers
  63. environment:
  64. PIPENV_VENV_IN_PROJECT: true
  65. DJANGO_SETTINGS_MODULE: wagtail.test.settings_ui
  66. DJANGO_DEBUG: true
  67. steps:
  68. - checkout
  69. - attach_workspace:
  70. at: ~/project
  71. - restore_cache:
  72. key: ui_tests-pipenv-v3-{{ checksum "setup.py" }}
  73. # Only install if .venv wasn’t cached.
  74. - run: |
  75. if [[ ! -e ".venv" ]]; then
  76. pipenv install -e .[testing]
  77. fi
  78. - save_cache:
  79. key: ui_tests-pipenv-v3-{{ checksum "setup.py" }}
  80. paths:
  81. - .venv
  82. - restore_cache:
  83. key: ui_tests-npm_integration-v3-{{ checksum "client/tests/integration/package-lock.json" }}
  84. # Only install if node_modules wasn’t cached.
  85. - run: |
  86. if [[ ! -e "client/tests/integration/node_modules" ]]; then
  87. npm --prefix ./client/tests/integration ci
  88. fi
  89. - save_cache:
  90. key: ui_tests-npm_integration-v3-{{ checksum "client/tests/integration/package-lock.json" }}
  91. paths:
  92. - client/tests/integration/node_modules
  93. # Also cache the global location where Puppeteer stores browsers.
  94. # https://pptr.dev/guides/configuration/#changing-the-default-cache-directory
  95. - ~/.cache/puppeteer
  96. - run: pipenv run ./wagtail/test/manage.py migrate
  97. - run:
  98. command: pipenv run ./wagtail/test/manage.py runserver 0:8000
  99. background: true
  100. - run: pipenv run ./wagtail/test/manage.py createcachetable
  101. - run:
  102. command: pipenv run ./wagtail/test/manage.py createsuperuser --noinput
  103. environment:
  104. DJANGO_SUPERUSER_EMAIL: admin@example.com
  105. DJANGO_SUPERUSER_USERNAME: admin
  106. DJANGO_SUPERUSER_PASSWORD: changeme
  107. - run:
  108. command: npm run test:integration -- --runInBand --reporters=default --reporters=jest-junit
  109. environment:
  110. JEST_JUNIT_OUTPUT_DIR: reports/jest
  111. - run:
  112. command: pipenv run ./wagtail/test/manage.py collectstatic --noinput
  113. environment:
  114. DJANGO_DEBUG: false
  115. STATICFILES_STORAGE: manifest
  116. - store_test_results:
  117. path: ./reports/jest
  118. nightly-build:
  119. docker:
  120. - image: cimg/python:3.12-node
  121. steps:
  122. - checkout
  123. - run: pip install --user wheel boto3
  124. - run: npm install
  125. - run: npm run build
  126. - run: PYTHONPATH=. python scripts/nightly/get_version.py > __init__.py
  127. - run: mv __init__.py wagtail/__init__.py
  128. - run: python setup.py bdist_wheel
  129. - run: python scripts/nightly/upload.py
  130. workflows:
  131. version: 2
  132. test:
  133. jobs:
  134. - backend
  135. - frontend
  136. - ui_tests:
  137. requires:
  138. - frontend
  139. nightly:
  140. jobs:
  141. - nightly-build
  142. triggers:
  143. - schedule:
  144. cron: '0 0 * * *'
  145. filters:
  146. branches:
  147. only:
  148. - main