forked from django-cms/djangocms-picture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: django 4.2 support (django-cms#123)
* feat: Add migrations for Django 4.2 Using latest cms migration as a dependency. Co-authored-by: Vašek Chalupníček <[email protected]> Co-authored-by: Mark Walker <[email protected]> * build: update setup.py classifiers * test: add script to autogenerate requirements * test: rename base.txt into requirements.in and add some changes * test: delete old test requirements * test: autogenerate requirements * ci: add pyproject.toml * ci: Update tox.ini use ruff instead of flake8 and isort * ci: linting on push / pull_reqest now uses ruff instead of flake8 and isort * ci: add .pre-commit-config.yaml * ci: add lint-pr.yml * ci: update test.yml * fix: sort imports * docs: update CHANGELOG.rst * ci: relax coverage requirements down to 95% * ci: Update .pre-commit-config.yaml Python version on par with supported versions. Co-authored-by: Mark Walker <[email protected]> --------- Co-authored-by: Vašek Chalupníček <[email protected]> Co-authored-by: Mark Walker <[email protected]> Co-authored-by: Leonhard Küper <[email protected]>
- Loading branch information
Showing
33 changed files
with
4,732 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[run] | ||
parallel = True | ||
branch = True | ||
source = djangocms_picture | ||
omit = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Lint PR" | ||
|
||
# Validates PR titles against the conventional commit spec | ||
# https://github.com/commitizen/conventional-commit-types | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
conventional-commits: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
name: Lint | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
flake8: | ||
name: flake8 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install flake8 | ||
run: pip install --upgrade flake8 | ||
- name: Run flake8 | ||
uses: liskin/gh-problem-matcher-wrap@v1 | ||
with: | ||
linters: flake8 | ||
run: flake8 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
isort: | ||
jobs: | ||
ruff: | ||
name: ruff | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- run: python -m pip install isort | ||
- name: isort | ||
uses: liskin/gh-problem-matcher-wrap@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
linters: isort | ||
run: isort -c -rc -df djangocms_picture | ||
python-version: '3.11' | ||
allow-prereleases: true | ||
cache: pip | ||
- run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff | ||
- name: Run Ruff | ||
run: | | ||
ruff djangocms_picture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,81 @@ | ||
name: CodeCov | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ${{ matrix.os }} | ||
tests: | ||
name: ${{ matrix.database }} Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.8, 3.9, "3.10" ] | ||
requirements-file: [ | ||
dj22_cms38.txt, | ||
dj32_cms39.txt, | ||
# dj40_cms310.txt, | ||
] | ||
os: [ | ||
ubuntu-20.04, | ||
] | ||
python-version: | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- 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 -r tests/requirements/${{ matrix.requirements-file }} | ||
python setup.py install | ||
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*' | ||
|
||
coverage: | ||
name: Coverage | ||
runs-on: ubuntu-22.04 | ||
needs: 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: Run coverage | ||
run: coverage run setup.py test | ||
- name: Combine coverage and fail if it's <95% | ||
run: | | ||
python -m coverage combine | ||
python -m coverage html --skip-covered --skip-empty | ||
python -m coverage report --fail-under=95 | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
- name: Upload HTML report | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: html-report | ||
path: htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
ci: | ||
autofix_commit_msg: | | ||
ci: auto fixes from pre-commit hooks | ||
for more information, see https://pre-commit.ci | ||
autofix_prs: false | ||
autoupdate_commit_msg: 'ci: pre-commit autoupdate' | ||
autoupdate_schedule: monthly | ||
|
||
repos: | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.7.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py38-plus"] | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: '1.14.0' | ||
hooks: | ||
- id: django-upgrade | ||
args: [--target-version, "3.2"] | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.275 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
|
||
- repo: https://github.com/asottile/yesqa | ||
rev: v1.5.0 | ||
hooks: | ||
- id: yesqa | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.5 | ||
hooks: | ||
- id: codespell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
djangocms_picture/migrations/0012_alter_picture_cmsplugin_ptr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.1.8 on 2023-05-04 15:04 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cms', '__latest__' ), | ||
('djangocms_picture', '0011_auto_20190314_1536'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='picture', | ||
name='cmsplugin_ptr', | ||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tool.ruff] | ||
exclude = [ | ||
".env", | ||
".venv", | ||
"**/migrations/**", | ||
] | ||
ignore = [ | ||
"E501", # line too long | ||
"F403", # 'from module import *' used; unable to detect undefined names | ||
"E701", # multiple statements on one line (colon) | ||
"F401", # module imported but unused | ||
] | ||
line-length = 119 | ||
select = [ | ||
"I", | ||
"E", | ||
"F", | ||
"W", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.