-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (80 loc) · 2.71 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
export COMPOSE_PROJECT_NAME=api-projector
export DOCKER_DEFAULT_PLATFORM=linux/amd64
-include config.env
COMPOSE_ARGS=-f tools/compose/docker-compose.yml
COMPOSE_ALL_FILE=tools/compose/docker-compose.all.yml
# -- poetry --
install:
@poetry install --remove-untracked
lint:
black --check .
mypy .
flake8 .
DJANGO_ENV=build python src/manage.py makemigrations --dry-run --check
xenon --max-absolute A \
--max-modules A \
--max-average A \
--exclude src/apps/core/graphql/fields/query_connection.py \
src
poetry check
pip check
#safety check --bare
polint -i location,unsorted src/locale
dennis-cmd lint --errorsonly src/locale
test:
@pytest
# -- django --
make-messages:
@python src/manage.py makemessages --ignore=.venv/* -l en -l ru --no-location
compile-messages:
@python src/manage.py compilemessages
make-migrations:
@python src/manage.py makemigrations
migrate:
@python src/manage.py migrate
generate-graphql-schema:
@python src/manage.py graphql_schema --schema src.gql.schema --out tests/schema.graphql
# -- precommit --
pre-commit:
@pre-commit
pre-commit-install:
@pre-commit install
@pre-commit install --hook-type commit-msg
pre-commit-update:
@pre-commit autoupdate
up:
docker compose ${COMPOSE_ARGS} up --remove-orphans
up-all:
docker compose ${COMPOSE_ARGS} -f ${COMPOSE_ALL_FILE} up --build --remove-orphans
down:
docker compose ${COMPOSE_ARGS} down
down-all:
docker compose ${COMPOSE_ARGS} -f ${COMPOSE_ALL_FILE} down
stop:
docker compose ${COMPOSE_ARGS} stop
stop-all:
docker compose ${COMPOSE_ARGS} -f ${COMPOSE_ALL_FILE} stop
# -- postgresql --
download-pg-dump:
rsync -L -av --progress ${POSTGRES_DUMP} tools/compose/dumps/pg.dump
# -- local postgresql --
local-drop-db:
dropdb --u admin --if-exists ${POSTGRES_DATABASE}
local-create-db:
createdb --u admin ${POSTGRES_DATABASE}
local-restore-dump: local-drop-db local-create-db
pg_restore -U admin -d ${POSTGRES_DATABASE} -Fc --disable-triggers tools/compose/dumps/pg.dump
# -- docker postgresql --
drop-pg-db:
docker compose ${COMPOSE_ARGS} exec postgres dropdb -U ${POSTGRES_USER} --if-exists ${POSTGRES_DB}
create-pg-db:
docker compose ${COMPOSE_ARGS} exec postgres createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
restore-pg-dump: drop-pg-db create-pg-db
docker compose ${COMPOSE_ARGS} exec -T postgres pg_restore --no-owner -C -U ${POSTGRES_USER} -d ${POSTGRES_DB} -Fc --disable-triggers < tools/compose/dumps/pg.dump
# -- couchdb --
download-couchdb-dump:
rsync -L -av ${COUCHDB_DUMP} tools/compose/dumps/couchdb.tar.gz
restore-couchdb-dump: download-couchdb-dump
rm -rf tools/compose/couchdb/data
mkdir tools/compose/couchdb/data
tar -zxvf tools/compose/dumps/couchdb.tar.gz -C tools/compose/couchdb/data