config.yml 4.7 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:14
  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. - run: npm run test:unit:coverage -- --runInBand
  56. - run: bash <(curl -s https://codecov.io/bash) -F frontend
  57. ui_tests:
  58. docker:
  59. - image: cimg/python:3.8.11-browsers
  60. environment:
  61. PIPENV_VENV_IN_PROJECT: true
  62. DJANGO_SETTINGS_MODULE: wagtail.tests.settings_ui
  63. steps:
  64. - checkout
  65. - attach_workspace:
  66. at: ~/project
  67. - restore_cache:
  68. key: pipenv-v1-{{ checksum "setup.py" }}
  69. # Only install if .venv wasn’t cached.
  70. - run: |
  71. if [[ ! -e ".venv" ]]; then
  72. pipenv install -e .[testing]
  73. fi
  74. - save_cache:
  75. key: pipenv-v1-{{ checksum "setup.py" }}
  76. paths:
  77. - .venv
  78. - restore_cache:
  79. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  80. # Only install if node_modules wasn’t cached.
  81. - run: |
  82. if [[ ! -e "client/tests/integration/node_modules" ]]; then
  83. npm --prefix ./client/tests/integration ci
  84. fi
  85. - save_cache:
  86. key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
  87. paths:
  88. - client/tests/integration/node_modules
  89. - run: pipenv run ./wagtail/tests/manage.py migrate
  90. - run:
  91. command: pipenv run ./wagtail/tests/manage.py runserver 0:8000
  92. background: true
  93. - run: pipenv run ./wagtail/tests/manage.py createcachetable
  94. - run:
  95. command: pipenv run ./wagtail/tests/manage.py createsuperuser --noinput
  96. environment:
  97. DJANGO_SUPERUSER_EMAIL: admin@example.com
  98. DJANGO_SUPERUSER_USERNAME: admin
  99. DJANGO_SUPERUSER_PASSWORD: changeme
  100. - run:
  101. command: npm run test:integration -- --runInBand --reporters=default --reporters=jest-junit
  102. environment:
  103. JEST_JUNIT_OUTPUT_DIR: reports/jest
  104. - store_test_results:
  105. path: ./reports/jest
  106. nightly-build:
  107. docker:
  108. - image: cimg/python:3.8.11
  109. steps:
  110. - checkout
  111. - run: cd ~ && wget https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-x64.tar.gz
  112. - run: cd /usr/local/ && sudo tar --strip-components 1 -xzf ~/node-v14.17.5-linux-x64.tar.gz
  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