Skip to content

Commit

Permalink
Support/wagtail 63 (#149)
Browse files Browse the repository at this point in the history
* Adds Wagtail 6.3 to the test matrix.
  Also:
    - Removes Python 3.8 from the test matrix.
    - Adds Django 5.1 to the test matrix.
    - Updates the classifiers in `pyproject.toml` to include Django 5.1 and Wagtail 6.3.
    - Updates the `tox.ini` file to include Django 5.1 and Wagtail 6.3 in the test matrix.
* Update the CHANGELOG
* Add Python 3.13 to the mix
* Bump ruff to 0.8.2
* Fix coverage upload
* Harden GH checkout action
* Use the Python 3.12+ sys.monitoring for coverage

---------

Co-authored-by: nickmoreton <[email protected]>
  • Loading branch information
zerolab and nickmoreton authored Dec 6, 2024
1 parent 271baec commit 6884ab8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 34 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
TOX_TESTENV_PASSENV: FORCE_COLOR
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
PYTHON_LATEST: "3.12"
PYTHON_LATEST: "3.13"

jobs:
tests:
Expand All @@ -27,7 +27,7 @@ jobs:

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Harden Runner
Expand All @@ -37,10 +37,13 @@ jobs:
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
objects.githubusercontent.com:443
github.com:443
pypi.org:443
api.github.com:443
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -58,6 +61,7 @@ jobs:
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
if-no-files-found: ignore
retention-days: 1

Expand All @@ -73,10 +77,13 @@ jobs:
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
objects.githubusercontent.com:443
github.com:443
pypi.org:443
api.github.com:443
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
# Use latest Python, so it understands all syntax.
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/nightly-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install --upgrade pip tox
- name: Test
id: test
continue-on-error: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- run: python -Im pip install --user ruff

- name: Run ruff
working-directory: ./src
run: ruff --output-format=github wagtailmarkdown
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
# keep in sync with .pre-commit-config.yaml
run: python -Im pip install --user ruff==0.8.2
- name: Run Ruff
run: ruff check --output-format=github ./src/wagtailmarkdown
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ ci:
autoupdate_schedule: 'quarterly'

default_language_version:
python: python3.12
python: python3.13

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -20,7 +20,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.0'
rev: 'v0.8.2' # keep in sync with .github/workflows/ruff.yml
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

- Add tox testing for wagtail 6.2 and 6.3 and include Django 5.1
- Update the ruff github action which fixes the error seen in CI

## [0.12.1] - 2024-03-09

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ And render the content in a template:

## Compatibility

wagtail-markdown supports Wagtail 4.1 and above, python-markdown 3.3 and above.
wagtail-markdown supports Wagtail 5.2 and above, python-markdown 3.3 and above.

## Contributing

Expand Down Expand Up @@ -347,11 +347,11 @@ tox -p
To run tests for a specific environment:

```shell
tox -e py312-django5.0-wagtail6.0
tox -e py313-django5.1-wagtail6.3
```

or, a specific test

```shell
tox -e py312-django5.0-wagtail6.0 -- tests.testapp.tests.test_admin.TestFieldsAdmin
tox -e py313-django5.1-wagtail6.3 -- tests.testapp.tests.test_admin.TestFieldsAdmin
```
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ classifiers = [
"License :: OSI Approved :: zlib/libpng License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Wagtail",
"Framework :: Wagtail :: 5",
"Framework :: Wagtail :: 6",
]

dynamic = ["version"]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"Wagtail>=5.2",
"Markdown>=3.3,<4",
Expand Down
2 changes: 1 addition & 1 deletion src/wagtailmarkdown/mdx/linkers/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run(self, fname, options):
opts["classname"] = "full-width"
elif opt == "width":
with contextlib.suppress(ValueError):
opts["spec"] = "width-%d" % int(value)
opts["spec"] = f"width-{int(value)}"

try:
image = get_image_model().objects.get(title=fname)
Expand Down
24 changes: 14 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[tox]
min_version = 4.0
min_version = 4.22

envlist =
py{38,39,310}-django3.2-wagtail5.2
py{38,39,310,311}-django4.2-wagtail{5.2,6.0}
py{311,312}-django5.0-wagtail{5.2,6.0,main}
py{39,310,311}-dj42-wagtail{52,63}
py{310,311}-dj50-wagtail{52,62,63}
py{312,313}-dj51-wagtail63

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313

[testenv]
package = editable
Expand All @@ -24,23 +24,27 @@ setenv =
PYTHONPATH = {toxinidir}
DJANGO_SETTINGS_MODULE = tests.testapp.settings
PYTHONDEVMODE = 1
# use the Python 3.12+ sys.monitoring
py3.12: COVERAGE_CORE=sysmon
py3.13: COVERAGE_CORE=sysmon

extras = testing

deps =
django3.2: Django>=3.2,<4.0
django4.2: Django>=4.2,<5.0
django5.0: Django>=5.0,<5.1
django5.1: Django>=5.1,<5.2

wagtail5.2: wagtail>=5.2,<5.3
wagtail6.0: wagtail>=6.0,<6.1
wagtail6.2: wagtail>=6.2,<6.3
wagtail6.3: wagtail>=6.3,<6.4

install_command = python -m pip install -U {opts} {packages}
commands =
python -m coverage run {toxinidir}/tests/manage.py test {posargs: -v 2}

[testenv:coverage-report]
base_python = python3.12
base_python = python3.13
package = skip
deps =
coverage>=7.0,<8.0
Expand All @@ -50,14 +54,14 @@ commands =

[testenv:wagtailmain]
description = Test with latest Wagtail main branch
base_python = python3.12
base_python = python3.13
deps =
coverage>=7.0,<8.0
wagtailmain: git+https://github.com/wagtail/wagtail.git@main#egg=Wagtail

[testenv:interactive]
description = An interactive environment for local testing purposes
base_python = python3.12
base_python = python3.13

; Note: the following are commented out for development convenience,
; so as to test the interactive mode with a different Wagtail version
Expand Down

0 comments on commit 6884ab8

Please sign in to comment.