Skip to content

Commit 85f8181

Browse files
committed
chore: project setup
0 parents  commit 85f8181

27 files changed

Lines changed: 2213 additions & 0 deletions

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MANAGE_PY_PATH=manage.py

.githooks/pre-push

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
echo "Running tests with coverage..."
4+
5+
coverage run manage.py test
6+
status=$?
7+
8+
if [ $status -ne 0 ]; then
9+
echo "❌ Tests failed. Push aborted."
10+
exit 1
11+
fi
12+
13+
coverage report --fail-under=85 # set your threshold
14+
if [ $? -ne 0 ]; then
15+
echo "❌ Coverage is below threshold. Push aborted."
16+
exit 1
17+
fi
18+
19+
echo "✅ Tests passed and coverage is acceptable. Proceeding with push."
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 🚦 Basic Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
quality-checks:
11+
name: Quality Checks
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: 📥 Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: 🐍 Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: 📦 Install dependencies
24+
run: pip install -r requirements.txt
25+
26+
- name: 🎨 Run black (formatting)
27+
run: black --check .
28+
29+
- name: 🧹 Run isort (import sorting)
30+
run: isort --check-only .
31+
32+
- name: 🧐 Run mypy (type checking)
33+
run: mypy .
34+
35+
- name: 🔍 Run pylint (linting)
36+
run: pylint **/*.py
37+
38+
- name: 🧪 Run tests with coverage
39+
run: coverage run manage.py test
40+
41+
- name: 📊 Generate coverage report (fail if <85%)
42+
run: coverage report --fail-under=85

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
__pycache__/
3+
*sqlite3
4+
.coverage
5+
htmlcov

.pre-commit-config.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
9+
- repo: https://github.com/psf/black
10+
rev: 25.1.0
11+
hooks:
12+
- id: black
13+
name: black to format python code
14+
15+
- repo: https://github.com/pycqa/isort
16+
rev: 6.0.1
17+
hooks:
18+
- id: isort
19+
name: isort to sort imports
20+
args:
21+
- --profile
22+
- black
23+
- --verbose
24+
- --skip-glob
25+
- "**/migrations/*.py"
26+
27+
- repo: https://github.com/pre-commit/mirrors-mypy
28+
rev: v1.17.0
29+
hooks:
30+
- id: mypy
31+
name: mypy to check types
32+
additional_dependencies:
33+
- django-jazzmin==3.0.1
34+
- django-stubs==5.2.2
35+
- djangorestframework==3.16.0
36+
- djangorestframework-stubs==3.16.1
37+
args: ["--config-file=mypy.ini"]
38+
39+
- repo: https://github.com/pycqa/pylint
40+
rev: v3.3.7
41+
hooks:
42+
- id: pylint
43+
name: pylint to check code quality
44+
entry: pylint
45+
language: python
46+
types: [python]
47+
args: ["--rcfile=.pylintrc"]
48+
additional_dependencies:
49+
- django-jazzmin==3.0.1
50+
- Django==5.2.4
51+
- pylint-django==2.6.1
52+
- djangorestframework==3.16.0

0 commit comments

Comments
 (0)