-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (61 loc) · 2.11 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
include .envrc
.PHONY: run/mono
run/mono:
go run ./cmd/mono -db-dsn=${DATABASE_URL} -cors-trusted-origins=${CORS_TRUSTED_ORIGINS} -jwt-secret=${JWT_SECRET} -smtp-host=${SMTP_HOST} -smtp-password=${SMTP_PASSWORD} -smtp-username=${SMTP_USERNAME}
.PHONY: run/mono/help
run/mono/help:
go run ./cmd/mono/ -help
.PHONY: db/migrations/new
db/migrations/new:
@echo 'Creating migration files for ${name}...'
migrate create -seq -ext=.sql -dir=./migrations ${name}
.PHONY: audit
audit: vendor
@echo 'Formatting code...'
go fmt ./...
@echo 'Vetting code...'
go vet ./...
staticcheck ./...
@echo 'Running tests...'
go test -tags auth ./... -v
.PHONY: ci/cd/audit
ci/cd/audit: vendor
@echo 'Formatting code...'
go fmt ./...
@echo 'Vetting code...'
go vet ./...
staticcheck ./...
.PHONY: vendor
vendor:
@echo 'Tidying and verifying module dependencies...' go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
.PHONY: generate/mono/docs
generate/mono/docs:
@echo 'Remove docs...'
rm -rf docs
@echo 'Generate updated docs folder'
swag init -d cmd/mono,ms/auth/internal/ --parseDependency --parseInternal --parseDepth 2
.PHONY: generate/auth/mocks
generate/auth/mocks:
@echo 'Remove mocks...'
rm -rf ms/auth/internal/domain/mocks
@echo 'Generate updated mocks...'
mockery --all --output=ms/auth/internal/domain/mocks --dir=ms/auth/internal/domain
mockery --all --output=ms/auth/internal/service/mocks --dir=ms/auth/internal/service
.PHONY: run/test/coverage
run/test/coverage:
@echo 'Run test of auth tags and generate coverage.out file'
go test ./... -tags auth -coverprofile=coverage.out
@echo 'Generate coverage.html file'
go tool cover -html=coverage.out -o coverage.html
# ====================================================================================
# # BUILD
# ==================================================================================== #
git_description = $(shell git describe --always --dirty --tags --long)
linker_flags = '-X main.version=${git_description}'
.PHONY: build/mono
build/mono:
@echo 'Building cmd/mono...'
go build -ldflags=${linker_flags} -o=./bin/mono ./cmd/mono