-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (53 loc) · 1.44 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
APP_VERSION ?=v0.5.12
APP_ID ?=git-ops
APP_PORT ?=8080
IMAGE_OWNER ?=$(shell git config --get user.username)
.PHONY: all
all: help
.PHONY: tidy
tidy: ## Updates the go modules and vendors all dependencies
go mod tidy
go mod vendor
.PHONY: test
test: tidy ## Tests the entire project
go test -count=1 -race ./...
.PHONY: run
run: tidy ## Runs uncompiled code
go run main.go
.PHONY: dapr
dapr: tidy ## Runs uncompiled code in Dapr
dapr run \
--app-id gitops \
--app-port $(APP_PORT) \
--app-protocol http \
--components-path ./component \
--log-level debug \
go run main.go
.PHONY: image
image: tidy ## Builds and publish image
docker build \
--build-arg APP_VERSION=$(APP_VERSION) \
--build-arg BUILD_TIME=$(shell date -u +"%Y-%m-%dT%T-UTC") \
-t ghcr.io/$(IMAGE_OWNER)/$(APP_ID):$(APP_VERSION) \
.
docker push ghcr.io/$(IMAGE_OWNER)/$(APP_ID):$(APP_VERSION)
.PHONY: lint
lint: ## Lints the entire project
golangci-lint run --timeout=3m
.PHONY: sync
sync: ## Adds, commits, and pushes the local changes
git add .
git commit -m "new greetings"
git push --all
tag: ## Creates release tag
git tag $(APP_VERSION)
git push origin $(APP_VERSION)
.PHONY: clean
clean: ## Cleans up generated files
go clean
rm -fr ./bin
rm -fr ./vendor
.PHONY: help
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'