Skip to content

Commit

Permalink
feat: Django 4.2 and python 3.12 (#105)
Browse files Browse the repository at this point in the history
* Add ruff and black to pre-commit. Drop flake8

* Add pip to dependabot.yml

* Add ruff config

* Run ruff

* Run ruff

* Run ruff

* Revamp requirements for tests

* Test via tox

* Minor changes

* Update linter workflow

* Update linter workflow

* Fix `needs`

* Fix tox

* Drop deprecation warning. Feed `allowed_styles` into `css_sanitizer`

* Update test requirements

* Remove warning checks from tests

* CI test against django main

* Drop combine

* Bump future to ubuntu-22.04

* Allow pre-release python

* Update coverage config

* Should fix coverage

* Should fix coverage

* Update changelog

* Update docs conf match

* Bump version: 3.0.1 → 3.1.0
  • Loading branch information
marksweb committed Aug 5, 2023
1 parent 06b30d0 commit 2730866
Show file tree
Hide file tree
Showing 48 changed files with 2,262 additions and 666 deletions.
14 changes: 0 additions & 14 deletions .coveragerc

This file was deleted.

8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ indent_style = space
indent_size = 4

[*.py]
max_line_length = 120
max_line_length = 80

[*.toml]
indent_size = 2

[*.yml]
indent_size = 2
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ updates:
include: "scope"
schedule:
interval: weekly
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
groups:
python-packages:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- run: python -m pip install sphinx
- name: Build docs
run: |
Expand Down
39 changes: 10 additions & 29 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,28 @@
name: Lint

on: [push, pull_request]
on: [ push, pull_request ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
flake8:
name: flake8
ruff:
name: ruff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.11"
cache: 'pip'
- name: Install flake8
run: pip install --upgrade flake8
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v2
with:
linters: flake8
run: flake8

isort:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- run: python -m pip install isort
- name: isort
uses: liskin/gh-problem-matcher-wrap@v2
with:
linters: isort
run: isort --check --diff django_bleach
- run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff django_bleach

codespell:
runs-on: ubuntu-latest
Expand All @@ -51,7 +32,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
cache: 'pip'
- run: python -m pip install codespell
- name: codespell
Expand Down
115 changes: 80 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,110 @@
name: Tests

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
unit-tests:
runs-on: ${{ matrix.os }}
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, 3.10.1]
django-version: [
'3.2',
'4.0',
'4.1',
]
os: [
ubuntu-20.04,
]
python-version:
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: 'requirements/*.txt'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install django==${{ matrix.django-version }} "bleach>=5,<6" coverage mock
python setup.py install
- name: Run coverage
run: |
coverage run --rcfile .coveragerc testproject/manage.py test --failfast django_bleach
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade 'tox>=4.0.0rc3'
- name: Run tox targets for ${{ matrix.python-version }}
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)

- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: '.coverage.*'

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
coverage:
name: Coverage
runs-on: ubuntu-22.04
needs: unit-tests
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: python -m pip install --upgrade coverage[toml]

- name: Download data
uses: actions/download-artifact@v3
with:
name: coverage-data

- name: Fail if coverage is <100%
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: html-report
path: htmlcov

pre-release:
runs-on: ${{ matrix.os }}
unit-tests-future-versions:
# Runs for all Django/Python versions which are not yet supported
runs-on: ubuntu-22.04
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [
ubuntu-20.04,
python-version: ['3.11', '3.12']
django-version: [
'https://github.com/django/django/archive/main.tar.gz'
]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9
allow-prereleases: true
cache: pip
cache-dependency-path: 'requirements/*.txt'
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --pre django "bleach>=5,<6" coverage mock
python setup.py install
- name: Run tests
run: |
python testproject/manage.py test django_bleach
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade 'tox>=4.0.0rc3'
- name: Run tox targets for ${{ matrix.python-version }}
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
14 changes: 8 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ repos:
- id: django-upgrade
args: [--target-version, "3.2"]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.278"
hooks:
- id: flake8
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
Expand All @@ -36,7 +37,8 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending

- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/ambv/black
rev: 23.7.0
hooks:
- id: isort
- id: black
name: Black
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ Change Log
This document records all notable changes to [django-bleach](https://github.com/marksweb/django-bleach).
This project adheres to [Semantic Versioning](https://semver.org/).

[unreleased](https://github.com/marksweb/django-bleach/compare/3.0.1...master) changes
[unreleased](https://github.com/marksweb/django-bleach/compare/3.1.0...master) changes
-------------------------------------------------------------------------------------

Version 3.1.0
=============
**05-08-2023**

* Added support for django 4.2
* Added support for python 3.12
* Revamp package for easier maintenance


Version 3.0.1
=============
**11-10-2022**
Expand Down
2 changes: 1 addition & 1 deletion django_bleach/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "3.0.1"
__version__ = "3.1.0"

VERSION = __version__.split(".")
Loading

0 comments on commit 2730866

Please sign in to comment.