-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (57 loc) · 2.13 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
.DEFAULT_GOAL: help
.PHONY: help build run dev prod start logs stop wait-healthy typecheck lint format test integration-test smoke-test
ifeq (${TARGET},)
TARGET := dev
endif
DOCKER_COMPOSE = docker-compose --file docker-compose.yml --file docker-compose.$(TARGET).yml
STOP = exit=$$?; $(MAKE) stop; exit $$exit
help: ## Display this help text
@grep -E '^[a-zA-Z_\\:-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | sed 's/\\:/:/g' | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.env:
cp env.example .env
build:
@$(DOCKER_COMPOSE) build
run: .env build
@${DOCKER_COMPOSE} up --abort-on-container-exit --exit-code-from prereview; ${STOP}
dev: export TARGET = dev
dev: run ## Run the dev image
prod: export TARGET = prod
prod: run ## Run the prod image
start: .env build
start:
@${DOCKER_COMPOSE} up --detach
logs:
ifeq (${LOG_FILE},)
@${DOCKER_COMPOSE} logs
else
@${DOCKER_COMPOSE} logs --no-color > ${LOG_FILE}
endif
stop:
ifneq (${LOG_FILE},)
@$(MAKE) logs
endif
@${DOCKER_COMPOSE} down
wait-healthy: ## Wait for the app to be healthy
@.scripts/wait-healthy.sh prereview
typecheck: export TARGET = dev
typecheck: build ## Run the typechecker
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview typecheck
lint: export TARGET = dev
lint: build ## Run the linter
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview lint
format: export TARGET = dev
format: build ## Run the formatter
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview format
test: export TARGET = dev
test: build ## Run the tests
@${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview test
integration-test: export TARGET = integration
integration-test: export LOG_FILE = integration/results/docker.log
integration-test: build ## Run the integration tests
@mkdir -p integration/results && rm -rf integration/results/*
@${DOCKER_COMPOSE} run playwright; ${STOP}
smoke-test: build ## Run the smoke tests
@.scripts/smoke-test.sh
create-migration: export TARGET = dev
create-migration: build ## Create a migration file
@${DOCKER_COMPOSE} run --rm prereview db -- migration:create; ${STOP}