-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (47 loc) · 1.94 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
VERSION=$(shell git describe --tags)
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_COMMIT_DATE=$(shell git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
REPO=github.com/bnb-chain/greeenfield-bsc-archiver
IMAGE_NAME=ghcr.io/bnb-chain/greeenfield-bsc-archiver
ldflags = -X $(REPO)/version.AppVersion=$(VERSION) \
-X $(REPO)/version.GitCommit=$(GIT_COMMIT) \
-X $(REPO)/version.GitCommitDate=$(GIT_COMMIT_DATE)
build_syncer:
ifeq ($(OS),Windows_NT)
go build -o build/syncer.exe -ldflags="$(ldflags)" cmd/greeenfield-bsc-archiver-syncer/main.go
else
go build -o build/syncer -ldflags="$(ldflags)" cmd/greeenfield-bsc-archiver-syncer/main.go
endif
build_server:
ifeq ($(OS),Windows_NT)
go build -o build/server.exe -ldflags="$(ldflags)" cmd/greeenfield-bsc-archiver-server/main.go
else
go build -o build/server -ldflags="$(ldflags)" cmd/greeenfield-bsc-archiver-server/main.go
endif
build:
make build_syncer
make build_server
install:
go install cmd/greeenfield-bsc-archiver-server/main.go
go install cmd/greeenfield-bsc-archiver-syncer/main.go
build_docker:
docker build . -t ${IMAGE_NAME}
.PHONY: build install build_docker
###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
golangci_version=v1.51.2
lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m
lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
format:
bash scripts/format.sh
.PHONY: lint lint-fix format
swagger-gen:
swagger generate server -f ./swagger.yaml -A greeenfield-bsc-archiver --default-scheme=http