Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ go-cache: verify
@go mod download
@printf '$(C_GREEN)✅ Downloaded and cached dependencies successfully$(C_RESET)\n\n'

## Install the binary
install: go-cache
@printf '$(C_CYAN)🔄 Installing safrochaind ...$(C_RESET)\n'
@go install $(BUILD_FLAGS) -mod=readonly ./cmd/safrochaind
Expand All @@ -134,6 +135,7 @@ install: go-cache
SUMMARY_BIN="$$INSTALL_DIR/safrochaind" \
SUMMARY_RUN="safrochaind"

## Build the project binary
build: go-cache
@printf '$(C_CYAN)🔄 Building safrochaind ...$(C_RESET)\n'
@if [ "$(OS)" = "Windows_NT" ]; then \
Expand Down Expand Up @@ -175,6 +177,7 @@ install-lint:
@echo "✅ - Installed golangci-lint successfully!"
@echo ""

## Run linters
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
INSTALLED=$$(golangci-lint version | head -n1 | awk '{print $$4}'); \
Expand All @@ -191,6 +194,7 @@ lint:
@golangci-lint run
@echo "✅ - Linted code successfully!"

## Format source code
format:
@if command -v gofumpt >/dev/null 2>&1; then \
INSTALLED=$$(go version -m $$(command -v gofumpt) | awk '$$1=="mod" {print $$3; exit}'); \
Expand Down Expand Up @@ -298,6 +302,7 @@ protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace -v /var/run/docker.sock:/v

proto-all: proto-format proto-lint proto-gen proto-gen-2 proto-swagger-gen

## Generate protobuf code
proto-gen:
@echo "🛠️ - Generating Protobuf"
@$(protoImage) sh ./scripts/protoc/protocgen.sh
Expand All @@ -308,6 +313,7 @@ proto-gen-2:
@$(protoImage) sh ./scripts/protoc/protocgen2.sh
@echo "✅ - Generated Protobuf v2 successfully!"

## Generate Swagger from protobuf
proto-swagger-gen:
@echo "📖 - Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc/protoc-swagger-gen.sh
Expand All @@ -318,6 +324,7 @@ proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
@echo "✅ - Formatted Protobuf successfully!"

## Lint protobuf files
proto-lint:
@echo "🔎 - Linting Protobuf"
@$(protoImage) buf lint --error-format=json
Expand All @@ -329,3 +336,7 @@ proto-check-breaking:
@echo "✅ - Checked Protobuf changes successfully!"

.PHONY: proto-all proto-gen proto-gen-2 proto-swagger-gen proto-format proto-lint proto-check-breaking

## help: Show this help message
help:
@grep -E '^[a-zA-Z_-]+:.*##' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'