Made more improvements
This commit is contained in:
parent
69bc71f225
commit
fce5d6957c
90
.github/workflows/lint.yml
vendored
90
.github/workflows/lint.yml
vendored
@ -1,64 +1,52 @@
|
|||||||
name: Lint
|
name: PR Lint and Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
|
- develop
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Python and Cache Pip Dependencies
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
cache: 'pip'
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: pip install -r requirements.txt
|
||||||
|
- name: Run Black
|
||||||
|
run: |
|
||||||
|
python -m black --check .
|
||||||
|
- name: Run isort
|
||||||
|
run: |
|
||||||
|
python -m isort --check .
|
||||||
|
- name: Run Flake8
|
||||||
|
run: |
|
||||||
|
python -m flake8
|
||||||
|
- name: Run Pylint
|
||||||
|
run: |
|
||||||
|
python -m pylint app
|
||||||
|
- name: Run mypy
|
||||||
|
run: |
|
||||||
|
python -m mypy .
|
||||||
|
|
||||||
- name: Set up Python
|
test:
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: 3.11.5
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: pip install -r requirements.txt
|
|
||||||
|
|
||||||
- name: Run Black
|
|
||||||
run: |
|
|
||||||
python -m black --check .
|
|
||||||
|
|
||||||
- name: Run isort
|
|
||||||
run: |
|
|
||||||
python -m isort --check .
|
|
||||||
|
|
||||||
- name: Run Flake8
|
|
||||||
run: |
|
|
||||||
python -m flake8
|
|
||||||
|
|
||||||
- name: Run Pylint
|
|
||||||
run: |
|
|
||||||
python -m pylint app
|
|
||||||
|
|
||||||
- name: Run mypy
|
|
||||||
run: |
|
|
||||||
python -m mypy .
|
|
||||||
|
|
||||||
testing:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Python and Cache Pip Dependencies
|
||||||
- name: Set up Python
|
uses: actions/setup-python@v4
|
||||||
uses: actions/setup-python@v2
|
with:
|
||||||
with:
|
python-version: '3.9'
|
||||||
python-version: 3.11.5
|
cache: 'pip'
|
||||||
|
- name: Install Dependencies
|
||||||
- name: Install Dependencies
|
run: pip install -r requirements.txt
|
||||||
run: pip install -r requirements.txt
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
- name: Run Tests
|
python -m pytest
|
||||||
run: |
|
|
||||||
python -m pytest
|
|
||||||
|
@ -37,13 +37,11 @@ repos:
|
|||||||
"--load-plugins=pylint_django",
|
"--load-plugins=pylint_django",
|
||||||
"--django-settings-module=app.settings"
|
"--django-settings-module=app.settings"
|
||||||
]
|
]
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: local
|
||||||
rev: v1.6.1
|
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
|
name: mypy
|
||||||
|
entry: mypy
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
args: [--strict]
|
args: [--strict]
|
||||||
additional_dependencies:
|
|
||||||
- django-stubs==4.2.5
|
|
||||||
- django-environ==0.11.2
|
|
||||||
- django_extensions==3.2.3
|
|
||||||
- drf-yasg[validation]==1.21.7
|
|
||||||
|
@ -10,6 +10,7 @@ For the full list of settings and their values, see
|
|||||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import environ
|
import environ
|
||||||
@ -81,6 +82,14 @@ WSGI_APPLICATION = "app.wsgi.application"
|
|||||||
|
|
||||||
DATABASES = {"default": env.db("POSTGRES_CONNECTION_STRING", default="sqlite:///db.sqlite3")}
|
DATABASES = {"default": env.db("POSTGRES_CONNECTION_STRING", default="sqlite:///db.sqlite3")}
|
||||||
|
|
||||||
|
if "CI" in os.environ:
|
||||||
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
|
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||||
|
@ -9,11 +9,15 @@ services:
|
|||||||
- .:/app
|
- .:/app
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_CONNECTION_STRING: "postgresql://app:app@db:5432/app"
|
POSTGRES_CONNECTION_STRING: "postgresql://app:app@db:5432/app"
|
||||||
|
PYTHONBREAKPOINT: remote_pdb.set_trace
|
||||||
|
REMOTE_PDB_PORT: 4444
|
||||||
|
REMOTE_PDB_HOST: 0.0.0.0
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
|
- 4444:4444
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
|
@ -37,11 +37,11 @@ force_grid_wrap = 0
|
|||||||
use_parentheses = true
|
use_parentheses = true
|
||||||
ensure_newline_before_comments = true
|
ensure_newline_before_comments = true
|
||||||
line_length = 121
|
line_length = 121
|
||||||
skip = "dockerdata,.idea,static,.venv/"
|
skip = "dockerdata,.idea,static,.venv/,migrations"
|
||||||
filter_files = true
|
filter_files = true
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
plugins = ["mypy_django_plugin.main"]
|
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
strict = true
|
strict = true
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ flake8-print==5.0.0
|
|||||||
flake8-return==1.2.0
|
flake8-return==1.2.0
|
||||||
flake8-use-fstring==1.4
|
flake8-use-fstring==1.4
|
||||||
black==23.10.0
|
black==23.10.0
|
||||||
|
djangorestframework-stubs[compatible-mypy]==3.14.4
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
pytest==7.4.2
|
pytest==7.4.2
|
||||||
@ -28,3 +29,4 @@ pytest-cov==4.1.0
|
|||||||
pytest-randomly==3.15.0
|
pytest-randomly==3.15.0
|
||||||
pytest-clarity==1.0.1
|
pytest-clarity==1.0.1
|
||||||
pytest-xdist==3.3.1
|
pytest-xdist==3.3.1
|
||||||
|
remote-pdb==2.1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user