config.yml 4.6 KB

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