-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
94 lines (72 loc) · 2.31 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
.PHONY: build
build: build-core build-reverse-proxy;
.PHONY: build-core
build-core:
docker build . -t core:current
.PHONY: build-reverse-proxy
build-reverse-proxy:
docker build . -f Dockerfile-reverse-proxy -t core-reverse-proxy:current
.PHONY: superuser
superuser:
poetry run python -m core.manage createsuperuser
.PHONY: install
install:
poetry install
.PHONY: migrations
migrations:
poetry run python -m core.manage makemigrations
.PHONY: migrate
migrate:
poetry run python -m core.manage migrate
.PHONY: install-pre-commit
install-pre-commit:
poetry run pre-commit uninstall; poetry run pre-commit install
.PHONY: update
update: install migrate install-pre-commit ;
.PHONY: shell
shell:
poetry run python -m core.manage shell
.PHONY: dbshell
dbshell:
poetry run python -m core.manage dbshell
.PHONY: up-dependencies-only
up-dependencies-only:
test -f .env || touch .env
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --force-recreate db redis
.PHONY: run-server
run-server:
poetry run python -m core.manage runserver 127.0.0.1:8000
.PHONY: dot-env
dot-env:
grep -q -o CORESETTING_SECRET_KEY .env 2> /dev/null || echo "CORESETTING_SECRET_KEY=$$(xxd -c 48 -l 48 -p /dev/urandom)" >> .env
.PHONY: run-dockerized-build
run-dockerized-build: build dot-env
docker compose -f docker-compose.yml -f docker-compose.build.yml up --no-build --force-recreate
.PHONY: run-dockerized-from-registry
run-dockerized-from-registry: dot-env
echo '(username=github username; password=github personal access token (not github password)'
docker login ghcr.io
docker compose pull
docker compose up --no-build --force-recreate
.PHONY: lint
lint:
poetry run pre-commit run --all-files
.PHONY: test
test:
poetry run pytest -v -rs -n auto --show-capture=no
.PHONY: test-fail-fast
test-fail-fast:
poetry run pytest -x -v -rs -n auto --show-capture=no
.PHONY: test-stepwise
test-stepwise:
poetry run pytest --reuse-db --sw -vv
.PHONY: test-with-coverage
test-with-coverage:
poetry run pytest -vv --cov=core --cov-report=html
.PHONY: test-dockerized
test-dockerized:
docker compose -f docker-compose.test.yml build
docker compose -f docker-compose.test.yml run -i --rm sut
docker compose -f docker-compose.test.yml stop db redis # docker compose run leaves them running
.PHONY: lint-and-test
lint-and-test: lint test ;