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 10
/
Makefile
79 lines (63 loc) · 1.93 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
# Copyright SecureKey Technologies Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Namespace for the docker images
DOCKER_OUTPUT_NS ?= ghcr.io
DOCKER_IMAGE_NAME ?= trustbloc/mediator
MOCK_WEBHOOK_IMAGE_NAME ?= trustbloc/mock-webhook
# Tool commands (overridable)
ALPINE_VER ?= 3.12
GO_VER ?= 1.16
.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: unit-test
unit-test:
@scripts/check_unit.sh
.PHONY: bdd-test
bdd-test: clean test-keys mediator-docker mock-webhook-docker
@scripts/check_integration.sh
.PHONY: test-keys
test-keys: clean
@mkdir -p -p test/bdd/fixtures/keys/tls
@docker run -i --rm \
-v $(abspath .):/opt/workspace/mediator \
--entrypoint "/opt/workspace/mediator/scripts/generate_test_keys.sh" \
frapsoft/openssl
.PHONY: mediator-docker
mediator-docker:
@echo "Building mediator docker image"
@docker build -f ./images/mediator/Dockerfile --no-cache \
-t $(DOCKER_OUTPUT_NS)/$(DOCKER_IMAGE_NAME):latest \
--build-arg ALPINE_VER=$(ALPINE_VER) \
--build-arg GO_VER=$(GO_VER) .
.PHONY: mediator
mediator:
@echo "Building mediator"
@mkdir -p ./.build/bin
@cd cmd/mediator && go build -o ../../.build/bin/mediator main.go
.PHONY: mock-webhook
mock-webhook:
@echo "Building mock webhook server"
@mkdir -p ./build/bin
@cd test/mock/cmd/webhook && go build -o ../../../../build/bin/webhook-server ./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:
@rm -Rf ./.build
@rm -Rf ./test/bdd/fixtures/keys/tls
@rm -Rf ./test/bdd/docker-compose.log