test.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. name: Wagtail CI
  2. on:
  3. push:
  4. paths-ignore:
  5. - 'docs/**'
  6. pull_request:
  7. paths-ignore:
  8. - 'docs/**'
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.ref }}
  11. cancel-in-progress: true
  12. # Our test suite should cover:
  13. # - all supported databases against current Python and Django
  14. # - at least one test run for each older supported version of Python and Django
  15. # - at least one test run for each supported Elasticsearch version
  16. # - a test run against Django's git main and active stable branch (allowing failures)
  17. # - test runs with USE_EMAIL_USER_MODEL=yes and DISABLE_TIMEZONE=yes
  18. # Current configuration:
  19. # - django 3.2, python 3.7, postgres
  20. # - django 3.2, python 3.8, mysql
  21. # - django 4.0, python 3.9, sqlite
  22. # - django 4.1, python 3.9, mysql
  23. # - django 4.0, python 3.10, postgres, USE_EMAIL_USER_MODEL=yes
  24. # - django 4.1, python 3.10, postgres, DISABLE_TIMEZONE=yes
  25. # - django stable/4.1.x, python 3.10, postgres (allow failures)
  26. # - django main, python 3.10, postgres (allow failures)
  27. # - elasticsearch 5, django 3.2, python 3.7, sqlite
  28. # - elasticsearch 6, django 3.2, python 3.7, postgres
  29. # - elasticsearch 7, django 4.0, python 3.8, postgres
  30. # - elasticsearch 7, django 4.1, python 3.9, sqlite, USE_EMAIL_USER_MODEL=yes
  31. jobs:
  32. test-sqlite:
  33. runs-on: ubuntu-latest
  34. strategy:
  35. matrix:
  36. include:
  37. - python: '3.9'
  38. django: 'Django>=4.0,<4.1'
  39. steps:
  40. - uses: actions/checkout@v3
  41. - name: Set up Python ${{ matrix.python }}
  42. uses: actions/setup-python@v3
  43. with:
  44. python-version: ${{ matrix.python }}
  45. - name: Install dependencies
  46. run: |
  47. python -m pip install --upgrade pip
  48. pip install -e .[testing]
  49. pip install "${{ matrix.django }}"
  50. - name: Test
  51. run: |
  52. ./runtests.py
  53. env:
  54. DATABASE_ENGINE: django.db.backends.sqlite3
  55. test-postgres:
  56. runs-on: ubuntu-latest
  57. continue-on-error: ${{ matrix.experimental }}
  58. strategy:
  59. matrix:
  60. include:
  61. - python: '3.7'
  62. django: 'Django>=3.2,<3.3'
  63. experimental: false
  64. - python: '3.10'
  65. django: 'Django>=4.1,<4.2'
  66. notz: notz
  67. experimental: false
  68. - python: '3.10'
  69. django: 'Django>=4.0,<4.1'
  70. experimental: false
  71. emailuser: emailuser
  72. - python: '3.10'
  73. django: 'git+https://github.com/django/django.git@stable/4.1.x#egg=Django'
  74. experimental: true
  75. postgres: 'postgres:12'
  76. - python: '3.10'
  77. django: 'git+https://github.com/django/django.git@main#egg=Django'
  78. install_extras: 'pip uninstall -y djangorestframework ; pip install git+https://github.com/encode/django-rest-framework.git@master#egg=djangorestframework'
  79. experimental: true
  80. postgres: 'postgres:12'
  81. services:
  82. postgres:
  83. image: ${{ matrix.postgres || 'postgres:10.8' }}
  84. env:
  85. POSTGRES_PASSWORD: postgres
  86. ports:
  87. - 5432:5432
  88. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  89. steps:
  90. - uses: actions/checkout@v3
  91. - name: Set up Python ${{ matrix.python }}
  92. uses: actions/setup-python@v3
  93. with:
  94. python-version: ${{ matrix.python }}
  95. - name: Install dependencies
  96. run: |
  97. python -m pip install --upgrade pip
  98. pip install "psycopg2>=2.6"
  99. pip install -e .[testing]
  100. pip install "${{ matrix.django }}"
  101. ${{ matrix.install_extras }}
  102. - name: Test
  103. run: |
  104. ./runtests.py
  105. env:
  106. DATABASE_ENGINE: django.db.backends.postgresql
  107. DATABASE_HOST: localhost
  108. DATABASE_USER: postgres
  109. DATABASE_PASSWORD: postgres
  110. USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
  111. DISABLE_TIMEZONE: ${{ matrix.notz }}
  112. test-mysql:
  113. runs-on: ubuntu-latest
  114. continue-on-error: ${{ matrix.experimental }}
  115. strategy:
  116. matrix:
  117. include:
  118. - python: '3.8'
  119. django: 'Django>=3.2,<3.3'
  120. experimental: false
  121. - python: '3.9'
  122. django: 'Django>=4.1,<4.2'
  123. experimental: false
  124. services:
  125. mysql:
  126. image: mysql:8.0.23
  127. env:
  128. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  129. MYSQL_DATABASE: wagtail
  130. ports:
  131. - 3306:3306
  132. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  133. steps:
  134. - uses: actions/checkout@v3
  135. - name: Set up Python ${{ matrix.python }}
  136. uses: actions/setup-python@v3
  137. with:
  138. python-version: ${{ matrix.python }}
  139. - name: Install dependencies
  140. run: |
  141. python -m pip install --upgrade pip
  142. pip install "mysqlclient>=1.4,<2"
  143. pip install -e .[testing]
  144. pip install "${{ matrix.django }}"
  145. - name: Test
  146. run: |
  147. ./runtests.py
  148. env:
  149. DATABASE_ENGINE: django.db.backends.mysql
  150. DATABASE_HOST: '127.0.0.1'
  151. DATABASE_USER: root
  152. # https://github.com/elastic/elastic-github-actions doesn't work for Elasticsearch 5,
  153. # but https://github.com/getong/elasticsearch-action does
  154. test-sqlite-elasticsearch5:
  155. runs-on: ubuntu-latest
  156. strategy:
  157. matrix:
  158. include:
  159. - python: '3.7'
  160. django: 'Django>=3.2,<3.3'
  161. steps:
  162. - name: Configure sysctl limits
  163. run: |
  164. sudo swapoff -a
  165. sudo sysctl -w vm.swappiness=1
  166. sudo sysctl -w fs.file-max=262144
  167. sudo sysctl -w vm.max_map_count=262144
  168. - uses: getong/elasticsearch-action@v1.2
  169. with:
  170. elasticsearch version: 5.6.9
  171. host port: 9200
  172. container port: 9200
  173. host node port: 9300
  174. node port: 9300
  175. discovery type: 'single-node'
  176. - uses: actions/checkout@v3
  177. - name: Set up Python ${{ matrix.python }}
  178. uses: actions/setup-python@v3
  179. with:
  180. python-version: ${{ matrix.python }}
  181. - name: Install dependencies
  182. run: |
  183. python -m pip install --upgrade pip
  184. pip install -e .[testing]
  185. pip install "${{ matrix.django }}"
  186. pip install "elasticsearch>=5,<6"
  187. pip install certifi
  188. - name: Test
  189. run: |
  190. ./runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch5
  191. env:
  192. DATABASE_ENGINE: django.db.backends.sqlite3
  193. test-sqlite-elasticsearch7:
  194. runs-on: ubuntu-latest
  195. strategy:
  196. matrix:
  197. include:
  198. - python: '3.9'
  199. django: 'Django>=4.1,<4.2'
  200. emailuser: emailuser
  201. steps:
  202. - name: Configure sysctl limits
  203. run: |
  204. sudo swapoff -a
  205. sudo sysctl -w vm.swappiness=1
  206. sudo sysctl -w fs.file-max=262144
  207. sudo sysctl -w vm.max_map_count=262144
  208. - uses: getong/elasticsearch-action@v1.2
  209. with:
  210. elasticsearch version: 7.6.1
  211. host port: 9200
  212. container port: 9200
  213. host node port: 9300
  214. node port: 9300
  215. discovery type: 'single-node'
  216. - uses: actions/checkout@v3
  217. - name: Set up Python ${{ matrix.python }}
  218. uses: actions/setup-python@v3
  219. with:
  220. python-version: ${{ matrix.python }}
  221. - name: Install dependencies
  222. run: |
  223. python -m pip install --upgrade pip
  224. pip install -e .[testing]
  225. pip install "${{ matrix.django }}"
  226. pip install "elasticsearch>=7,<8"
  227. pip install certifi
  228. - name: Test
  229. run: |
  230. ./runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch7
  231. env:
  232. DATABASE_ENGINE: django.db.backends.sqlite3
  233. USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
  234. # https://github.com/getong/elasticsearch-action doesn't work for Elasticsearch 6,
  235. # but https://github.com/elastic/elastic-github-actions does
  236. test-postgres-elasticsearch6:
  237. runs-on: ubuntu-latest
  238. strategy:
  239. matrix:
  240. include:
  241. - python: '3.7'
  242. django: 'Django>=3.2,<3.3'
  243. services:
  244. postgres:
  245. image: postgres:10.8
  246. ports:
  247. - 5432:5432
  248. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  249. steps:
  250. - name: Configure sysctl limits
  251. run: |
  252. sudo swapoff -a
  253. sudo sysctl -w vm.swappiness=1
  254. sudo sysctl -w fs.file-max=262144
  255. sudo sysctl -w vm.max_map_count=262144
  256. - uses: elastic/elastic-github-actions/elasticsearch@master
  257. with:
  258. stack-version: 6.8.13
  259. - uses: actions/checkout@v3
  260. - name: Set up Python ${{ matrix.python }}
  261. uses: actions/setup-python@v3
  262. with:
  263. python-version: ${{ matrix.python }}
  264. - name: Install dependencies
  265. run: |
  266. python -m pip install --upgrade pip
  267. pip install "psycopg2>=2.6"
  268. pip install -e .[testing]
  269. pip install "${{ matrix.django }}"
  270. pip install "elasticsearch>=6,<7"
  271. pip install certifi
  272. - name: Test
  273. run: |
  274. ./runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch6
  275. env:
  276. DATABASE_ENGINE: django.db.backends.postgresql
  277. DATABASE_HOST: localhost
  278. DATABASE_USER: postgres
  279. DATABASE_PASSWORD: postgres
  280. USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
  281. test-postgres-elasticsearch7:
  282. runs-on: ubuntu-latest
  283. continue-on-error: ${{ matrix.experimental }}
  284. strategy:
  285. matrix:
  286. include:
  287. - python: '3.8'
  288. django: 'Django>=4.0,<4.1'
  289. experimental: false
  290. services:
  291. postgres:
  292. image: postgres:10.8
  293. ports:
  294. - 5432:5432
  295. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  296. steps:
  297. - name: Configure sysctl limits
  298. run: |
  299. sudo swapoff -a
  300. sudo sysctl -w vm.swappiness=1
  301. sudo sysctl -w fs.file-max=262144
  302. sudo sysctl -w vm.max_map_count=262144
  303. - uses: elastic/elastic-github-actions/elasticsearch@master
  304. with:
  305. stack-version: 7.6.1
  306. - uses: actions/checkout@v3
  307. - name: Set up Python ${{ matrix.python }}
  308. uses: actions/setup-python@v3
  309. with:
  310. python-version: ${{ matrix.python }}
  311. - name: Install dependencies
  312. run: |
  313. python -m pip install --upgrade pip
  314. pip install "psycopg2>=2.6"
  315. pip install -e .[testing]
  316. pip install "${{ matrix.django }}"
  317. pip install "elasticsearch>=7,<8"
  318. pip install certifi
  319. - name: Test
  320. run: |
  321. ./runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch7
  322. env:
  323. DATABASE_ENGINE: django.db.backends.postgresql
  324. DATABASE_HOST: localhost
  325. DATABASE_USER: postgres
  326. DATABASE_PASSWORD: postgres
  327. USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}