This repository has been archived by the owner on Apr 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
147 lines (123 loc) · 5.14 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
# Copyright SecureKey Technologies Inc.
#
# SPDX-License-Identifier: Apache-2.0
ADAPTER_REST_PATH=cmd/adapter-rest
# Namespace for the agent images
DOCKER_OUTPUT_NS ?= ghcr.io
ADAPTER_REST_BASE_IMAGE_NAME ?= trustbloc/edge-adapter/adapter-base
ISSUER_ADAPTER_REST_IMAGE_NAME ?= trustbloc/issuer-adapter
RP_ADAPTER_REST_IMAGE_NAME ?= trustbloc/rp-adapter
MOCK_ISSUER_IMAGE_NAME ?= trustbloc/edge-adapter/mock-issuer
MOCK_ISSUER_LOGIN_CONSENT_IMAGE_NAME ?= trustbloc/edge-adapter/mock-issuer-login-consent
MOCK_WEBHOOK_IMAGE_NAME ?= trustbloc/edge-adapter/mock-webhook
# Tool commands (overridable)
ALPINE_VER ?= 3.15
GO_VER ?= 1.17
GOBIN_PATH=$(abspath .)/.build/bin
.PHONY: all
all: checks unit-test bdd-test
.PHONY: checks
checks: license lint
.PHONY: lint
lint:
@scripts/check_lint.sh
.PHONY: license
license:
@scripts/check_license.sh
.PHONY: issuer-adapter-vue
issuer-adapter-vue:
@echo "Building issuer-adapter-vue frontend"
@mkdir -p ./.build/bin/issuer-adapter-vue
@npm --prefix cmd/issuer-adapter-vue install
@npm --prefix cmd/issuer-adapter-vue run build
@cp -rp cmd/issuer-adapter-vue/dist/* ./.build/bin/issuer-adapter-vue
.PHONY: rp-adapter-vue
rp-adapter-vue:
@echo "Building rp-adapter-vue frontend"
@mkdir -p ./.build/bin/rp-adapter-vue
@npm --prefix cmd/rp-adapter-vue install
@npm --prefix cmd/rp-adapter-vue run build
@cp -rp cmd/rp-adapter-vue/dist/* ./.build/bin/rp-adapter-vue
.PHONY: adapter-rest
adapter-rest:
@echo "Building adapter-rest"
@mkdir -p ./.build/bin
@GO111MODULE=off GOBIN=$(GOBIN_PATH) go get github.com/myitcv/gobin
@cd ${ADAPTER_REST_PATH} && go build -o ../../.build/bin/adapter-rest main.go
.PHONY: adapter-rest-docker-base
adapter-rest-docker-base:
@echo "Building adapter rest docker base image"
@docker build -f ./images/adapter-rest-base/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(ADAPTER_REST_BASE_IMAGE_NAME):latest \
--build-arg GO_VER=$(GO_VER) \
--build-arg ALPINE_VER=$(ALPINE_VER) .
.PHONY: issuer-adapter-rest-docker
issuer-adapter-rest-docker: adapter-rest-docker-base issuer-adapter-vue
@echo "Building issuer adapter rest docker image"
@docker build -f ./images/issuer-adapter-rest/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(ISSUER_ADAPTER_REST_IMAGE_NAME):latest \
--build-arg ALPINE_VER=$(ALPINE_VER) .
.PHONY: rp-adapter-rest-docker
rp-adapter-rest-docker: adapter-rest-docker-base rp-adapter-vue
@echo "Building rp adapter rest docker image"
@docker build -f ./images/rp-adapter-rest/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(RP_ADAPTER_REST_IMAGE_NAME):latest \
--build-arg ALPINE_VER=$(ALPINE_VER) .
.PHONY: unit-test
unit-test:
@scripts/check_unit.sh
.PHONY: bdd-test
bdd-test: clean rp-adapter-rest-docker issuer-adapter-rest-docker mock-issuer-docker mock-webhook-docker mock-issuer-login-consent-docker generate-test-keys
@scripts/check_integration.sh
# TODO (#675): frapsoft/openssl only has an amd64 version. While this does work under amd64 and arm64 Mac OS currently,
# we should add an arm64 version for systems that can only run arm64 code.
.PHONY: generate-test-keys
generate-test-keys: clean
@mkdir -p -p test/bdd/fixtures/keys/tls
@docker run -i --platform linux/amd64 --rm \
-v $(abspath .):/opt/workspace/edge-adapter \
--entrypoint "/opt/workspace/edge-adapter/scripts/generate_test_keys.sh" \
frapsoft/openssl
.PHONY: mock-issuer
mock-issuer:
@echo "Building mock issuer server"
@mkdir -p ./.build/bin
@go build -o ./.build/bin/issuer-server test/mock/cmd/issuer/main.go
.PHONY: mock-issuer-docker
mock-issuer-docker:
@echo "Building mock issuer server docker image"
@docker build -f ./test/mock/images/issuer/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(MOCK_ISSUER_IMAGE_NAME):latest \
--build-arg GO_VER=$(GO_VER) \
--build-arg ALPINE_VER=$(ALPINE_VER) \
--build-arg GO_TAGS=$(GO_TAGS) \
--build-arg GOPROXY=$(GOPROXY) .
.PHONY: mock-issuer-login-consent
mock-issuer-login-consent:
@echo "Building mock issuer login&consent server"
@mkdir -p ./.build/bin
@go build -o ./.build/bin/issuer-login-consent-server test/mock/cmd/issuer-login-consent/main.go
.PHONY: mock-issuer-login-consent-docker
mock-issuer-login-consent-docker:
@echo "Building mock issuer login&consent server docker image"
@docker build -f ./test/mock/images/issuer-login-consent/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(MOCK_ISSUER_LOGIN_CONSENT_IMAGE_NAME):latest \
--build-arg GO_VER=$(GO_VER) \
--build-arg ALPINE_VER=$(ALPINE_VER) \
--build-arg GO_TAGS=$(GO_TAGS) \
--build-arg GOPROXY=$(GOPROXY) .
.PHONY: mock-webhook
mock-webhook:
@echo "Building mock webhook server"
@mkdir -p ./build/bin
@go build -o ./build/bin/webhook-server test/mock/cmd/webhook/main.go
.PHONY: mock-webhook-docker
mock-webhook-docker:
@echo "Building mock webhook server docker image"
@docker build -f ./test/mock/images/webhook/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(MOCK_WEBHOOK_IMAGE_NAME):latest \
--build-arg GO_VER=$(GO_VER) \
--build-arg ALPINE_VER=$(ALPINE_VER) \
--build-arg GO_TAGS=$(GO_TAGS) \
--build-arg GOPROXY=$(GOPROXY) .
.PHONY: clean
clean: clean-build
.PHONY: clean-build
clean-build:
@rm -Rf ./.build
@rm -Rf ./test/bdd/fixtures/keys/tls
@rm -Rf ./test/bdd/docker-compose.log