forked from GaloyMoney/blink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
159 lines (117 loc) · 4.77 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
158
159
BIN_DIR=node_modules/.bin
start-deps:
docker compose up e2e-deps -d
start-deps-integration:
docker compose up integration-deps -d
update-price-history:
docker compose run price-history node servers/history/cron.js
start-main:
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \
src/servers/graphql-main-server.ts | yarn pino-pretty -c -l
start-main-fast:
yarn run watch-main | yarn pino-pretty -c -l
start-trigger: start-deps
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \
src/servers/trigger.ts | yarn pino-pretty -c -l
start-cron: start-deps
. ./.envrc && yarn tsnd --files -r tsconfig-paths/register -r src/services/tracing.ts \
src/servers/cron.ts | yarn pino-pretty -c -l
start-loopd:
./dev/bin/start-loopd.sh
start: start-deps
make start-main & make start-trigger
start-main-ci:
node lib/servers/graphql-main-server.js
start-trigger-ci:
node lib/servers/trigger.js
exporter: start-deps
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register -r src/services/tracing.ts \
src/servers/exporter.ts | yarn pino-pretty -c -l
watch:
yarn nodemon -V -e ts,graphql -w ./src -x make start
clean-deps:
docker compose down
reset-deps: clean-deps start-deps
reset-deps-integration: clean-deps start-deps-integration
test: unit integration
test-migrate:
docker compose down -v
docker compose build
docker compose -f docker-compose.yml up mongodb-migrate --exit-code-from mongodb-migrate
unit:
yarn test:unit
watch-unit:
$(BIN_DIR)/jest --config ./test/jest-unit.config.js --clearCache
NODE_ENV=test LOGLEVEL=warn $(BIN_DIR)/jest --watch --config ./test/jest-unit.config.js
watch-compile:
$(BIN_DIR)/tsc --watch --noEmit --skipLibCheck
e2e-in-ci:
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml up e2e-tests
reset-e2e-in-ci-with-build: reset-deps e2e-in-ci-with-build
e2e-in-ci-with-build:
yarn build && \
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml run --name e2e-tests e2e-tests make execute-e2e-from-within-container-cached || \
docker rm `docker ps -q -f status=exited`
e2e-in-ci-cached:
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml run --name e2e-tests e2e-tests make execute-e2e-from-within-container-cached || \
docker rm `docker ps -q -f status=exited`
delete-e2e:
docker container kill `docker ps -f name="e2e-tests" -q` && \
sleep 1 && \
docker container rm `docker ps -f name="e2e-tests" -q`
main-in-ci-build:
yarn build && \
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml -f docker-compose.override.yml run --name e2e-tests e2e-tests make start-main-ci || \
docker rm e2e-tests
main-in-ci-cached:
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml run --name e2e-tests e2e-tests make start-main-ci || \
docker rm e2e-tests
del-containers:
docker compose rm -sfv
execute-e2e-from-within-container:
yarn install && \
yarn build && \
NODE_ENV=test LOGLEVEL=error $(BIN_DIR)/jest --config ./test/jest-e2e.config.js --bail --runInBand --ci --reporters=default --reporters=jest-junit
execute-e2e-from-within-container-cached:
NODE_ENV=test LOGLEVEL=error $(BIN_DIR)/jest --config ./test/jest-e2e.config.js --bail --runInBand --ci --reporters=default --reporters=jest-junit
integration:
yarn build && \
yarn test:integration
reset-integration: reset-deps-integration integration
e2e:
yarn build && \
yarn test:e2e
reset-e2e: reset-deps e2e
integration-in-ci:
make create-tmp-env-ci && \
TMP_ENV_CI=tmp.env.ci docker compose -f docker-compose.yml up integration-tests
# NODE_OPTIONS line should be removed whenever we upgrade yarn.lock to see if
# heap allocation issue has been resolved in dependencies (fails at 2048).
execute-integration-from-within-container:
yarn install && \
NODE_OPTIONS="--max-old-space-size=4096" \
NODE_ENV=test LOGLEVEL=error $(BIN_DIR)/jest --config ./test/jest-integration.config.js --bail --runInBand --ci --reporters=default --reporters=jest-junit
unit-in-ci:
. ./.envrc && \
LOGLEVEL=warn $(BIN_DIR)/jest --config ./test/jest-unit.config.js --ci --bail
check-implicit:
yarn tsc-check-noimplicitany
check-code: check-implicit
yarn tsc-check
yarn eslint-check
yarn build
yarn check-yaml
create-tmp-env-ci:
. ./.envrc && \
envsubst < .env.ci > tmp.env.ci
# 16 is exit code for critical https://classic.yarnpkg.com/lang/en/docs/cli/audit
audit:
bash -c 'yarn audit --level critical; [[ $$? -ge 16 ]] && exit 1 || exit 0'
mine-block:
container_id=$$(docker ps -q -f status=running -f name="bitcoind"); \
docker exec -it "$$container_id" /bin/sh -c 'ADDR=$$(bitcoin-cli getnewaddress "") && bitcoin-cli generatetoaddress 6 $$ADDR '