-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
157 lines (121 loc) · 3.53 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
include ./apps/armory/Makefile
include ./apps/devtool/Makefile
include ./apps/docs/Makefile
include ./apps/policy-engine/Makefile
include ./apps/vault/Makefile
include ./packages/armory-e2e-testing/Makefile
include ./packages/armory-sdk/Makefile
include ./packages/nestjs-shared/Makefile
include ./packages/open-telemetry/Makefile
include ./packages/policy-engine-shared/Makefile
include ./packages/signature/Makefile
include ./packages/transaction-request-intent/Makefile
# For more terminal color codes, head over to
# https://opensource.com/article/19/9/linux-terminal-colors
TERM_NO_COLOR := \033[0m
TERM_GREEN := \033[0;32m
# === Install ===
install:
npm install --engine-strict
install/ci:
npm ci --engine-strict
# === Setup ===
check-requirements:
@if ! command -v docker >/dev/null 2>&1; then \
echo "❌ Docker is not installed. Please install Docker from https://docs.docker.com/get-docker/"; \
exit 1; \
fi
@if ! docker info >/dev/null 2>&1; then \
echo "❌ Docker daemon is not running. Please start Docker and try again"; \
exit 1; \
fi
@if ! command -v opa >/dev/null 2>&1; then \
echo "❌ OPA is not installed. Please install OPA from https://www.openpolicyagent.org/docs/latest/#1-download-opa"; \
exit 1; \
fi
@echo "✅ All requirements are satisfied!"
setup:
make install
make check-requirements
make docker/up
make armory/setup
make vault/setup
make policy-engine/setup
@echo ""
@echo "${TERM_GREEN}🐋 Applications are ready!${TERM_NO_COLOR}"
# === Packages ===
packages/release:
npx nx release --skip-publish
# TODO: The default override for `dependsOn` of `nx-release-publish` is not
# working. Ideally, the release target should depend on package's build.
packages/release/build:
npx nx run-many \
--target build \
--projects armory-sdk
# NOTE: Run the command in dry run mode to see what files are going to be
# published: `npx nx release publish --dry-run`
packages/release/publish:
npx nx release publish
# === Code format ===
format:
npx nx format:write --all
format/check:
npx nx format:check --all
lint:
npx nx run-many \
--target lint \
--fix
lint/check:
npx nx run-many --target lint
# === Testing ===
test/type:
npx nx run-many --target test:type --all
test/unit:
npx nx run-many --target test:unit --all
test/integration:
npx nx run-many --target test:integration --all
test/e2e:
npx nx run-many --target test:e2e --all
test:
make test/type
make test/unit
make test/integration
make test/e2e
# === Docker ===
# Starts the applications' dependencies.
docker/up:
docker-compose up postgres redis --detach
docker/stop:
docker-compose stop
# Starts the whole Armory stack in Docker containers.
docker/stack/up:
docker-compose up --detach
docker/otel/up:
docker-compose up postgres redis jaeger otel_collector --detach
docker/stack/build:
docker buildx build \
--platform linux/amd64 \
--file local.dockerfile \
--tag armory/local:latest \
. --load
# Starts the whole Armory stack for MPC in Docker containers.
# Requires the mpc nodes to be configured seprately.
docker/mpc/up:
docker-compose -f docker-compose.mpc.yml up --detach
docker/mpc/stop:
docker-compose -f docker-compose.mpc.yml stop
# === Git ===
git/tag/push:
git tag armory-$(TAG)
git tag policy-engine-$(TAG)
git tag vault-$(TAG)
git push origin armory-$(TAG) policy-engine-$(TAG) vault-$(TAG)
# === Database ===
db/setup:
make armory/db/setup
make policy-engine/db/setup
make vault/db/setup
db/generate-types:
make armory/db/generate-types
make policy-engine/db/generate-types
make vault/db/generate-types