Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/feature/12089-dashb…
Browse files Browse the repository at this point in the history
…oard-enhancements' into feature/12089-dashboard-enhancements
  • Loading branch information
albinazs committed Sep 17, 2024
2 parents 0530aeb + b6a1e1b commit b651523
Show file tree
Hide file tree
Showing 300 changed files with 8,947 additions and 4,631 deletions.
17 changes: 10 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
steps:
- checkout
- restore_cache:
key: pipenv-v1-{{ checksum "setup.py" }}
key: pipenv-v2-{{ checksum "setup.py" }}
# Only install if .venv wasn’t cached.
- run: |
if [[ ! -e ".venv" ]]; then
pipenv install -e .[testing,docs]
fi
- save_cache:
key: pipenv-v1-{{ checksum "setup.py" }}
key: pipenv-v2-{{ checksum "setup.py" }}
paths:
- .venv
- run: pipenv run ruff check .
Expand All @@ -29,7 +29,7 @@ jobs:
name: Run tests
command: |
export PYTHONUNBUFFERED=1
pipenv run python -u runtests.py --parallel=2
WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT=1 pipenv run python -u runtests.py --parallel=2
frontend:
docker:
Expand Down Expand Up @@ -72,27 +72,30 @@ jobs:
- attach_workspace:
at: ~/project
- restore_cache:
key: pipenv-v1-{{ checksum "setup.py" }}
key: pipenv-v2-{{ checksum "setup.py" }}
# Only install if .venv wasn’t cached.
- run: |
if [[ ! -e ".venv" ]]; then
pipenv install -e .[testing]
fi
- save_cache:
key: pipenv-v1-{{ checksum "setup.py" }}
key: pipenv-v2-{{ checksum "setup.py" }}
paths:
- .venv
- restore_cache:
key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
key: ui_tests-npm_integration-v2-{{ checksum "client/tests/integration/package-lock.json" }}
# Only install if node_modules wasn’t cached.
- run: |
if [[ ! -e "client/tests/integration/node_modules" ]]; then
npm --prefix ./client/tests/integration ci
fi
- save_cache:
key: ui_tests-npm_integration-v1-{{ checksum "client/tests/integration/package-lock.json" }}
key: ui_tests-npm_integration-v2-{{ checksum "client/tests/integration/package-lock.json" }}
paths:
- client/tests/integration/node_modules
# Also cache the global location where Puppeteer stores browsers.
# https://pptr.dev/guides/configuration/#changing-the-default-cache-directory
- ~/.cache/puppeteer
- run: pipenv run ./wagtail/test/manage.py migrate
- run:
command: pipenv run ./wagtail/test/manage.py runserver 0:8000
Expand Down
117 changes: 75 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@ concurrency:
cancel-in-progress: true

# Our test suite should cover:
# - all supported databases against current Python and Django
# - all supported databases against current Python and Django (including psycopg v2 and v3)
# - at least one test run for each older supported version of Python and Django
# - at least one test run for each supported Elasticsearch version
# - a test run against Django's git main and active stable branch (allowing failures)
# - test runs with USE_EMAIL_USER_MODEL=yes and DISABLE_TIMEZONE=yes
# - test runs with USE_EMAIL_USER_MODEL=yes, DISABLE_TIMEZONE=yes and WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT=1

# Current configuration:
# - django 4.2, python 3.9, postgres:12, parallel
# - django 4.2, python 3.9, postgres:12, psycopg 2, parallel
# - django 4.2, python 3.10, mysql:8.0
# - django 5.0, python 3.11, sqlite
# - django 5.1, python 3.12, mysql:8.1, parallel
# - django 4.2, python 3.11, mariadb:10.5
# - django 5.0, python 3.11, sqlite, WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT=1
# - django 5.1, python 3.12, mysql:8.4, parallel, USE_EMAIL_USER_MODEL=yes
# - django 5.1, python 3.12, mariadb:11.4, USE_EMAIL_USER_MODEL=yes
# - django 5.1, python 3.12, sqlite, parallel, USE_EMAIL_USER_MODEL=yes
# - django 5.1, python 3.12, postgres:15, parallel, DISABLE_TIMEZONE=yes
# - django stable/5.1.x, python 3.11, postgres:15 (allow failures)
# - django main, python 3.12, postgres:latest, parallel (allow failures)
# - elasticsearch 7, django 4.2, python 3.9, postgres:latest
# - django 5.1, python 3.12, postgres:15, psycopg 3, parallel, DISABLE_TIMEZONE=yes
# - django stable/5.1.x, python 3.11, postgres:15, psycopg 3 (allow failures)
# - django main, python 3.12, postgres:latest, psycopg 3, parallel (allow failures)
# - elasticsearch 7, django 4.2, python 3.9, postgres:latest, psycopg 2
# - opensearch 2, django 5.0, python 3.10, sqlite
# - elasticsearch 8, django 5.1, python 3.12, sqlite, USE_EMAIL_USER_MODEL=yes

Expand All @@ -49,15 +51,16 @@ jobs:
include:
- python: '3.11'
django: 'Django>=5.0,<5.1'
check_template_number_format: '1'
- python: '3.12'
django: 'Django>=5.1,<5.2'
emailuser: emailuser
parallel: '--parallel'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
Expand All @@ -73,11 +76,13 @@ jobs:
env:
DATABASE_ENGINE: django.db.backends.sqlite3
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT: ${{ matrix.check_template_number_format }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

test-postgres:
runs-on: ubuntu-latest
Expand All @@ -87,20 +92,24 @@ jobs:
include:
- python: '3.9'
django: 'Django>=4.2,<4.3'
psycopg: 'psycopg2>=2.6'
experimental: false
parallel: '--parallel'
- python: '3.12'
django: 'Django>=5.0,<5.1'
psycopg: 'psycopg>=3.1.8'
postgres: 'postgres:15'
notz: notz
experimental: false
parallel: '--parallel'
- python: '3.11'
django: 'git+https://github.com/django/django.git@stable/5.1.x#egg=Django'
psycopg: 'psycopg>=3.1.8'
postgres: 'postgres:15'
experimental: true
- python: '3.12'
django: 'git+https://github.com/django/django.git@main#egg=Django'
psycopg: 'psycopg>=3.1.8'
experimental: true
postgres: 'postgres:latest'
parallel: '--parallel'
Expand All @@ -114,16 +123,16 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "psycopg2>=2.6"
pip install "${{ matrix.psycopg }}"
pip install -e '.[testing]' --config-settings editable_mode=strict
pip install "${{ matrix.django }}"
${{ matrix.install_extras }}
Expand All @@ -139,10 +148,11 @@ jobs:
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
DISABLE_TIMEZONE: ${{ matrix.notz }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

test-mysql:
runs-on: ubuntu-latest
Expand All @@ -153,25 +163,38 @@ jobs:
- python: '3.10'
django: 'Django>=4.2,<4.3'
experimental: false
- python: '3.11'
django: 'Django>=4.2,<4.3'
experimental: false
mysql: 'mariadb:10.5'
- python: '3.12'
django: 'Django>=5.1,<5.2'
experimental: false
mysql: 'mariadb:11.4'
emailuser: emailuser
- python: '3.12'
django: 'Django>=5.1,<5.2'
experimental: false
parallel: '--parallel'
mysql: 'mysql:8.1'
mysql: 'mysql:8.4'
emailuser: emailuser
services:
mysql:
image: ${{ matrix.mysql || 'mysql:8.0' }}
env:
MARIADB_ROOT_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: wagtail
HEALTH_CMD: ${{ startsWith(matrix.mysql, 'mariadb') && 'healthcheck.sh --connect --innodb_initialized' || 'mysqladmin --protocol=tcp ping' }}
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --cap-add=sys_nice
options: --health-cmd=$HEALTH_CMD --health-interval=10s --health-timeout=5s --health-retries=3 --cap-add=sys_nice

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
Expand All @@ -189,11 +212,15 @@ jobs:
DATABASE_ENGINE: django.db.backends.mysql
DATABASE_HOST: '127.0.0.1'
DATABASE_USER: root
DATABASE_PASSWORD: root
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
DISABLE_TIMEZONE: ${{ matrix.notz }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

test-sqlite-elasticsearch8:
runs-on: ubuntu-latest
Expand All @@ -210,17 +237,17 @@ jobs:
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: getong/elasticsearch-action@v1.2
- uses: getong/elasticsearch-action@v1.3
with:
elasticsearch version: 8.8.0
host port: 9200
container port: 9200
host node port: 9300
node port: 9300
discovery type: 'single-node'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
Expand All @@ -238,10 +265,11 @@ jobs:
DATABASE_ENGINE: django.db.backends.sqlite3
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

test-postgres-elasticsearch7:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -272,9 +300,9 @@ jobs:
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.6.1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
Expand All @@ -296,10 +324,11 @@ jobs:
DATABASE_PASSWORD: postgres
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

test-sqlite-opensearch2:
runs-on: ubuntu-latest
Expand All @@ -321,9 +350,9 @@ jobs:
- uses: ankane/setup-opensearch@v1
with:
opensearch-version: 2
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
Expand All @@ -341,10 +370,11 @@ jobs:
DATABASE_ENGINE: django.db.backends.sqlite3
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ github.job }}-${{ strategy.job-index }}
path: .coverage.*
include-hidden-files: true

coverage:
needs:
Expand All @@ -357,10 +387,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -370,9 +400,10 @@ jobs:
pip install coverage
- name: Download coverage data
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: coverage-data
pattern: coverage-data-*
merge-multiple: true

- name: Combine coverage data
run: |
Expand All @@ -384,12 +415,14 @@ jobs:
coverage html --skip-covered --skip-empty
- name: Upload HTML report as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage_html_report
include-hidden-files: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ npm-debug.log*
/.cache/
/.pytest_cache/
/storybook-static
/wagtail/tests/test-media/

### JetBrains
.idea/
Expand Down
3 changes: 3 additions & 0 deletions .semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ rules:
- metavariable-regex:
metavariable: $STRING_ID
regex: ".*%\\w.*"
paths:
exclude:
- 'wagtail/test/numberformat.py'
message: >
Do not use anonymous placeholders for translations.
Use printf style formatting with named placeholders instead.
Expand Down
Loading

0 comments on commit b651523

Please sign in to comment.