Skip to content

Maintenance update: switch to pyproject.toml, format with black, add back coverage report, Wagtail 6.2 #82

Maintenance update: switch to pyproject.toml, format with black, add back coverage report, Wagtail 6.2

Maintenance update: switch to pyproject.toml, format with black, add back coverage report, Wagtail 6.2 #82

Workflow file for this run

name: Test & Lint
on:
push:
branches:
- main
pull_request:
workflow_call: # Allow for the publish workflows to run the tests by calling this workflow
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install .[test]
- name: Run linting
run: |
make format
test:
name: Python ${{ matrix.python}} ${{ matrix.toxenv }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
experimental: [false]
toxenv: ["py"]
include:
# Future Wagtail release from main branch (allowed to fail)
- python: "3.13"
toxenv: wagtailmain
experimental: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install tox tox-py coverage
# This step runs only for jobs NOT in the include matrix
- name: Run tox targets for Python ${{ matrix.python }}
if: ${{ matrix.toxenv == 'py' }}
run: |
tox --py current
# This step runs only for jobs in the include matrix
- name: Run tox targets for Python ${{ matrix.python }} (${{ matrix.toxenv }})
if: ${{ matrix.toxenv != 'py' }}
run: |
tox -e ${{ matrix.toxenv }}
env:
TOXENV: ${{ matrix.toxenv }}
- name: Generate coverage report
run: |
coverage combine
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: unittests
fail_ci_if_error: true