Skip to content

Commit 47112c0

Browse files
authored
Update GH actions / linting configuration (#158)
* Update GH actions / linting configuration
1 parent 1202e0c commit 47112c0

29 files changed

+207
-155
lines changed

.bumpversion.cfg

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[bumpversion]
2+
current_version = 1.1.1.dev0
3+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
4+
serialize =
5+
{major}.{minor}.{patch}.{release}{relver}
6+
{major}.{minor}.{patch}
7+
commit = True
8+
tag = False
9+
sign_tags = True
10+
tag_name = {new_version}
11+
message = Release {new_version}
12+
13+
[bumpversion:part:release]
14+
optional_value = gamma
15+
values =
16+
dev
17+
a
18+
b
19+
rc
20+
gamma
21+
22+
[bumpversion:part:relver]
23+
first_value = 1
24+
25+
[bumpversion:file:djangocms_page_meta/__init__.py]

.github/workflows/codeql.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "master" ]
20+
schedule:
21+
- cron: '37 3 * * 3'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: 'ubuntu-latest'
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Use only 'java' to analyze code written in Java, Kotlin or both
38+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v3
44+
45+
# Initializes the CodeQL tools for scanning.
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v2
48+
with:
49+
languages: ${{ matrix.language }}
50+
# If you wish to specify custom queries, you can do so here or in a config file.
51+
# By default, queries listed here will override any specified in a config file.
52+
# Prefix the list here with "+" to use these queries and those in the config file.
53+
54+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55+
# queries: security-extended,security-and-quality
56+
57+
58+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59+
# If this step fails, then you should remove it and run the build manually (see below)
60+
- name: Autobuild
61+
uses: github/codeql-action/autobuild@v2
62+
63+
# ℹ️ Command-line programs to run using the OS shell.
64+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65+
66+
# If the Autobuild fails above, remove it and uncomment the following three lines.
67+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68+
69+
# - run: |
70+
# echo "Run, Build Application using script"
71+
# ./location_of_script_within_repo/buildscript.sh
72+
73+
- name: Perform CodeQL Analysis
74+
uses: github/codeql-action/analyze@v2
75+
with:
76+
category: "/language:${{matrix.language}}"

.github/workflows/lint.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
if: "!contains(github.event.head_commit.message, '[skip ci]')"
99
strategy:
1010
matrix:
11-
python-version: [3.10.x]
12-
toxenv: [pep8, isort, black, pypi-description, docs, towncrier]
11+
python-version: ["3.11.x"]
12+
toxenv: [ruff, isort, black, pypi-description, docs, towncrier]
1313
steps:
1414
- uses: actions/checkout@v3
1515
with:
@@ -35,7 +35,8 @@ jobs:
3535
${{ runner.os }}-lint-${{ matrix.toxenv }}-
3636
- name: Install dependencies
3737
run: |
38-
python -m pip install --upgrade pip setuptools tox>3.23
38+
python -m pip install --upgrade pip setuptools tox>4
3939
- name: Test with tox
40+
if: ${{ matrix.toxenv != 'towncrier' || (!contains(github.event.head_commit.message, '[pre-commit.ci]') && !contains(github.event.pull_request.body, 'pre-commit.ci start')) }}
4041
run: |
4142
tox -e${{ matrix.toxenv }}

.github/workflows/logger.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Event Logger
2+
on: push
3+
4+
jobs:
5+
log-github-event-goodies:
6+
name: "LOG Everything on GitHub Event"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Logging
10+
run: |
11+
echo '${{toJSON(github.event)}}'

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
${{ runner.os }}-tox-release-
3030
- name: Install dependencies
3131
run: |
32-
python -m pip install --upgrade pip setuptools tox>3.23
32+
python -m pip install --upgrade pip setuptools tox>4
3333
- name: Build and publish
3434
env:
3535
TWINE_USERNAME: __token__

.github/workflows/test.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ jobs:
66
test:
77
if: "!contains(github.event.head_commit.message, '[skip ci]')"
88
runs-on: ubuntu-latest
9+
continue-on-error: ${{ matrix.continue-on-error }}
910
strategy:
1011
matrix:
11-
python-version: [3.10.x, 3.9, 3.8, 3.7]
12-
django: [32,22]
13-
cms: [39,38,37]
12+
python-version: ["3.11", "3.10", "3.9"]
13+
django: [42, 41, 32]
14+
cms: [311, 39]
15+
continue-on-error: [true]
1416
exclude:
15-
- django: 32
16-
cms: 37
17-
- django: 32
18-
cms: 38
17+
- django: 41
18+
cms: 39
19+
- django: 42
20+
cms: 39
1921
steps:
2022
- uses: actions/checkout@v3
2123
- name: Set up Python ${{ matrix.python-version }}
@@ -39,7 +41,7 @@ jobs:
3941
- name: Install dependencies
4042
run: |
4143
sudo apt-get install gettext
42-
python -m pip install --upgrade pip tox>3.23
44+
python -m pip install --upgrade pip setuptools tox>4
4345
- name: Test with tox
4446
env:
4547
TOX_ENV: ${{ format('py-django{1}-cms{2}', matrix.python-version, matrix.django, matrix.cms) }}
@@ -56,8 +58,3 @@ jobs:
5658
flags: unittests
5759
files: ./coverage.xml
5860
fail_ci_if_error: false
59-
services:
60-
redis:
61-
image: redis
62-
ports:
63-
- 6379:6379

.pre-commit-config.yaml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exclude: "(.idea|node_modules|.tox)"
44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.3.0
6+
rev: v4.4.0
77
hooks:
88
- id: trailing-whitespace
99
exclude: "setup.cfg"
@@ -18,41 +18,28 @@ repos:
1818
args:
1919
- --remove
2020
- repo: https://github.com/PyCQA/isort
21-
rev: "5.10.1"
21+
rev: "5.12.0"
2222
hooks:
2323
- id: isort
2424
- repo: https://github.com/psf/black
25-
rev: 22.6.0
25+
rev: 23.3.0
2626
hooks:
2727
- id: black
28-
- repo: https://github.com/PyCQA/flake8
29-
rev: 5.0.4
28+
- repo: https://github.com/charliermarsh/ruff-pre-commit
29+
rev: 'v0.0.262'
3030
hooks:
31-
- id: flake8
32-
additional_dependencies:
33-
- flake8-broken-line
34-
- flake8-bugbear
35-
- flake8-builtins
36-
- flake8-coding
37-
- flake8-commas
38-
- flake8-comprehensions
39-
- flake8-eradicate
40-
- flake8-quotes
41-
- flake8-tidy-imports
42-
- pep8-naming
43-
- repo: https://github.com/econchick/interrogate
44-
rev: 1.5.0
45-
hooks:
46-
- id: interrogate
47-
args:
48-
- "-cpyproject.toml"
49-
- "--quiet"
31+
- id: ruff
5032
- repo: https://github.com/asottile/pyupgrade
51-
rev: v2.37.3
33+
rev: v3.3.2
5234
hooks:
5335
- id: pyupgrade
5436
args:
5537
- --py3-plus
38+
- repo: https://github.com/adamchainz/django-upgrade
39+
rev: "1.13.0"
40+
hooks:
41+
- id: django-upgrade
42+
args: [--target-version, "3.2"]
5643
- repo: local
5744
hooks:
5845
- id: towncrier

.pyup.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
update: all
2+
pin: False
3+
branch:
4+
schedule: "every day"
5+
search: True
6+
branch_prefix: pyup/
7+
close_prs: True

.readthedocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
version: 2
22

3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.10"
7+
38
sphinx:
49
configuration: docs/conf.py
510
fail_on_warning: false
@@ -9,7 +14,6 @@ formats:
914
- pdf
1015

1116
python:
12-
version: 3.7
1317
install:
1418
- requirements: requirements-test.txt
1519
- method: pip

changes/157.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update GH actions / linting configuration

djangocms_page_meta/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
__version__ = "1.1.1.dev0"
22
__author__ = "Iacopo Spalletti <i.spalletti@nephila.digital>"
3-
4-
default_app_config = "djangocms_page_meta.apps.PageMetaConfig"

djangocms_page_meta/admin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GenericAttributeTitleInline(admin.TabularInline):
2323
extra = 1
2424

2525

26+
@admin.register(PageMeta)
2627
class PageMetaAdmin(PageExtensionAdmin):
2728
raw_id_fields = ("og_author",)
2829
inlines = (GenericAttributePageInline,)
@@ -53,9 +54,7 @@ def get_model_perms(self, request):
5354
return {}
5455

5556

56-
admin.site.register(PageMeta, PageMetaAdmin)
57-
58-
57+
@admin.register(TitleMeta)
5958
class TitleMetaAdmin(TitleExtensionAdmin):
6059
form = TitleMetaAdminForm
6160
inlines = (GenericAttributeTitleInline,)
@@ -70,9 +69,6 @@ def get_model_perms(self, request):
7069
return {}
7170

7271

73-
admin.site.register(TitleMeta, TitleMetaAdmin)
74-
75-
7672
# Monkey patch the PageAdmin with a new get_form method
7773
_BASE_PAGEADMIN__GET_FORM = PageAdmin.get_form
7874

djangocms_page_meta/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
109
("cms", "0003_auto_20140926_2347"),

djangocms_page_meta/migrations/0002_auto_20150807_0936.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class Migration(migrations.Migration):
5-
65
dependencies = [
76
("djangocms_page_meta", "0001_initial"),
87
]

djangocms_page_meta/migrations/0003_auto_20151220_1734.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class Migration(migrations.Migration):
5-
65
dependencies = [
76
("djangocms_page_meta", "0002_auto_20150807_0936"),
87
]

djangocms_page_meta/migrations/0004_auto_20160409_1852.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class Migration(migrations.Migration):
8-
98
dependencies = [
109
("djangocms_page_meta", "0003_auto_20151220_1734"),
1110
]

djangocms_page_meta/migrations/0005_pagemeta_fb_pages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("djangocms_page_meta", "0004_auto_20160409_1852"),
109
]

djangocms_page_meta/migrations/0006_auto_20160423_1859.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class Migration(migrations.Migration):
5-
65
dependencies = [
76
("djangocms_page_meta", "0005_pagemeta_fb_pages"),
87
]

djangocms_page_meta/migrations/0007_auto_20160530_2257.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("djangocms_page_meta", "0006_auto_20160423_1859"),
109
]

djangocms_page_meta/migrations/0008_auto_20160609_0754.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("djangocms_page_meta", "0007_auto_20160530_2257"),
109
]

djangocms_page_meta/migrations/0009_auto_20171230_1954.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("djangocms_page_meta", "0008_auto_20160609_0754"),
109
]

djangocms_page_meta/migrations/0010_auto_20180108_2316.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class Migration(migrations.Migration):
7-
87
dependencies = [
98
("djangocms_page_meta", "0009_auto_20171230_1954"),
109
]

0 commit comments

Comments
 (0)