-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 2.39 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
GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only))
GIT_VERSION := $(shell git rev-parse HEAD)
BIN_VERSION := $(GIT_VERSION)|$(GIT_DATE)
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
PPV_PRIVATE_KEY_1 := $(shell cat $(CUR_DIR)/eth/keys/ppv_private_key_1)
PPV_PRIVATE_KEY_2 := $(shell cat $(CUR_DIR)/eth/keys/ppv_private_key_2)
PPV_PRIVATE_KEY_3 := $(shell cat $(CUR_DIR)/eth/keys/ppv_private_key_3)
.PHONY: server
run:
go run -ldflags "-X github.com/javiercbk/ppv-crypto/server/http/response.serverVersion=$(BIN_VERSION)" $(CUR_DIR)/server/cmd/server/server.go
server:
go build -ldflags "-X github.com/javiercbk/ppv-crypto/server/http/response.serverVersion=$(BIN_VERSION)" -o $(CUR_DIR)/binaries/server $(CUR_DIR)/server/cmd/server/server.go
build-server: lint
go build -ldflags "-X github.com/javiercbk/ppv-crypto/server/http/response.serverVersion=$(BIN_VERSION)" $(CUR_DIR)/server/cmd/server/server.go
# re-builds the sql boiler models
sql-boiler: clean-sql-boiler
cd $(GOPATH)/bin;\
$(GOPATH)/bin/sqlboiler --no-hooks --struct-tag-casing camel --no-tests -c $(CUR_DIR)/server/database.toml -o $(CUR_DIR)/server/models psql
# removes the autogenerated sql boiler files
clean-sql-boiler:
rm -rf $(CUR_DIR)/server/models/*
# remove unused dependencies and tidy up modules
mod-tydy:
cd $(CUR_DIR)/server
go mod tidy
# lints the project
lint:
cd $(CUR_DIR)/server
$(GOPATH)/bin/golangci-lint run
# outputs the current version
version:
@echo "$(BIN_VERSION)"
test:
$(CUR_DIR)/server
go test ./...
# generates the golang binding for the solidity contract
contract-binding:
cd $(CUR_DIR)
$(CUR_DIR)/ppv-contract/node_modules/.bin/solcjs --optimize --abi ./ppv-contract/contracts/PPVEvent.sol
$(CUR_DIR)/ppv-contract/node_modules/.bin/solcjs --optimize --bin ./ppv-contract/contracts/PPVEvent.sol
abigen --abi="__ppv-contract_contracts_PPVEvent_sol_PPVEvent.abi" --pkg="ppvevent" --out="$(CUR_DIR)/server/cryptocurrency/eth/ppvevent/ppv-event.go" --bin="__ppv-contract_contracts_PPVEvent_sol_PPVEvent.bin"
cp __ppv-contract_contracts_PPVEvent_sol_PPVEvent.abi crypto-frontend/src/lib/abi/ppv_abi.json
rm ./*ppv-contract_contracts_PPVEvent_sol_*
start-docker-stack:
cd $(CUR_DIR)
PPV_PRIVATE_KEY_1=$(PPV_PRIVATE_KEY_1) PPV_PRIVATE_KEY_2=$(PPV_PRIVATE_KEY_2) PPV_PRIVATE_KEY_3=$(PPV_PRIVATE_KEY_3) docker-compose up