-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
50 lines (35 loc) · 1.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
.phony:
test
PROJECT_NAME=$(notdir $(PWD))
HOST_NAME=${USER}
CONTAINER_UID=$(HOST_NAME)_${PROJECT_NAME}
export PROJECT_NAME $(PROJECT_NAME)
# Sanity check & removal of idle postgres images
IDLE_CONTAINERS = $(shell docker ps -aq -f name=postgres -f name=web)
UP_CONTAINERS = $(shell docker ps -q -f name=postgres -f name=web)
test-local:
@echo "*** `tests` directory should exist at project root. Stop."
db-migration:
alembic -x data=true downgrade base
alembic -x data=true upgrade head
test-unit:
pytest --color=yes --showlocals --tb=short -v tests/auth/unit
test-integration:
pytest --color=yes --showlocals --tb=short -v tests/auth/integration
test-e2e:
pytest --color=yes --showlocals --tb=short -v tests/auth/e2e
test-local: tests db-migration test-unit test-integration test-e2e
build:
@docker-compose build
test:
@docker-compose -p $(CONTAINER_UID) run --rm --use-aliases --service-ports web sh docker/test.sh
@docker kill $(PROJECT_NAME)_postgres
@docker rm $(PROJECT_NAME)_postgres
clean:
@docker-compose -p $(CONTAINER_UID) down --remove-orphans 2>/dev/null
@[ ! -z "$(UP_CONTAINERS)" ] && docker kill $(UP_CONTAINERS) || echo "Neat."
@[ ! -z "$(IDLE_CONTAINERS)" ] && docker rm $(IDLE_CONTAINERS) || echo "Clean."
service:
@docker-compose -p $(CONTAINER_UID) up
prune:
docker system prune -af