-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (41 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Makefile
help:
@echo "Available commands:"
@echo " makemigrations - Create migration files for Django models. Usage: 'make makemigrations'"
@echo " migrate - Apply database migrations. Usage: 'make migrate'"
@echo " lint - Run flake8 to lint the code. Usage: 'make lint'"
@echo " black - Format code using black. Usage: 'make format_code'"
@echo " test - Run tests. Usage: 'make test'"
@echo " coverage_report - Generate coverage report. Usage: 'make coverage_report'"
# Create migration files
makemigrations:
@echo "Making migration files..."
docker compose run --rm accounts python manage.py makemigrations
# Run migrations
migrate:
@echo "Running migrations in Docker..."
docker compose run --rm accounts python manage.py migrate
# Lint the code with flake8
lint:
@echo "Running flake8 for code linting..."
docker compose run --rm accounts flake8
# Format code using black
black:
@echo "Formatting code with black..."
docker compose run --rm accounts black .
# Test the code
test:
@echo "Running Tests..."
docker compose run --rm accounts python manage.py test --parallel
# Generate coverage report
coverage_report:
@echo "Running Django tests with coverage and generating report..."
docker compose run --rm accounts sh -c "coverage run manage.py test && coverage report && coverage html"
# Create a Django superuser
createsuperuser:
@echo "Creating a Django superuser..."
docker compose run --rm accounts python manage.py createsuperuser
# Install pre-commit on the local system
install_pre_commit:
@echo "Installing pre-commit on the local system..."
pre-commit install