forked from influenzanet/user-management-service
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (44 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
60 lines (44 loc) · 2.12 KB
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
.PHONY: build test install-dev mock docker api user-management-service-app create-user key-generator weekday-assign
PROTO_BUILD_DIR = intermediate
DOCKER_OPTS ?= --rm
# Where binary are put
TARGET_DIR ?= ./
# TEST_ARGS = -v | grep -c RUN
VERSION := $(shell git describe --tags --abbrev=0)
TAG ?= $(VERSION)
help:
@echo "Service building targets"
@echo " build : build service command"
@echo " test : run test suites"
@echo " docker: build docker image"
@echo " install-dev: install dev dependencies"
@echo " api: compile protobuf files for go"
@echo "Env:"
@echo " DOCKER_OPTS : default docker build options (default : $(DOCKER_OPTS))"
@echo " TEST_ARGS : Arguments to pass to go test call"
api:
if [ ! -d $(PROTO_BUILD_DIR) ]; then mkdir -p $(PROTO_BUILD_DIR); else find $(PROTO_BUILD_DIR) -type f -delete && mkdir -p $(PROTO_BUILD_DIR); fi
find ./api/user_management/*.proto -maxdepth 1 -type f -exec protoc {} --proto_path=./api --go_out=$(PROTO_BUILD_DIR) --go-grpc_out=$(PROTO_BUILD_DIR) \;
find "./pkg/api" -delete
mv $(PROTO_BUILD_DIR)/github.com/influenzanet/user-management-service/pkg/api pkg/api
find $(PROTO_BUILD_DIR) -delete
key-generator:
go build -o $(TARGET_DIR) ./tools/key-generator
create-admin-user:
go build -o $(TARGET_DIR) ./tools/create-admin-user
user-management-service-app:
go build -o $(TARGET_DIR) ./cmd/user-management-service-app
weekday-assign:
go build -o $(TARGET_DIR) ./tools/weekday-assign
build: user-management-service-app key-generator create-admin-user weekday-assign
test:
./test/test.sh $(TEST_ARGS)
install-dev:
go get github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen
mock:
# messaging service repo has to be in the relative path as here:
mockgen -source=../messaging-service/pkg/api/messaging_service/message-service.pb.go MessagingServiceApiClient > test/mocks/messaging_service/messaging_service.go
mockgen github.com/influenzanet/logging-service/pkg/api LoggingServiceApiClient > test/mocks/logging_service/logging_service.go
docker:
docker build -t github.com/influenzanet/user-management-service:$(TAG) -f build/docker/Dockerfile $(DOCKER_OPTS) .