-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (67 loc) · 3.11 KB
/
Makefile
File metadata and controls
88 lines (67 loc) · 3.11 KB
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
COMMIT := $(shell git log -1 --format='%H')
VERSION := $(shell echo $(shell git describe --tags --always --dirty --match "v*"))
ldflags = -X jester.noble.xyz/cmd.Version=$(VERSION) \
-X jester.noble.xyz/cmd.Commit=$(COMMIT)
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
###############################################################################
### Build ###
###############################################################################
install:
@echo "🤖 Installing Jester..."
@go install -mod=readonly -ldflags '$(ldflags)' ./cmd/jesterd
@echo "✅ Completed install!"
build:
@echo "🤖 Building jester..."
@go build -ldflags '$(ldflags)' -o "$(PWD)/build/" ./cmd/jesterd
@echo "✅ Completed build!"
###############################################################################
### Docker ###
###############################################################################
docker-build:
@echo "🐳 Building Docker image..."
@docker build -t jesterd:$(VERSION) .
@echo "✅ Completed build!"
docker-run-shell:
@echo "🐳 Running Docker image..."
@docker run --rm -p 9091:9091 -p 2112:2112 -it --entrypoint /bin/sh jesterd
###############################################################################
### Tooling ###
###############################################################################
gofumpt_cmd=mvdan.cc/gofumpt
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/golangci-lint
FILES := $(shell find . -name "*.go" -not -path "./ethereum/abi/*" -not -name "*.pb.go" -not -name "*.connect.go")
license:
@go-license --config .github/license.yml $(FILES)
format:
@echo "🤖 Running formatter..."
@go run $(gofumpt_cmd) -l -w .
@echo "✅ Completed formatting!"
lint:
@echo "🤖 Running linter..."
@go run $(golangci_lint_cmd) run --timeout=10m
@echo "✅ Completed linting!"
###############################################################################
### Protobuf ###
###############################################################################
BUF_VERSION=1.49
proto-all: proto-format proto-lint proto-gen
proto-format:
@echo "🤖 Running protobuf formatter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) format --diff --write
@echo "✅ Completed protobuf formatting!"
proto-gen:
@echo "🤖 Generating code from protobuf..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) generate
@cp -r jester.noble.xyz/* .
@rm -rf jester.noble.xyz
@echo "✅ Completed code generation!"
proto-lint:
@echo "🤖 Running protobuf linter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) lint
@echo "✅ Completed protobuf linting!"
###############################################################################
.PHONY: build license format lint proto-format proto-gen proto-lint