2
0

config.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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,docs]
  16. fi
  17. - save_cache:
  18. key: pipenv-v1-{{ 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. pipenv run python -u runtests.py --parallel=2
  32. frontend:
  33. docker:
  34. - image: cimg/node:20.9
  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.8.11-browsers
  63. environment:
  64. PIPENV_VENV_IN_PROJECT: true
  65. DJANGO_SETTINGS_MODULE: wagtail.test.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/test/manage.py migrate
  93. - run:
  94. command: pipenv run ./wagtail/test/manage.py runserver 0:8000
  95. background: true
  96. - run: pipenv run ./wagtail/test/manage.py createcachetable
  97. - run:
  98. command: pipenv run ./wagtail/test/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. - run:
  108. command: pipenv run ./wagtail/test/manage.py collectstatic --noinput
  109. environment:
  110. STATICFILES_STORAGE: manifest
  111. - store_test_results:
  112. path: ./reports/jest
  113. nightly-build:
  114. docker:
  115. - image: cimg/python:3.8.11-node
  116. steps:
  117. - checkout
  118. - run: pip install --user wheel boto3
  119. - run: npm install
  120. - run: npm run build
  121. - run: PYTHONPATH=. python scripts/nightly/get_version.py > __init__.py
  122. - run: mv __init__.py wagtail/__init__.py
  123. - run: python setup.py bdist_wheel
  124. - run: python scripts/nightly/upload.py
  125. workflows:
  126. version: 2
  127. test:
  128. jobs:
  129. - backend
  130. - frontend
  131. - ui_tests:
  132. requires:
  133. - frontend
  134. nightly:
  135. jobs:
  136. - nightly-build
  137. triggers:
  138. - schedule:
  139. cron: '0 0 * * *'
  140. filters:
  141. branches:
  142. only:
  143. - main