Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add migrations for Django 4.2 #73

Merged
merged 15 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[run]
parallel = True
branch = True
source = djangocms_video
omit =
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/lint-pr.yml
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 }}
45 changes: 17 additions & 28 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,26 @@ name: Lint

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_video
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_video
92 changes: 67 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,39 +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.7, 3.8, 3.9, ] # latest release minus two
requirements-file: [
dj22_cms37.txt,
dj22_cms38.txt,
dj30_cms37.txt,
dj30_cms38.txt,
dj31_cms38.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/checkout@v3

uses: actions/setup-python@v2
- 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
- name: Run coverage
run: coverage run setup.py test

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
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: 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 HTML report
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: html-report
path: htmlcov
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
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
3 changes: 1 addition & 2 deletions djangocms_video/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.utils.translation import gettext_lazy as _

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _

from . import forms, models

Expand Down
1 change: 0 additions & 1 deletion djangocms_video/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from . import models


YOUTUBE_URL_RE = re.compile(r'(?:(?:http://|https://|//)?(?:www\.)?youtu\.?be.*).*')
# https://stackoverflow.com/a/9102270
YOUTUBE_VIDEO_ID_RE = re.compile(r'(?:[?&]v=|/embed/|/1/|/v/|https?://(?:www\.)?youtu\.be/)([^&\n?#]+)')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 4.2.4 on 2023-08-02 14:03

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('cms', '0022_auto_20180620_1551'),
('djangocms_video', '0010_videoplayer_parameters'),
]

operations = [
migrations.AlterField(
model_name='videoplayer',
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'),
),
migrations.AlterField(
model_name='videosource',
name='cmsplugin_ptr',
field=models.OneToOneField(auto_created=True, 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'),
),
migrations.AlterField(
model_name='videotrack',
name='cmsplugin_ptr',
field=models.OneToOneField(auto_created=True, 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'),
),
]
4 changes: 1 addition & 3 deletions djangocms_video/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
"""
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse

from cms.models import CMSPlugin
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _

from cms.models import CMSPlugin

from djangocms_attributes_field.fields import AttributesField
from filer.fields.file import FilerFileField
from filer.fields.image import FilerImageField
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
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",
]
19 changes: 11 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from djangocms_video import __version__


REQUIREMENTS = [
'django-cms>=3.7',
'django-filer>=1.7',
'djangocms-attributes-field>=1',
'django-treebeard>=4.3,<4.5',
]


Expand All @@ -20,17 +18,22 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Framework :: Django CMS',
'Framework :: Django CMS :: 3.7',
'Framework :: Django CMS :: 3.8',
'Framework :: Django CMS :: 3.9',
'Framework :: Django CMS :: 3.10',
'Framework :: Django CMS :: 3.11',
mogoh marked this conversation as resolved.
Show resolved Hide resolved
'Framework :: Django CMS :: 4.1',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
Expand Down
1 change: 0 additions & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from tempfile import mkdtemp

from django.core.files import File

from filer.models.filemodels import File as FilerFile
from filer.models.foldermodels import Folder as FilerFolder
from filer.models.imagemodels import Image as FilerImage
Expand Down
Loading