forked from wireapp/wire-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
150 lines (123 loc) · 5.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
SHELL := /usr/bin/env bash
LANG := en_US.UTF-8
DOCKER_USER ?= quay.io/wire
DOCKER_TAG ?= local
default: fast
init:
mkdir -p dist
.PHONY: install
install: init
stack install --pedantic --test --bench --no-run-benchmarks --local-bin-path=dist
.PHONY: fast
fast: init
stack install --pedantic --test --bench --no-run-benchmarks --local-bin-path=dist --fast $(WIRE_STACK_OPTIONS)
.PHONY: clean
clean:
stack clean
$(MAKE) -C services/nginz clean
-rm -rf dist
-rm -f .metadata
.PHONY: services
services: init install
$(MAKE) -C services/nginz
.PHONY: haddock
haddock:
WIRE_STACK_OPTIONS="--haddock --haddock-internal" make fast
.PHONY: haddock-shallow
haddock-shallow:
WIRE_STACK_OPTIONS="--haddock --haddock-internal --no-haddock-deps" make fast
#################################
## integration tests
# Build services with --fast and run tests
.PHONY: integration
integration: fast i
# Run tests without building services
.PHONY: i
i:
$(MAKE) -C services/cargohold i
$(MAKE) -C services/galley i
$(MAKE) -C services/brig i
$(MAKE) -C services/gundeck i
$(MAKE) -C services/spar i
# Build services and run tests using AWS
.PHONY: integration-aws
integration-aws: fast i-aws
# Run tests using AWS
.PHONY: i-aws
i-aws:
$(MAKE) -C services/cargohold i-aws
$(MAKE) -C services/galley i-aws
$(MAKE) -C services/brig i-aws
$(MAKE) -C services/gundeck i-aws
$(MAKE) -C services/spar i-aws
# Build services and run tests of one service using AWS
.PHONY: integration-aws-%
integration-aws-%: fast
$(MAKE) "i-aws-$*"
# Run tests of one service using AWS
.PHONY: i-aws-%
i-aws-%:
$(MAKE) -C "services/$*" i-aws
# Build services and run tests of one service
.PHONY: integration-%
integration-%: fast
$(MAKE) "i-$*"
# Run tests of one service
.PHONY: i-%
i-%:
$(MAKE) -C "services/$*" i
#################################
## docker targets
.PHONY: docker-deps
docker-deps:
# `docker-deps` needs to be built or pulled only once (unless native dependencies change)
$(MAKE) -C build/alpine deps
.PHONY: docker-builder
docker-builder:
# `docker-builder` needs to be built or pulled only once (unless native dependencies change)
$(MAKE) -C build/alpine builder
.PHONY: docker-intermediate
docker-intermediate:
# `docker-intermediate` needs to be built whenever code changes - this essentially runs `stack clean && stack install` on the whole repo
docker build -t $(DOCKER_USER)/alpine-intermediate:$(DOCKER_TAG) -f build/alpine/Dockerfile.intermediate --build-arg intermediate=$(DOCKER_USER)/alpine-intermediate --build-arg deps=$(DOCKER_USER)/alpine-deps .;
docker tag $(DOCKER_USER)/alpine-intermediate:$(DOCKER_TAG) $(DOCKER_USER)/alpine-intermediate:latest;
if test -n "$$DOCKER_PUSH"; then docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD); docker push $(DOCKER_USER)/alpine-intermediate:$(DOCKER_TAG); docker push $(DOCKER_USER)/alpine-intermediate:latest; fi;
.PHONY: docker-migrations
docker-migrations:
# `docker-migrations` needs to be built whenever docker-intermediate was rebuilt AND new schema migrations were added.
docker build -t $(DOCKER_USER)/migrations:$(DOCKER_TAG) -f build/alpine/Dockerfile.migrations --build-arg intermediate=$(DOCKER_USER)/alpine-intermediate --build-arg deps=$(DOCKER_USER)/alpine-deps .
docker tag $(DOCKER_USER)/migrations:$(DOCKER_TAG) $(DOCKER_USER)/migrations:latest
if test -n "$$DOCKER_PUSH"; then docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD); docker push $(DOCKER_USER)/migrations:$(DOCKER_TAG); docker push $(DOCKER_USER)/migrations:latest; fi;
.PHONY: docker-exe-%
docker-exe-%:
docker image ls | grep $(DOCKER_USER)/alpine-deps > /dev/null || (echo "'make docker-deps' required.", exit 1)
docker image ls | grep $(DOCKER_USER)/alpine-intermediate > /dev/null || (echo "'make docker-intermediate' required."; exit 1)
docker build -t $(DOCKER_USER)/"$*":$(DOCKER_TAG) -f build/alpine/Dockerfile.executable --build-arg executable="$*" --build-arg intermediate=$(DOCKER_USER)/alpine-intermediate --build-arg deps=$(DOCKER_USER)/alpine-deps .
docker tag $(DOCKER_USER)/"$*":$(DOCKER_TAG) $(DOCKER_USER)/"$*":latest
if test -n "$$DOCKER_PUSH"; then docker login -u $(DOCKER_USERNAME) -p $(DOCKER_PASSWORD); docker push $(DOCKER_USER)/"$*":$(DOCKER_TAG); docker push $(DOCKER_USER)/"$*":latest; fi;
.PHONY: docker-services
docker-services:
# make docker-services doesn't compile, only makes small images out of the `docker-intermediate` image
# to recompile, run `docker-intermediate` first.
docker image ls | grep $(DOCKER_USER)/alpine-deps > /dev/null || (echo "'make docker-deps' required.", exit 1)
docker image ls | grep $(DOCKER_USER)/alpine-intermediate > /dev/null || (echo "'make docker-intermediate' required."; exit 1)
# `make -C services/brig docker` == `make docker-exe-brig docker-exe-brig-integration docker-exe-brig-schema docker-exe-brig-index`
$(MAKE) -C services/brig docker
$(MAKE) -C services/gundeck docker
$(MAKE) -C services/galley docker
$(MAKE) -C services/cannon docker
$(MAKE) -C services/proxy docker
$(MAKE) -C services/spar docker
$(MAKE) docker-exe-zauth
$(MAKE) -C services/nginz docker
DOCKER_DEV_NETWORK := --net=host
DOCKER_DEV_VOLUMES := -v `pwd`:/src/wire-server
DOCKER_DEV_IMAGE := quay.io/wire/alpine-builder:$(DOCKER_TAG)
.PHONY: run-docker-builder
run-docker-builder:
@echo "if this does not work, consider 'docker pull', 'docker tag', or 'make -C build-alpine builder'."
docker run -it $(DOCKER_DEV_NETWORK) $(DOCKER_DEV_VOLUMES) --rm $(DOCKER_DEV_IMAGE) /bin/bash
#################################
## dependencies
libzauth:
$(MAKE) -C libs/libzauth install