-
Notifications
You must be signed in to change notification settings - Fork 316
/
Makefile
84 lines (57 loc) · 2.34 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PHONY: logs
DOCKER_VERSION := $(shell docker --version 2>/dev/null)
docker_config_file := 'docker-compose.local.yaml'
all:
ifndef DOCKER_VERSION
$(error "command docker is not available, please install Docker")
endif
install:
pipenv install --categories "packages dev-packeges docs"
re-build:
docker compose -f docker-compose.yaml -f $(docker_config_file) build --no-cache
build:
docker compose -f docker-compose.yaml -f $(docker_config_file) build
pull:
docker compose -f docker-compose.yaml -f $(docker_config_file) pull
up:
docker compose -f docker-compose.yaml -f $(docker_config_file) up -d --wait
down:
docker compose -f docker-compose.yaml -f $(docker_config_file) down
load-dummy-data:
docker compose exec backend bash -c "python manage.py load_dummy_data"
list:
docker compose -f docker-compose.yaml -f $(docker_config_file) ps
logs:
docker compose -f docker-compose.yaml -f $(docker_config_file) logs
checkmigration:
docker compose exec backend bash -c "python manage.py makemigrations --check --dry-run"
makemigrations:
docker compose exec backend bash -c "python manage.py makemigrations"
migrate:
docker compose exec backend bash -c "python manage.py migrate"
test:
docker compose exec backend bash -c "python manage.py test --keepdb --parallel --shuffle"
test-coverage:
docker compose exec backend bash -c "coverage run manage.py test --settings=config.settings.test --keepdb --parallel --shuffle"
docker compose exec backend bash -c "coverage combine || true; coverage xml"
docker compose cp backend:/app/coverage.xml coverage.xml
dump-db:
docker compose exec db sh -c "pg_dump -U postgres -Fc care > /tmp/care_db.dump"
docker compose cp db:/tmp/care_db.dump care_db.dump
load-db:
docker compose cp care_db.dump db:/tmp/care_db.dump
docker compose exec db sh -c "pg_restore -U postgres --clean --if-exists -d care /tmp/care_db.dump"
reset-db:
docker compose exec backend bash -c "python manage.py reset_db --noinput"
ruff-all:
ruff check .
ruff-fix-all:
ruff check --fix .
ruff:
ruff check --fix $(shell git diff --name-only --staged | grep -E '\.py$$|\/pyproject.toml$$')
ruff-all-docker:
docker exec care bash -c "ruff check ."
ruff-docker:
docker exec care bash -c "ruff check --fix $(shell git diff --name-only --staged | grep -E '\.py$$|\/pyproject.toml$$')"
%:
docker compose exec backend bash -c "python manage.py $*"