This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 283
/
Makefile
executable file
·98 lines (73 loc) · 2.87 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
.DEFAULT_GOAL := help
##
## Global ENV vars
##
GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
GIT_TAG ?= $(shell git describe --tags --abbrev=0)
##
## Helpful Help
##
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
##
## Building
##
.PHONY: ios_framework
ios_framework: ## Build iOS Framework for mobile
gomobile bind -target=ios/arm64,ios/amd64 -iosversion=10 -ldflags="-s -w" github.com/OpenBazaar/openbazaar-go/mobile
.PHONY: android_framework
android_framework: ## Build Android Framework for mobile
gomobile bind -target=android/arm,android/arm64,android/amd64 -ldflags="-s -w" github.com/OpenBazaar/openbazaar-go/mobile
##
## Protobuf compilation
##
P_TIMESTAMP = Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp
P_ANY = Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any
PKGMAP = $(P_TIMESTAMP),$(P_ANY)
.PHONY: protos
protos: ## Build go files for proto definitions
cd pb/protos && PATH=$(PATH):$(GOPATH)/bin protoc --go_out=$(PKGMAP):.. *.proto
##
## Testing
##
OPENBAZAARD_NAME ?= openbazaard-$(GIT_SHA)
BITCOIND_PATH ?= .
.PHONY: openbazaard
openbazaard: ## Build daemon
$(info "Building openbazaar daemon...")
go build -o ./$(OPENBAZAARD_NAME) .
.PHONY: qa_test
qa_test: openbazaard ## Run QA test suite against current working copy
$(info "Running QA... (openbazaard: ../$(OPENBAZAARD_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
(cd qa && ./runtests.sh ../$(OPENBAZAARD_NAME) $(BITCOIND_PATH)/bin/bitcoind)
.PHONY: qa_eth_test
qa_eth_test: openbazaard ## Run ETH-based QA test suite against current working copy
$(info "Running ETH QA... (openbazaard: ../$(OPENBAZAARD_NAME))")
(cd qa && ./runtests_eth.sh ../$(OPENBAZAARD_NAME))
##
## Docker
##
PUBLIC_DOCKER_REGISTRY ?= openbazaar
QA_DEV_TAG ?= 0.10
DOCKER_SERVER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server:$(GIT_TAG)
DOCKER_QA_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-qa:$(QA_DEV_TAG)
DOCKER_DEV_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-dev:$(QA_DEV_TAG)
.PHONY: docker_build
docker_build: ## Build container for daemon
docker build -t $(DOCKER_SERVER_IMAGE_NAME) .
.PHONY: docker_push
docker_push: docker ## Push container for daemon
docker push $(DOCKER_SERVER_IMAGE_NAME)
.PHONY: qa_docker_build
qa_docker_build: ## Build container with QA test dependencies included
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .
.PHONY: qa_docker_push
qa_docker_push: qa_docker_build ## Push container for daemon QA test environment
docker push $(DOCKER_QA_IMAGE_NAME)
.PHONY: dev_docker_build
dev_docker: ## Build container with dev dependencies included
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .
.PHONY: dev_docker_push
dev_docker_push: dev_docker_build ## Push container for daemon dev environment
docker push $(DOCKER_DEV_IMAGE_NAME)