-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
69 lines (53 loc) · 2.19 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
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -k 1,1 | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build the development server
@docker compose build --pull
.PHONY: start
start: ## Start the development server
@docker compose up -d --build
.PHONY: test
test: ## Test the backend
@docker compose run --rm alexandria pytest --no-cov-on-fail --cov --create-db -vv
.PHONY: lint
lint: ## Lint the backend
@docker compose run --rm alexandria sh -c "ruff check . && ruff format --check ."
.PHONY: format
format: ## format the backend
@docker compose run --rm alexandria sh -c "ruff check --fix . && ruff format ."
.PHONY: bash
bash: ## Shell into the backend
@docker compose run --rm alexandria bash
.PHONY: shell_plus
shell_plus: ## Run shell_plus
@docker compose run --rm alexandria ./manage.py shell_plus
.PHONY: debug-alexandria
debug-alexandria: ## start an api container with service ports for debugging
@docker compose stop alexandria
@echo "Run './manage.py runserver 0:8000' to start the debugging server"
@docker compose run --rm --user root --use-aliases --service-ports alexandria bash
.PHONY: debug-celery
debug-celery: ## start a celery container with service ports for debugging
@docker compose stop celery
@echo "See https://docs.celeryq.dev/en/stable/userguide/debugging.html on how to debug celery"
@docker compose run --rm --user root --use-aliases --service-ports celery
.PHONY: makemigrations
makemigrations: ## Make django migrations
@docker compose run --rm alexandria ./manage.py makemigrations
.PHONY: migrate
migrate: ## Migrate django
@docker compose run --rm alexandria ./manage.py migrate
.PHONY: dbshell
dbshell: ## Start a psql shell
@docker compose exec db psql -Ualexandria
.PHONY: load_example_data
load_example_data: ## Load a set of example data
@docker compose run --rm alexandria ./manage.py loaddata initial_data.json
.PHONY: flush
flush: ## Flush the database
@docker compose exec alexandria ./manage.py flush --no-input
.PHONY: dump
dump: ## dump alexandria data
@docker compose run --rm alexandria ./manage.py dumpdata alexandria_core | jq > initial_data.json