-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1.17 KB
/
Makefile
File metadata and controls
43 lines (32 loc) · 1.17 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
BINARY := mugo
MAIN_FILE := cmd/$(BINARY)/main.go
PKG := $(shell go list -m)
VERSION := $(or $(IMAGE_TAG),$(shell git describe --tags --first-parent --match "v*" 2> /dev/null || echo v0.0.0))
LOCAL_BIN_DIR := $(PWD)/bin
.DEFAULT_GOAL := help
.PHONY: run
run: ## Run the application
go run $(MAIN_FILE)
.PHONY: docs-view
docs-view: ## Docs dev
cd _documents && pnpm run docs:dev
.PHONY: test-data
test-data: ## Run the application
go run $(MAIN_FILE) -d @testdata/data/input.yaml testdata/test.tpl
.PHONY: build
build: ## Build the binary file
goreleaser build --snapshot --clean --single-target
.PHONY: lint
lint: ## Lint Go files
@golangci-lint --version
@GOPATH="$(shell dirname $(PWD))" golangci-lint run ./...
.PHONY: lint-main
lint-main: ## Lint Go files with main branch diff
@golangci-lint --version
@GOPATH="$(shell dirname $(PWD))" golangci-lint run --new-from-rev main ./...
.PHONY: test
test: ## Run unit tests
@go test -v -race -cover -coverpkg=./... -covermode=atomic ./...
.PHONY: help
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'