config.yml 4.4 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,docs]
  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. - 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: DATABASE_NAME=wagtail.db pipenv run python -u runtests.py
  28. frontend:
  29. docker:
  30. - image: cimg/node:18.12
  31. steps:
  32. - checkout
  33. - restore_cache:
  34. key: frontend-v1-{{ checksum "package-lock.json" }}
  35. # Only install if node_modules wasn’t cached.
  36. - run: |
  37. if [[ ! -e "node_modules" ]]; then
  38. npm install --no-save --no-optional --no-audit --no-fund --progress=false
  39. fi
  40. - save_cache:
  41. paths:
  42. - node_modules
  43. key: frontend-v1-{{ checksum "package-lock.json" }}
  44. - run: npm run build
  45. # Save static files for subsequent jobs.
  46. - persist_to_workspace:
  47. root: ~/project
  48. paths:
  49. - wagtail
  50. - run: npm run lint:js
  51. - run: npm run lint:css
  52. - run: npm run lint:format
  53. - run: npm run test:unit:coverage -- --runInBand
  54. - run: bash <(curl -s https://codecov.io/bash) -F frontend
  55. ui_tests:
  56. docker:
  57. - image: cimg/python:3.8.11-browsers
  58. environment:
  59. PIPENV_VENV_IN_PROJECT: true
  60. DJANGO_SETTINGS_MODULE: wagtail.test.settings_ui
  61. steps:
  62. - checkout
  63. - attach_workspace:
  64. at: ~/project
  65. - restore_cache:
  66. key: pipenv-v1-{{ checksum "setup.py" }}
  67. # Only install if .venv wasn’t cached.
  68. - run: |
  69. if [[ ! -e ".venv" ]]; then
  70. pipenv install -e .[testing]
  71. fi
  72. - save_cache:
  73. key: pipenv-v1-{{ checksum "setup.py" }}
  74. paths:
  75. - .venv
  76. - restore_cache:
  77. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  78. # Only install if node_modules wasn’t cached.
  79. - run: |
  80. if [[ ! -e "client/tests/integration/node_modules" ]]; then
  81. npm --prefix ./client/tests/integration ci
  82. fi
  83. - save_cache:
  84. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  85. paths:
  86. - client/tests/integration/node_modules
  87. - run: pipenv run ./wagtail/test/manage.py migrate
  88. - run:
  89. command: pipenv run ./wagtail/test/manage.py runserver 0:8000
  90. background: true
  91. - run: pipenv run ./wagtail/test/manage.py createcachetable
  92. - run:
  93. command: pipenv run ./wagtail/test/manage.py createsuperuser --noinput
  94. environment:
  95. DJANGO_SUPERUSER_EMAIL: admin@example.com
  96. DJANGO_SUPERUSER_USERNAME: admin
  97. DJANGO_SUPERUSER_PASSWORD: changeme
  98. - run:
  99. command: npm run test:integration -- --runInBand --reporters=default --reporters=jest-junit
  100. environment:
  101. JEST_JUNIT_OUTPUT_DIR: reports/jest
  102. - run:
  103. command: pipenv run ./wagtail/test/manage.py collectstatic --noinput
  104. environment:
  105. STATICFILES_STORAGE: manifest
  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