Skip to content

Commit d4c0fdc

Browse files
committed
build(project): summarize go test results (using tparse)
1 parent 8627473 commit d4c0fdc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ BINARY_NAME = axoned
55
TARGET_FOLDER = target
66
DIST_FOLDER = $(TARGET_FOLDER)/dist
77
RELEASE_FOLDER = $(TARGET_FOLDER)/release
8+
TOOLS_FOLDER = $(TARGET_FOLDER)/tools
89
CMD_ROOT :=./cmd/${BINARY_NAME}
910
LEDGER_ENABLED ?= true
1011

@@ -19,6 +20,12 @@ DOCKER_BUILDX_BUILDER = axone-builder
1920
DOCKER_IMAGE_MARKDOWNLINT = thegeeklab/markdownlint-cli:0.32.2
2021
DOCKER_IMAGE_GOTEMPLATE = hairyhenderson/gomplate:v3.11.3-alpine
2122

23+
# Tools
24+
TOOL_TPARSE_NAME := tparse
25+
TOOL_TPARSE_VERSION := v0.16.0
26+
TOOL_TPARSE_PKG := github.com/mfridman/$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)
27+
TOOL_TPARSE_BIN := ${TOOLS_FOLDER}/$(TOOL_TPARSE_NAME)/$(TOOL_TPARSE_VERSION)/$(TOOL_TPARSE_NAME)
28+
2229
# Some colors
2330
COLOR_GREEN = $(shell tput -Txterm setaf 2)
2431
COLOR_YELLOW = $(shell tput -Txterm setaf 3)
@@ -190,9 +197,9 @@ install: ## Install node executable
190197
test: test-go ## Pass all the tests
191198

192199
.PHONY: test-go
193-
test-go: build ## Pass the test for the go source code
200+
test-go: $(TOOL_TPARSE_BIN) build ## Pass the test for the go source code
194201
@echo "${COLOR_CYAN} 🧪 Passing go tests${COLOR_RESET}"
195-
@go test -v -coverprofile ./target/coverage.txt ./...
202+
@go test -v -coverprofile ./target/coverage.txt ./... -json | $(TOOL_TPARSE_BIN)
196203

197204
## Chain:
198205
chain-init: build ## Initialize the blockchain with default settings.
@@ -409,6 +416,15 @@ ensure-buildx-builder:
409416
@docker buildx ls | sed '1 d' | cut -f 1 -d ' ' | grep -q ${DOCKER_BUILDX_BUILDER} || \
410417
docker buildx create --name ${DOCKER_BUILDX_BUILDER}
411418

419+
## Dependencies:
420+
.PHONY: deps
421+
deps: $(TOOL_TPARSE_BIN) ## Install all the dependencies (tools, etc.)
422+
423+
$(TOOL_TPARSE_BIN):
424+
@echo "${COLOR_CYAN} 📦 Installing ${COLOR_GREEN}$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)${COLOR_CYAN}...${COLOR_RESET}"
425+
@mkdir -p $(dir $(TOOL_TPARSE_BIN))
426+
@GOBIN=$(dir $(abspath $(TOOL_TPARSE_BIN))) go install $(TOOL_TPARSE_PKG)
427+
412428
## Help:
413429
.PHONY: help
414430
help: ## Show this help.

0 commit comments

Comments
 (0)