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

Develop to Main #54

Merged
merged 9 commits into from
Sep 15, 2024
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip"
directory: "/packages" # Location of the requirements.txt and requirements-dev.txt file
schedule:
interval: "weekly"

target-branch: "main"
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-20.04

strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage codecov pytest poetry
pip install -r packages/requirements-dev.txt

- name: Run tests with coverage
run: pytest --cov=django_notification --cov-report=xml

- name: Run Tox tests
run: tox

- name: Run pre-commit hooks
run: pre-commit run --all-files --config=.pre-commit-config-ci.yaml

- name: Upload coverage to Codecov
run: codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
name: Build and Release
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry

- name: Build package
run: |
poetry build

- name: Publish to PyPI
run: |
poetry publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ repos:

- repo: local
hooks:
- id: pytest
name: Pytest
entry: poetry run pytest -v
language: system
types: [ python ]
stages: [ commit ]
pass_filenames: false
always_run: true
# - id: pytest
# name: Pytest
# entry: poetry run pytest -v
# language: system
# types: [ python ]
# stages: [ commit ]
# pass_filenames: false
# always_run: true

- id: pylint
name: pylint
Expand Down
12 changes: 5 additions & 7 deletions django_notification/api/serializers/helper/get_serializer_cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
from django_notification.settings.conf import config


def group_serializer_class():
"""
Get the serializer class for the group field, either from config or the default.
"""
def group_serializer_class() -> Type[BaseSerializer]:
"""Get the serializer class for the group field, either from config or the
default."""
return config.group_serializer_class or GroupSerializer


def user_serializer_class() -> Type[BaseSerializer]:
"""
Get the serializer class for the recipient and seen_by fields, either from config or the default.
"""
"""Get the serializer class for the recipient and seen_by fields, either
from config or the default."""
return config.user_serializer_class or UserSerializer
2 changes: 1 addition & 1 deletion django_notification/tests/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def configure_django_settings() -> None:
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
],
ROOT_URLCONF="kernel.urls",
ROOT_URLCONF="django_notification.tests.urls",
DJANGO_NOTIFICATION_API_INCLUDE_SOFT_DELETE=True,
DJANGO_NOTIFICATION_API_INCLUDE_HARD_DELETE=True,
DJANGO_NOTIFICATION_ADMIN_HAS_ADD_PERMISSION=False,
Expand Down
7 changes: 7 additions & 0 deletions django_notification/tests/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path("admin/", admin.site.urls),
path("notification/", include("django_notification.api.routers.notification")),
]
Loading
Loading