generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (66 loc) · 1.95 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
RESOURCES = \
api \
terragrunt
.PHONY: help build dev format fmt install lint migrate migrations fmt-ci lint-ci
.PHONY: test db-connect
help:
@echo make [COMMAND]
@echo
@echo COMMANDS
@echo " build -- Run build commands"
@echo " db-connect -- Create a psql connection to the database"
@echo " dev -- Run API dev server"
@echo " format -- Alias for fmt"
@echo " fmt -- Run formatters"
@echo " fmt-ci -- Run formatters in check mode for CI"
@echo " install -- Install needed Python and NPM libraries"
@echo " install-dev -- Installs needed development libraries"
@echo " lint -- Run linters"
@echo " lint-ci -- Run linters in check mode for CI"
@echo " migrate -- Alias for migrations"
@echo " migations -- Run migrations"
@echo " test -- Run tests"
dev:
$(MAKE) -C api dev
migrate: migrations
migrations:
$(MAKE) -C api migrations
db-connect:
psql postgresql://postgres:postgres@db/list-manager
test: $(addsuffix .test,$(RESOURCES))
build: $(addsuffix .build,$(RESOURCES))
format: fmt
fmt: $(addsuffix .fmt,$(RESOURCES))
fmt-ci: $(addsuffix .fmt-ci,$(RESOURCES))
install: $(addsuffix .install,$(RESOURCES))
install-dev: $(addsuffix .install-dev,$(RESOURCES))
lint: $(addsuffix .lint,$(RESOURCES))
lint-ci: $(addsuffix .lint-ci,$(RESOURCES))
define make-rules
.PHONY: $1.test $1.build $1.fmt $1.install $1.install-dev $1.lint
$1.build:
@echo "[Building $1]"
$(MAKE) -C $1 build
$1.fmt:
@echo "[Formatting $1]"
$(MAKE) -C $1 fmt
$1.fmt-ci:
@echo "[Formatting $1]"
$(MAKE) -C $1 fmt-ci
$1.install:
@echo "[Installing $1]"
$(MAKE) -C $1 install
$1.install-dev:
@echo "[Installing dev dependencies $1]"
$(MAKE) -C $1 install-dev
$1.lint:
@echo "[Linting $1]"
$(MAKE) -C $1 lint
$1.lint-ci:
@echo "[Linting $1]"
$(MAKE) -C $1 lint-ci
$1.test:
@echo "[Testing $1]"
$(MAKE) -C $1 test
endef
$(foreach component,$(RESOURCES), $(eval $(call make-rules, $(component))))