-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (40 loc) · 2.25 KB
/
Makefile
File metadata and controls
51 lines (40 loc) · 2.25 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
44
45
46
47
48
49
50
51
GO=go
BUILD_PATH=./bin
GOLANGCI_LINT=$(BUILD_PATH)/golangci-lint
GOLANGCI_LINT_VERSION=v2.1.6
.PHONY: build clean test lint examples single-page-mermaid-examples help docker
build: ## build app
$(GO) build -o $(BUILD_PATH)/messageflow ./cmd/messageflow
clean: ## remove build and clean go cache
$(GO) clean
rm -rf $(BUILD_PATH)
test: ## run tests
$(GO) test ./... -race -v -covermode=atomic -coverprofile=coverage.out
lint: $(GOLANGCI_LINT) ## run linters
$(GOLANGCI_LINT) run
examples: ## create examples
# init
$(GO) run cmd/messageflow/main.go gen-docs \
--asyncapi-files pkg/schema/source/asyncapi/testdata/analytics.yaml,pkg/schema/source/asyncapi/testdata/campaign.yaml,pkg/schema/source/asyncapi/testdata/notification.yaml \
--output examples/docs
# add user service
$(GO) run cmd/messageflow/main.go gen-docs \
--asyncapi-files pkg/schema/source/asyncapi/testdata/analytics.yaml,pkg/schema/source/asyncapi/testdata/campaign.yaml,pkg/schema/source/asyncapi/testdata/notification.yaml,pkg/schema/source/asyncapi/testdata/user.yaml \
--output examples/docs
# new version of analytics service
$(GO) run cmd/messageflow/main.go gen-docs \
--asyncapi-files pkg/schema/source/asyncapi/testdata/analytics_ver2.yaml,pkg/schema/source/asyncapi/testdata/campaign.yaml,pkg/schema/source/asyncapi/testdata/notification.yaml,pkg/schema/source/asyncapi/testdata/user.yaml \
--output examples/docs
single-page-mermaid-examples: ## create single page mermaid examples
$(GO) run cmd/messageflow/main.go gen-docs \
--asyncapi-files pkg/schema/source/asyncapi/testdata/analytics.yaml,pkg/schema/source/asyncapi/testdata/campaign.yaml,pkg/schema/source/asyncapi/testdata/notification.yaml,pkg/schema/source/asyncapi/testdata/user.yaml \
--output examples/single-page-mermaid-docs \
--format mermaid
$(GOLANGCI_LINT): ## install local golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh | sh -s -- -b $(BUILD_PATH) $(GOLANGCI_LINT_VERSION)
docker: ## build docker image
docker build -t messageflow:latest .
# self documenting command
help:
@grep -E '^[a-zA-Z\\._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help