-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (45 loc) · 1.42 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
.PHONY: init
init:
go install github.com/google/wire/cmd/wire@latest
go install github.com/golang/mock/mockgen@latest
go install github.com/swaggo/swag/cmd/swag@latest
go install github.com/air-verse/air@latest
go install github.com/go-nunu/nunu@latest
.PHONY: bootstrap
bootstrap:
cd ./deploy/docker-compose && docker compose up -d && cd ../../
go run ./cmd/migration
nunu run ./cmd/server
.PHONY: mock
mock:
mockgen -source=internal/service/user.go -destination test/mocks/service/user.go
mockgen -source=internal/repository/user.go -destination test/mocks/repository/user.go
mockgen -source=internal/repository/repository.go -destination test/mocks/repository/repository.go
.PHONY: test
test:
go test -coverpkg=./internal/handler,./internal/service,./internal/repository -coverprofile=./coverage.out ./test/server/...
go tool cover -html=./coverage.out -o coverage.html
.PHONY: build
build:
go build -ldflags="-s -w" -o ./bin/server ./cmd/server
.PHONY: docker
docker:
docker build -f deploy/build/Dockerfile --build-arg APP_RELATIVE_PATH=./cmd/job -t 1.1.1.1:5000/demo-job:v1 .
docker run --rm -i 1.1.1.1:5000/demo-job:v1
.PHONY: swag
swag:
swag init -g cmd/server/main.go -o ./docs --parseDependency
.PHONY: run
run: migrate
go run cmd/server/main.go
.PHONY: migrate
migrate:
go run cmd/migration/main.go
.PHONY: dev
dev:
air
.PHONY: wire
wire:
wire ./cmd/server/wire
wire ./cmd/migration/wire
wire ./cmd/task/wire