generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from okp4/feat/logic-spec
📜 Logic module specification
- Loading branch information
Showing
20 changed files
with
2,675 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,13 +99,14 @@ ifeq ($(SHELL_NAME),Darwin) | |
SED_FLAG := "" | ||
endif | ||
|
||
.PHONY: all lint lint-go build build-go help | ||
|
||
.PHONY: all | ||
all: help | ||
|
||
## Lint: | ||
.PHONY: lint | ||
lint: lint-go lint-proto ## Lint all available linters | ||
|
||
.PHONY: lint-go | ||
lint-go: ## Lint go source code | ||
@echo "${COLOR_CYAN}🔍 Inspecting go source code${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -114,6 +115,7 @@ lint-go: ## Lint go source code | |
${DOCKER_IMAGE_GOLANG_CI} \ | ||
golangci-lint run -v | ||
|
||
.PHONY: lint-proto | ||
lint-proto: ## Lint proto files | ||
@echo "${COLOR_CYAN}🔍️ lint proto${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -122,10 +124,18 @@ lint-proto: ## Lint proto files | |
-w /proto \ | ||
${DOCKER_IMAGE_BUF} \ | ||
lint proto -v | ||
@docker run --rm \ | ||
-v ${HOME}/.cache:/root/.cache \ | ||
-v `pwd`:/proto \ | ||
-w /proto \ | ||
${DOCKER_IMAGE_BUF} \ | ||
format -d --exit-code | ||
|
||
## Format: | ||
.PHONY: format | ||
format: format-go ## Run all available formatters | ||
|
||
.PHONY: format-go | ||
format-go: ## Format go files | ||
@echo "${COLOR_CYAN}📐 Formatting go source code${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -135,9 +145,21 @@ format-go: ## Format go files | |
sh -c \ | ||
"go install mvdan.cc/[email protected]; gofumpt -w -l ." | ||
|
||
.PHONY: format-proto | ||
format-proto: ## Format proto files | ||
@echo "${COLOR_CYAN}📐 Formatting proto files${COLOR_RESET}" | ||
@docker run --rm \ | ||
-v ${HOME}/.cache:/root/.cache \ | ||
-v `pwd`:/proto \ | ||
-w /proto \ | ||
${DOCKER_IMAGE_BUF} \ | ||
format -w | ||
|
||
## Build: | ||
.PHONY: build | ||
build: build-go ## Build all available artefacts (executable, docker image, etc.) | ||
|
||
.PHONY: build-go | ||
build-go: ## Build node executable for the current environment (default build) | ||
@echo "${COLOR_CYAN} 🏗️ Building project ${COLOR_RESET}${CMD_ROOT}${COLOR_CYAN}${COLOR_RESET} into ${COLOR_YELLOW}${DIST_FOLDER}${COLOR_RESET}" | ||
@$(call build-go,"","",${DIST_FOLDER}/${BINARY_NAME}) | ||
|
@@ -165,13 +187,16 @@ $(ENVIRONMENTS_TARGETS): | |
|
||
|
||
## Install: | ||
.PHONY: install | ||
install: ## Install node executable | ||
@echo "${COLOR_CYAN} 🚚 Installing project ${BINARY_NAME}${COLOR_RESET}" | ||
@go install ${BUILD_FLAGS} ${CMD_ROOT} | ||
|
||
## Test: | ||
.PHONY: test | ||
test: test-go ## Pass all the tests | ||
|
||
.PHONY: test-go | ||
test-go: build ## Pass the test for the go source code | ||
@echo "${COLOR_CYAN} 🧪 Passing go tests${COLOR_RESET}" | ||
@go test -v -covermode=count -coverprofile ./target/coverage.out ./... | ||
|
@@ -218,11 +243,16 @@ chain-stop: ## Stop the blockchain | |
@killall okp4d | ||
|
||
## Clean: | ||
.PHONY: clean | ||
clean: ## Remove all the files from the target folder | ||
@echo "${COLOR_CYAN} 🗑 Cleaning folder $(TARGET_FOLDER)${COLOR_RESET}" | ||
@rm -rf $(TARGET_FOLDER)/ | ||
|
||
## Proto: | ||
.PHONY: proto | ||
proto: proto-format lint-proto proto-build proto-gen doc-proto ## Generate all resources for proto files (go, doc, etc.) | ||
|
||
.PHONY: proto-format | ||
proto-format: ## Format Protobuf files | ||
@echo "${COLOR_CYAN} 📐 Formatting Protobuf files${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -232,6 +262,7 @@ proto-format: ## Format Protobuf files | |
${DOCKER_IMAGE_BUF} \ | ||
format -w -v | ||
|
||
.PHONY: proto-build | ||
proto-build: ## Build all Protobuf files | ||
@echo "${COLOR_CYAN} 🔨️Build Protobuf files${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -241,6 +272,7 @@ proto-build: ## Build all Protobuf files | |
${DOCKER_IMAGE_BUF} \ | ||
build proto -v | ||
|
||
.PHONY: proto-gen | ||
proto-gen: proto-build ## Generate all the code from the Protobuf files | ||
@echo "${COLOR_CYAN} 📝 Generating code from Protobuf files${COLOR_RESET}" | ||
@docker run --rm \ | ||
|
@@ -287,6 +319,7 @@ doc-command: ## Generate markdown documentation for the command | |
${DOCKER_IMAGE_MARKDOWNLINT} -f $$OUT_FOLDER | ||
|
||
## Release: | ||
.PHONY: release-assets | ||
release-assets: release-binary-all release-checksums ## Generate release assets | ||
|
||
release-binary-all: $(RELEASE_TARGETS) | ||
|
@@ -322,6 +355,7 @@ ensure-buildx-builder: | |
docker buildx create --name ${DOCKER_BUILDX_BUILDER} | ||
|
||
## Help: | ||
.PHONY: help | ||
help: ## Show this help. | ||
@echo '' | ||
@echo 'Usage:' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.