Skip to content

Commit

Permalink
Update GH actions / linting configuration (#158)
Browse files Browse the repository at this point in the history
* Update GH actions / linting configuration
  • Loading branch information
yakky committed May 8, 2023
1 parent 1202e0c commit 47112c0
Show file tree
Hide file tree
Showing 29 changed files with 207 additions and 155 deletions.
25 changes: 25 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[bumpversion]
current_version = 1.1.1.dev0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
tag = False
sign_tags = True
tag_name = {new_version}
message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
dev
a
b
rc
gamma

[bumpversion:part:relver]
first_value = 1

[bumpversion:file:djangocms_page_meta/__init__.py]
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '37 3 * * 3'

jobs:
analyze:
name: Analyze
runs-on: 'ubuntu-latest'
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# 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
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
7 changes: 4 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
python-version: [3.10.x]
toxenv: [pep8, isort, black, pypi-description, docs, towncrier]
python-version: ["3.11.x"]
toxenv: [ruff, isort, black, pypi-description, docs, towncrier]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -35,7 +35,8 @@ jobs:
${{ runner.os }}-lint-${{ matrix.toxenv }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox>3.23
python -m pip install --upgrade pip setuptools tox>4
- name: Test with tox
if: ${{ matrix.toxenv != 'towncrier' || (!contains(github.event.head_commit.message, '[pre-commit.ci]') && !contains(github.event.pull_request.body, 'pre-commit.ci start')) }}
run: |
tox -e${{ matrix.toxenv }}
11 changes: 11 additions & 0 deletions .github/workflows/logger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Event Logger
on: push

jobs:
log-github-event-goodies:
name: "LOG Everything on GitHub Event"
runs-on: ubuntu-latest
steps:
- name: Logging
run: |
echo '${{toJSON(github.event)}}'
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
${{ runner.os }}-tox-release-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox>3.23
python -m pip install --upgrade pip setuptools tox>4
- name: Build and publish
env:
TWINE_USERNAME: __token__
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ jobs:
test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.continue-on-error }}
strategy:
matrix:
python-version: [3.10.x, 3.9, 3.8, 3.7]
django: [32,22]
cms: [39,38,37]
python-version: ["3.11", "3.10", "3.9"]
django: [42, 41, 32]
cms: [311, 39]
continue-on-error: [true]
exclude:
- django: 32
cms: 37
- django: 32
cms: 38
- django: 41
cms: 39
- django: 42
cms: 39
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -39,7 +41,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get install gettext
python -m pip install --upgrade pip tox>3.23
python -m pip install --upgrade pip setuptools tox>4
- name: Test with tox
env:
TOX_ENV: ${{ format('py-django{1}-cms{2}', matrix.python-version, matrix.django, matrix.cms) }}
Expand All @@ -56,8 +58,3 @@ jobs:
flags: unittests
files: ./coverage.xml
fail_ci_if_error: false
services:
redis:
image: redis
ports:
- 6379:6379
37 changes: 12 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: "(.idea|node_modules|.tox)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: "setup.cfg"
Expand All @@ -18,41 +18,28 @@ repos:
args:
- --remove
- repo: https://github.com/PyCQA/isort
rev: "5.10.1"
rev: "5.12.0"
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.262'
hooks:
- id: flake8
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-builtins
- flake8-coding
- flake8-commas
- flake8-comprehensions
- flake8-eradicate
- flake8-quotes
- flake8-tidy-imports
- pep8-naming
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
args:
- "-cpyproject.toml"
- "--quiet"
- id: ruff
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.3.2
hooks:
- id: pyupgrade
args:
- --py3-plus
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.13.0"
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: local
hooks:
- id: towncrier
Expand Down
7 changes: 7 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
update: all
pin: False
branch:
schedule: "every day"
search: True
branch_prefix: pyup/
close_prs: True
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py
fail_on_warning: false
Expand All @@ -9,7 +14,6 @@ formats:
- pdf

python:
version: 3.7
install:
- requirements: requirements-test.txt
- method: pip
Expand Down
1 change: 1 addition & 0 deletions changes/157.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update GH actions / linting configuration
2 changes: 0 additions & 2 deletions djangocms_page_meta/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
__version__ = "1.1.1.dev0"
__author__ = "Iacopo Spalletti <i.spalletti@nephila.digital>"

default_app_config = "djangocms_page_meta.apps.PageMetaConfig"
8 changes: 2 additions & 6 deletions djangocms_page_meta/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class GenericAttributeTitleInline(admin.TabularInline):
extra = 1


@admin.register(PageMeta)
class PageMetaAdmin(PageExtensionAdmin):
raw_id_fields = ("og_author",)
inlines = (GenericAttributePageInline,)
Expand Down Expand Up @@ -53,9 +54,7 @@ def get_model_perms(self, request):
return {}


admin.site.register(PageMeta, PageMetaAdmin)


@admin.register(TitleMeta)
class TitleMetaAdmin(TitleExtensionAdmin):
form = TitleMetaAdminForm
inlines = (GenericAttributeTitleInline,)
Expand All @@ -70,9 +69,6 @@ def get_model_perms(self, request):
return {}


admin.site.register(TitleMeta, TitleMetaAdmin)


# Monkey patch the PageAdmin with a new get_form method
_BASE_PAGEADMIN__GET_FORM = PageAdmin.get_form

Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("cms", "0003_auto_20140926_2347"),
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0002_auto_20150807_0936.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0003_auto_20151220_1734.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0002_auto_20150807_0936"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0004_auto_20160409_1852.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0003_auto_20151220_1734"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0005_pagemeta_fb_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0004_auto_20160409_1852"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0006_auto_20160423_1859.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0005_pagemeta_fb_pages"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0007_auto_20160530_2257.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0006_auto_20160423_1859"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0008_auto_20160609_0754.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0007_auto_20160530_2257"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0009_auto_20171230_1954.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0008_auto_20160609_0754"),
]
Expand Down
1 change: 0 additions & 1 deletion djangocms_page_meta/migrations/0010_auto_20180108_2316.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djangocms_page_meta", "0009_auto_20171230_1954"),
]
Expand Down
Loading

0 comments on commit 47112c0

Please sign in to comment.