Skip to content

Commit

Permalink
Run tests in parallel in some of the GitHub Actions workflow setup
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage committed Aug 2, 2023
1 parent 6fed2c8 commit c9fd6b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- run: git ls-files '*.html' | xargs pipenv run djhtml --check
- run: pipenv run curlylint --parse-only wagtail
- run: pipenv run doc8 docs
- run: DATABASE_NAME=wagtail.db pipenv run python -u runtests.py
- run: pipenv run python -u runtests.py --parallel

frontend:
docker:
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,25 @@ concurrency:
# - test runs with USE_EMAIL_USER_MODEL=yes and DISABLE_TIMEZONE=yes

# Current configuration:
# - django 3.2, python 3.8, postgres
# - django 3.2, python 3.8, postgres, parallel
# - django 3.2, python 3.8, mysql
# - django 4.1, python 3.9, sqlite
# - django 4.2, python 3.10, mysql
# - django 4.1, python 3.10, postgres, USE_EMAIL_USER_MODEL=yes
# - django 4.2, python 3.11, postgres, DISABLE_TIMEZONE=yes
# - django 4.2, python 3.10, mysql, parallel
# - django 4.1, python 3.10, postgres, parallel, USE_EMAIL_USER_MODEL=yes
# - django 4.2, python 3.11, postgres, parallel, DISABLE_TIMEZONE=yes
# - django stable/4.2.x, python 3.10, postgres (allow failures)
# - django main, python 3.10, postgres (allow failures)
# - django main, python 3.10, postgres, parallel (allow failures)
# - elasticsearch 5, django 3.2, python 3.8, sqlite
# - elasticsearch 6, django 3.2, python 3.8, postgres
# - elasticsearch 7, django 4.1, python 3.8, postgres
# - elasticsearch 8, django 4.2, python 3.10, sqlite, USE_EMAIL_USER_MODEL=yes

# Some tests are run in parallel by passing --parallel to runtests.py.
# When running tests in parallel, some errors cannot be pickled and result in
# non-helpful tracebacks (see https://code.djangoproject.com/ticket/29023).
# Thus, we keep one test run without --parallel for each supported database.
# ElasticSearch tests are not run in parallel as the test suite is not thread-safe.

permissions:
contents: read # to fetch code (actions/checkout)

Expand Down Expand Up @@ -77,15 +83,18 @@ jobs:
- python: '3.8'
django: 'Django>=3.2,<3.3'
experimental: false
parallel: '--parallel'
- python: '3.11'
django: 'Django>=4.2,<4.3'
postgres: 'postgres:12'
notz: notz
experimental: false
parallel: '--parallel'
- python: '3.10'
django: 'Django>=4.1,<4.2'
experimental: false
emailuser: emailuser
parallel: '--parallel'
- python: '3.10'
django: 'git+https://github.com/django/django.git@stable/4.2.x#egg=Django'
experimental: true
Expand All @@ -94,6 +103,7 @@ jobs:
django: 'git+https://github.com/django/django.git@main#egg=Django'
experimental: true
postgres: 'postgres:12'
parallel: '--parallel'
install_extras: |
pip uninstall -y django-modelcluster
pip install \
Expand Down Expand Up @@ -124,7 +134,7 @@ jobs:
${{ matrix.install_extras }}
- name: Test
run: |
coverage run --parallel-mode --source wagtail runtests.py
coverage run --parallel-mode --source wagtail runtests.py ${{ matrix.parallel }}
env:
DATABASE_ENGINE: django.db.backends.postgresql
DATABASE_HOST: localhost
Expand All @@ -150,6 +160,7 @@ jobs:
- python: '3.10'
django: 'Django>=4.2,<4.3'
experimental: false
parallel: '--parallel'

services:
mysql:
Expand All @@ -176,7 +187,7 @@ jobs:
pip install "${{ matrix.django }}"
- name: Test
run: |
coverage run --parallel-mode --source wagtail runtests.py
coverage run --parallel-mode --source wagtail runtests.py ${{ matrix.parallel }}
env:
DATABASE_ENGINE: django.db.backends.mysql
DATABASE_HOST: '127.0.0.1'
Expand Down

0 comments on commit c9fd6b8

Please sign in to comment.