-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
47 lines (37 loc) · 1.5 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
VERSION := $(shell git describe --tags --always)
GITREV := $(shell git rev-parse --short HEAD)
GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD)
DATE := $(shell LANG=US date +"%a, %d %b %Y %X %z")
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/dist
GOARCH := $(ARCH)
GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(GOARCH)
GOBINARY := lagrange-cli
GOCMD := $(GOBASE)/cmd/
LDFLAGS += -X 'github.com/Lagrange-Labs/client-cli.Version=$(VERSION)'
LDFLAGS += -X 'github.com/Lagrange-Labs/client-cli.GitRev=$(GITREV)'
LDFLAGS += -X 'github.com/Lagrange-Labs/client-cli.GitBranch=$(GITBRANCH)'
LDFLAGS += -X 'github.com/Lagrange-Labs/client-cli.BuildDate=$(DATE)'
STOP := docker compose down --remove-orphans
# Building the docker image and the binary
build: ## Builds the binary locally into ./dist
$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)
.PHONY: build
# Useful and Test Scripts
scgen: # Generate the go bindings for the smart contracts
@ cd scinterface && sh generator.sh
# Linting, Teseting, Benchmarking
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/[email protected]
install-linter:
@echo "--> Installing linter"
@go install $(golangci_lint_cmd)
lint:
@echo "--> Running linter"
@ $$(go env GOPATH)/bin/golangci-lint run --timeout=10m
.PHONY: lint install-linter
test:
trap '$(STOP)' EXIT; go test ./... --timeout=10m
.PHONY: test
docker-build: ## Builds a docker image with the cli binary
docker build -t lagrange-cli -f ./Dockerfile .
.PHONY: docker-build