-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (69 loc) · 2.81 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
SHELL := /bin/bash
# Shamelessly stolen from https://www.freecodecamp.org/news/self-documenting-makefile
.PHONY: help
help: ## Show this help
@egrep -h '\s##\s' Makefile \
| sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
DOCKER_COMPOSE=-f ./ops/package/docker-compose.yml
DOCKER_COMPOSE_DEV=-f ./ops/package/docker-compose.dev.yml -f ./ops/package/docker-compose.override.yml
DOCKER_COMPOSE_TEST=-f ./ops/package/docker-compose.test.yml
DEV_PROJECTS=relay
TEST_RELAY_URL=ws://127.0.0.1:8080
CLIENT_TEST=npm run test:run --prefix packages/sign-client -- --timeout=30000
### Production build/publish
.PHONY: build
build: ## build docker images
@docker-compose $(DOCKER_COMPOSE) build
.PHONY: publish
publish: ## push docker images to docker hub
@docker-compose $(DOCKER_COMPOSE) push
### Dev build/publish
.PHONY: build-dev
build-dev: ## build docker images for dev enviromnent
@docker-compose $(DOCKER_COMPOSE_DEV) build $(DEV_PROJECTS)
.PHONY: publish-dev
publish-dev: ## push docker images for dev environment to the docker hub
@docker-compose $(DOCKER_COMPOSE_DEV) push $(DEV_PROJECTS)
# Local dev environment helpers
.PHONY: dev
.PHONY: pull
pull: ## pull image environment
@docker-compose $(DOCKER_COMPOSE_DEV) pull --ignore-pull-failures || true
dev: ## start local dev environment
ifeq (,$(fast))
@make build-dev
endif
@docker-compose $(DOCKER_COMPOSE_DEV) up -d
.PHONY: stop
stop: ## stop local environment
@docker-compose $(DOCKER_COMPOSE_DEV) stop
.PHONY: clean
clean: stop ## clean local environment
@docker-compose $(DOCKER_COMPOSE_DEV) rm -f
logs: ## show logs for docker containers. To get logs for a single container uses `make logs service=relay`
@docker-compose $(DOCKER_COMPOSE_DEV) logs ${service}
.PHONY: ps
ps: ## show docker container status
@docker-compose $(DOCKER_COMPOSE_DEV) ps
### Testing
.PHONY: test
test: test-relay test-client
.PHONY: test-relay
test-relay: ## runs "./test" tests against the locally running relay
npm i --include=dev
# Use local tests instead of monorepo-tests
TEST_RELAY_URL=$(TEST_RELAY_URL) npm run test
.PHONY: test-client
test-client: ## runs "./packages/client" tests against the locally running relay
@docker-compose $(DOCKER_COMPOSE_DEV) $(DOCKER_COMPOSE_TEST) \
run --rm monorepo-tests $(CLIENT_TEST)
.PHONY: test-staging
test-staging: ## runs "./packages/client" tests against the staging.walletconnect.com
@docker-compose $(DOCKER_COMPOSE_DEV) $(DOCKER_COMPOSE_TEST) \
run --rm -e TEST_RELAY_URL=ws://staging.walletconnect.com \
monorepo-tests $(CLIENT_TEST)
.PHONY: test-production
test-production: ## runs "./packages/client" tests against the relay.walletconnect.com
@docker-compose $(DOCKER_COMPOSE_DEV) $(DOCKER_COMPOSE_TEST) \
run --rm -e TEST_RELAY_URL=ws://relay.walletconnect.com \
monorepo-tests $(CLIENT_TEST)