forked from raystack/stencil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (36 loc) · 1.65 KB
/
Makefile
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
NAME="github.com/goto/stencil"
VERSION=$(shell git describe --always --tags 2>/dev/null)
PROTON_COMMIT := "4fb568dd9af09c7efeac3e60fc3a999e239d419a"
EXCLUDE_FILES :=./test_utils/testutils.go
.PHONY: all build test clean dist vet proto install ui
all: build
build: ui ## Build the stencil binary
go build -ldflags "-X config.Version=${VERSION}" ${NAME}
test: ui ## Run the tests
go test ./... -coverprofile=coverage.out
coverage: ui ## Print code coverage
go test -race -coverprofile coverage.txt -covermode=atomic ./... & go tool cover -html=coverage.out
coverage-exclude:
# Run tests and generate coverage profile
go test -race -coverprofile coverage.txt -covermode=atomic ./...
# Filter out coverage data for specified files
@for exclude_file in $(EXCLUDE_FILES); do \
grep -v "$$exclude_file" coverage.out > coverage.tmp && mv coverage.tmp coverage.out; \
done
go tool cover -html=coverage.out
vet: ## Run the go vet tool
go vet ./...
lint: ## Run golang-ci lint
golangci-lint run
proto: ## Generate the protobuf files
@echo " > generating protobuf stub files"
@echo " > [info] make sure correct version of dependencies are installed using 'make install'"
@buf generate https://github.com/goto/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path gotocompany/stencil
@echo " > protobuf compilation finished"
clean: ## Clean the build artifacts
rm -rf stencil dist/ ui/build/
ui:
@echo " > generating ui build"
@cd ui && $(MAKE) dep && $(MAKE) dist
help: ## Display this help message
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'