-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
86 lines (65 loc) · 2.63 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.PHONY: help
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
.PHONY: create-certs
create-certs: ## Create containers by docker-compose.
cd gondola/certificates && go run /usr/local/go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost
.PHONY: docker-compose-build
docker-compose-build: ## Build containers by docker-compose.
docker-compose -f docker-compose-local.yml build
.PHONY: docker-compose-up
docker-compose-up: ## Run containers by docker-compose.
docker-compose -f docker-compose-local.yml up
.PHONY: docker-compose-up-d
docker-compose-up-d: ## Run containers in the background by docker-compose.
docker-compose -f docker-compose-local.yml up -d
.PHONY: docker-compose-pull
docker-compose-pull: ## Pull images by docker-compose.
docker-compose -f docker-compose-local.yml pull
.PHONY: setup-buildx
setup-buildx: ## Set up buildx builder.
docker buildx create --name buildx-builder
docker buildx use buildx-builder
.PHONY: build-and-push
build-and-push: ## Build and push image to dockerhub.
docker buildx build --no-cache --push --platform linux/amd64,linux/arm64 --file app/Dockerfile --tag bmfsan/gobel-api app/
.PHONY: tbls
tbls: ## Run tbls for generationg database documents.
docker run --net gobel_link -it --rm -v $$(pwd)/doc:/doc -w /doc/ k1low/tbls:latest doc --force mysql://root:password@gobel-api-mysql:3306/gobel
.PHONY: mod
mod: ## Run go mod download.
cd app && go mod download
.PHONY: install-tools
install-tools: install-go-cleanarch install-staticcheck ## Install tools.
.PHONY: install-go-cleanarch
install-go-cleanarch: ## Install staticcheck.
ifeq ($(shell command -v go-cleanarch 2> /dev/null),)
cd app && go install github.com/roblaszczak/go-cleanarch@latest
endif
.PHONY: install-staticcheck
install-staticcheck: ## Install staticcheck.
ifeq ($(shell command -v staticcheck 2> /dev/null),)
cd app && go install honnef.co/go/tools/cmd/staticcheck@latest
endif
.PHONY: go-cleanarch
go-cleanarch: ## Run go-cleanarch.
cd app && go-cleanarch -application usecase
.PHONY: staticcheck
staticcheck: ## Run staticcheck.
cd app && staticcheck ./...
.PHONY: gofmt
gofmt: ## Run gofmt.
cd app && test -z "$(gofmt -s -l . | tee /dev/stderr)"
.PHONY: vet
vet: ## Run vet.
cd app && go vet -v ./...
.PHONY: test
test: ## Run unit tests.
cd app && go test -v -race ./...
.PHONY: test-cover
test-cover: ## Run unit tests with cover options. ex. make test-cover OUT="c.out"
cd app && go test -v -race -cover -coverprofile=$(OUT) -covermode=atomic ./...
.PHONY: build
build: ## Run go build
cd app && go build