Skip to content

Commit 5ccbf3e

Browse files
authored
feat: django 4.2 support (#59)
* ci: Update workflows * ci: Remove old test requirements * ci: Add pre-commit * ci: Generate new test requirements * chore: Ruff fixes * ci: Update tox * ci: Add ruff conf * build: Remove manifest exclude * build: Update classifiers and bump to 3.0.1
1 parent be56191 commit 5ccbf3e

33 files changed

+1548
-173
lines changed

.github/workflows/codecov.yml

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,80 @@
11
name: CodeCov
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
concurrency:
6-
group: ${{ github.workflow }}-${{ github.ref }}
10+
group: ${{ github.head_ref || github.run_id }}
711
cancel-in-progress: true
812

913
jobs:
10-
coverage:
11-
runs-on: ${{ matrix.os }}
14+
tests:
15+
name: ${{ matrix.database }} Python ${{ matrix.python-version }}
16+
runs-on: ubuntu-22.04
17+
1218
strategy:
1319
fail-fast: false
1420
matrix:
15-
python-version: [ 3.7, 3.8, 3.9, "3.10",] # latest release minus two
16-
requirements-file: [
17-
dj22_cms38.txt,
18-
dj32_cms38.txt,
19-
dj32_cms39.txt,
20-
dj32_cms310.txt,
21-
dj32_cms311.txt,
22-
dj40_cms311.txt,
23-
]
24-
os: [
25-
ubuntu-20.04,
26-
]
27-
exclude:
28-
- python-version: 3.7
29-
requirements-file: dj40_cms311.txt
21+
python-version:
22+
- 3.8
23+
- 3.9
24+
- '3.10'
25+
- '3.11'
26+
3027
steps:
31-
- uses: actions/checkout@v2
32-
with:
33-
fetch-depth: '2'
28+
- uses: actions/checkout@v3
3429

35-
- name: Setup Python
36-
uses: actions/setup-python@master
30+
- uses: actions/setup-python@v4
3731
with:
3832
python-version: ${{ matrix.python-version }}
39-
- name: Generate Report
33+
allow-prereleases: true
34+
cache: pip
35+
cache-dependency-path: 'requirements/*.txt'
36+
37+
- name: Install dependencies
4038
run: |
41-
pip install -r tests/requirements/${{ matrix.requirements-file }}
42-
coverage run setup.py test
43-
- name: Upload Coverage to Codecov
44-
uses: codecov/codecov-action@v1
39+
python -m pip install --upgrade pip setuptools wheel
40+
python -m pip install --upgrade 'tox>=4.0.0rc3'
41+
42+
- name: Run tox targets for ${{ matrix.python-version }}
43+
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
44+
45+
- name: Upload coverage data
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: coverage-data
49+
path: '.coverage*'
50+
51+
coverage:
52+
name: Coverage
53+
runs-on: ubuntu-22.04
54+
needs: tests
55+
steps:
56+
- uses: actions/checkout@v3
57+
58+
- uses: actions/setup-python@v4
59+
with:
60+
python-version: '3.11'
61+
62+
- name: Install dependencies
63+
run: python -m pip install --upgrade coverage[toml]
64+
65+
- name: Download data
66+
uses: actions/download-artifact@v3
67+
with:
68+
name: coverage-data
69+
70+
- name: Combine coverage and fail if it's <100%
71+
run: |
72+
python -m coverage html --skip-covered --skip-empty
73+
python -m coverage report --fail-under=100
74+
75+
- name: Upload HTML report
76+
if: ${{ failure() }}
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: html-report
80+
path: htmlcov

.github/workflows/lint.yml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,21 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
flake8:
11-
name: flake8
10+
ruff:
11+
name: ruff
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v3
1616
- name: Set up Python
17-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v4
1818
with:
19-
python-version: 3.9
20-
- name: Install flate8
21-
run: pip install --upgrade flake8
22-
- name: Run flake8
23-
uses: liskin/gh-problem-matcher-wrap@v1
24-
with:
25-
linters: flake8
26-
run: flake8
27-
28-
isort:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- name: Checkout
32-
uses: actions/checkout@v3
33-
- name: Set up Python
34-
uses: actions/setup-python@v3
35-
with:
36-
python-version: 3.9
37-
- run: python -m pip install isort
38-
- name: isort
39-
uses: liskin/gh-problem-matcher-wrap@v1
40-
with:
41-
linters: isort
42-
run: isort -c --df djangocms_file
43-
19+
python-version: '3.11'
20+
allow-prereleases: true
21+
cache: pip
22+
- run: |
23+
python -m pip install --upgrade pip
24+
pip install ruff
25+
- name: Run Ruff
26+
run: |
27+
ruff djangocms_file

.github/workflows/publish-to-live-pypi.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ jobs:
99
build-n-publish:
1010
name: Build and publish Python 🐍 distributions 📦 to pypi
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/djangocms-file
15+
permissions:
16+
id-token: write
1217
steps:
1318
- uses: actions/checkout@v3
1419
- name: Set up Python 3.10
15-
uses: actions/setup-python@v3
20+
uses: actions/setup-python@v4
1621
with:
1722
python-version: '3.10'
1823

@@ -34,6 +39,3 @@ jobs:
3439
- name: Publish distribution 📦 to PyPI
3540
if: startsWith(github.ref, 'refs/tags')
3641
uses: pypa/gh-action-pypi-publish@release/v1
37-
with:
38-
user: __token__
39-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/publish-to-test-pypi.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ jobs:
99
build-n-publish:
1010
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: test
14+
url: https://test.pypi.org/p/djangocms-file
15+
permissions:
16+
id-token: write
1217
steps:
1318
- uses: actions/checkout@v3
1419
- name: Set up Python 3.10
15-
uses: actions/setup-python@v3
20+
uses: actions/setup-python@v4
1621
with:
1722
python-version: '3.10'
1823

@@ -34,7 +39,5 @@ jobs:
3439
- name: Publish distribution 📦 to Test PyPI
3540
uses: pypa/gh-action-pypi-publish@release/v1
3641
with:
37-
user: __token__
38-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
39-
repository_url: https://test.pypi.org/legacy/
40-
skip_existing: true
42+
repository-url: https://test.pypi.org/legacy/
43+
skip-existing: true

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ci:
2+
autofix_commit_msg: |
3+
ci: auto fixes from pre-commit hooks
4+
5+
for more information, see https://pre-commit.ci
6+
autofix_prs: false
7+
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
8+
autoupdate_schedule: monthly
9+
10+
repos:
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.7.0
13+
hooks:
14+
- id: pyupgrade
15+
args: ["--py37-plus"]
16+
17+
- repo: https://github.com/adamchainz/django-upgrade
18+
rev: '1.14.0'
19+
hooks:
20+
- id: django-upgrade
21+
args: [--target-version, "3.2"]
22+
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: v0.0.275
25+
hooks:
26+
- id: ruff
27+
args: [--fix, --exit-non-zero-on-fix]
28+
29+
- repo: https://github.com/asottile/yesqa
30+
rev: v1.5.0
31+
hooks:
32+
- id: yesqa
33+
34+
- repo: https://github.com/pre-commit/pre-commit-hooks
35+
rev: v4.4.0
36+
hooks:
37+
- id: check-merge-conflict
38+
- id: debug-statements
39+
- id: mixed-line-ending
40+
- id: trailing-whitespace
41+
42+
- repo: https://github.com/codespell-project/codespell
43+
rev: v2.2.5
44+
hooks:
45+
- id: codespell

CHANGELOG.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Changelog
33
=========
44

5-
unpublished
6-
===========
75

8-
* Added support for Django 3.2, Django 4.0
9-
* Added github actions
6+
3.0.1 (2023-07-03)
7+
==================
8+
9+
* Added support for Django 4.2
1010
* Fixed search_field to point to file_name
1111

1212

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ include LICENSE
22
include README.rst
33
recursive-include djangocms_file/locale *
44
recursive-include djangocms_file/templates *
5-
recursive-exclude * *.py[co]

djangocms_file/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.0'
1+
__version__ = '3.0.1'

djangocms_file/cms_plugins.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from django.utils.translation import gettext_lazy as _
2-
31
from cms.plugin_base import CMSPluginBase
42
from cms.plugin_pool import plugin_pool
3+
from django.utils.translation import gettext_lazy as _
54

65
from .models import File, Folder
76

djangocms_file/models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
Enables the user to add a "File" plugin that displays a file wrapped by
33
an <anchor> tag.
44
"""
5+
from cms.models import CMSPlugin
56
from django.conf import settings
67
from django.db import models
78
from django.utils.translation import gettext
89
from django.utils.translation import gettext_lazy as _
9-
10-
from cms.models import CMSPlugin
11-
1210
from djangocms_attributes_field.fields import AttributesField
1311
from filer.fields.file import FilerFileField
1412
from filer.fields.folder import FilerFolderField
1513

16-
1714
LINK_TARGET = (
1815
('_self', _('Open in same window')),
1916
('_blank', _('Open in new window')),

0 commit comments

Comments
 (0)