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:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout Repository
|
||||
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
|
||||
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:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.11.5
|
||||
|
||||
- name: Install Dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
python -m pytest
|
||||
- name: Checkout Repository
|
||||
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 Tests
|
||||
run: |
|
||||
python -m pytest
|
||||
|
@ -37,13 +37,11 @@ repos:
|
||||
"--load-plugins=pylint_django",
|
||||
"--django-settings-module=app.settings"
|
||||
]
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.6.1
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy
|
||||
entry: mypy
|
||||
language: system
|
||||
types: [python]
|
||||
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/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import environ
|
||||
@ -81,6 +82,14 @@ WSGI_APPLICATION = "app.wsgi.application"
|
||||
|
||||
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
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
|
||||
|
@ -9,11 +9,15 @@ services:
|
||||
- .:/app
|
||||
environment:
|
||||
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:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- 8000:8000
|
||||
- 4444:4444
|
||||
|
||||
db:
|
||||
image: postgres
|
||||
|
@ -37,11 +37,11 @@ force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
ensure_newline_before_comments = true
|
||||
line_length = 121
|
||||
skip = "dockerdata,.idea,static,.venv/"
|
||||
skip = "dockerdata,.idea,static,.venv/,migrations"
|
||||
filter_files = true
|
||||
|
||||
[tool.mypy]
|
||||
plugins = ["mypy_django_plugin.main"]
|
||||
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]
|
||||
ignore_missing_imports = true
|
||||
strict = true
|
||||
|
||||
|
@ -18,6 +18,7 @@ flake8-print==5.0.0
|
||||
flake8-return==1.2.0
|
||||
flake8-use-fstring==1.4
|
||||
black==23.10.0
|
||||
djangorestframework-stubs[compatible-mypy]==3.14.4
|
||||
|
||||
# Testing
|
||||
pytest==7.4.2
|
||||
@ -28,3 +29,4 @@ pytest-cov==4.1.0
|
||||
pytest-randomly==3.15.0
|
||||
pytest-clarity==1.0.1
|
||||
pytest-xdist==3.3.1
|
||||
remote-pdb==2.1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user