-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (48 loc) · 2.04 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
include .env
export
.PHONY: help
help: ## Display this help screen
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
compose-up: ### Run docker-compose
docker-compose up --build -d && docker-compose logs -f
.PHONY: compose-up
compose-down: ### Down docker-compose
docker-compose down --remove-orphans
.PHONY: compose-down
docker-rm-volume: ### remove docker volume
docker volume rm pg-data
.PHONY: docker-rm-volume
linter-golangci: ### check by golangci linter
golangci-lint run
.PHONY: linter-golangci
linter-hadolint: ### check by hadolint linter
git ls-files --exclude='Dockerfile*' -c --ignored | xargs hadolint
.PHONY: linter-hadolint
migrate-create: ### create new migration
migrate create -ext sql -dir migrations 'account_management'
.PHONY: migrate-create
migrate-up: ### migration up
migrate -path migrations -database '$(PG_URL_LOCALHOST)?sslmode=disable' up
.PHONY: migrate-up
migrate-down: ### migration down
echo "y" | migrate -path migrations -database '$(PG_URL_LOCALHOST)?sslmode=disable' down
.PHONY: migrate-down
test: ### run test
go test -v ./...
cover-html: ### run test with coverage and open html report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
rm coverage.out
.PHONY: coverage-html
cover: ### run test with coverage
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
rm coverage.out
.PHONY: coverage
mockgen: ### generate mock
mockgen -source=internal/service/service.go -destination=internal/mocks/servicemocks/service.go -package=servicemocks
mockgen -source=internal/repo/repo.go -destination=internal/mocks/repomocks/repo.go -package=repomocks
mockgen -source=internal/webapi/webapi.go -destination=internal/mocks/webapimocks/webapi.go -package=webapimocks
.PHONY: mockgen
swag: ### generate swagger docs
swag init -g internal/app/app.go --parseInternal --parseDependency