-
Notifications
You must be signed in to change notification settings - Fork 15
/
makefile
77 lines (63 loc) · 1.53 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOTOOL=$(GOCMD) tool
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOINST=$(GOCMD) install
MODULE_NAME=github.com/solrac97gr/go-jwt-auth
# Binary name
BINARY_NAME=main
# Set environment file
set-env:
@cp ./config/env.example.json ./config/env.json
@echo "📡 config file generated: ./config/env.json"
# Build
build:
@$(GOBUILD) -o $(BINARY_NAME) ./cmd/http
@echo "📦 Build Done"
# Clean
clean:
@$(GOCLEAN)
@rm -f $(BINARY_NAME)
@rm -f test.out
@echo "🧹 Program removed"
# Test
test:mocks
@$(GOTEST) -v ./... >> test.out
@echo "🧪 Test Completed"
# Lint
lint:
@golangci-lint run
@echo "🔦 Code Linted"
# Download dependencies
deps:
@$(GOINST) github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
@$(GOINST) go.uber.org/mock/gomock@latest
@$(GOINST) github.com/swaggo/swag/cmd/swag@latest
@$(GOMOD) download
@echo "⬇️ Dependencies downloaded"
# Build and install
install: deps build
@echo "🛡️ Successfully Installed"
# Generate the doc
doc:
@$(GOINST) github.com/swaggo/swag/cmd/swag@latest
@swag init --parseDependency=true -g cmd/http/main.go >> output.out
@rm output.out
@echo "📓 Docs Generated"
# Generate Coverage Report
cover: mocks
@$(GOTEST) -coverprofile=coverage.out ./...
@$(GOTOOL) cover -html=coverage.out
@rm coverage.out
@echo "🎯 Cover profile generated"
# Build and run
run: doc build
@echo "🚀 Running App"
@./$(BINARY_NAME)
mocks:
@echo "🔧 Generating mocks"
@./scripts/generate-mocks.sh