-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (55 loc) · 1.91 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.DEFAULT_GOAL := help
VERSION := $(shell git describe --tags --always --dirty --match "v[0-9]+(\.[0-9]+)*(-.*)*")
.PHONY: help
help: ## Show help
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: version
version:
@echo "${VERSION}"
.PHONY: test
test: ## Runs all tests
@./test.sh
.PHONY: generate
generate: build ## Regenerates all files
@PATH="$(PWD)/bin:$(PATH)" conflow generate --local github.com/conflowio/conflow
.PHONY: go-generate
go-generate: ## Runs go generate
go generate ./...
${MAKE} goimports
.PHONY: build
build: bin/conflow ## Build the conflow binary
bin/conflow:
@echo "Building bin/conflow"
@go version
GOBIN="$(PWD)/bin" go install -ldflags="-s -w -X github.com/conflowio/conflow/pkg/conflow.Version=${VERSION}" ./cmd/conflow/
.PHONY: clean
clean: ## Clean all built files
@rm -rf bin
.PHONY: clean-generated
clean-generated: ## Delete all generated files created by conflow
@find . -name "*.cf.go" -type f -delete
.PHONY: goimports
goimports: ## Run goimports on all files
@echo "Running goimports on all files"
@./scripts/goimports.sh
.PHONY: lint
lint: ## Runs linting checks
@echo "Running lint checks"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./...
.PHONY: update-dependencies
update-dependencies: ## Updates all dependencies
@echo "Updating Go dependencies"
@cat go.mod | grep -E "^\t" | grep -v "// indirect" | cut -f 2 | cut -d ' ' -f 1 | xargs -n 1 -t go get -d -u
@go mod vendor
@go mod tidy
.PHONY: check
check: lint check-generate check-goimports check-go-generate ## Runs various code checks
.PHONY: check-generate
check-generate:
@ scripts/check_git_changes.sh make generate
.PHONY: check-goimports
check-goimports:
@ scripts/check_git_changes.sh make goimports
.PHONY: check-go-generate
check-go-generate:
@ scripts/check_git_changes.sh make go-generate