-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (38 loc) · 1.27 KB
/
Makefile
File metadata and controls
50 lines (38 loc) · 1.27 KB
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
APP_NAME=storage-provider
CMD_PATH=./cmd/api
GO=go
COVER_PROFILE=coverage.out
COVER_HTML=coverage.html
.PHONY: help all build run clean swag tidy test test-coverage coverage coverage-func
help: ## Display this help message
@echo "Available targets:"
@echo " make build - Build the application"
@echo " make run - Run the application"
@echo " make test - Run all tests"
@echo " make test-coverage - Run tests with coverage report"
@echo " make coverage - Alias for test-coverage"
@echo " make coverage-func - Show coverage by function"
@echo " make swag - Generate swagger documentation"
@echo " make tidy - Tidy go.mod"
@echo " make clean - Clean build artifacts"
all: build
build:
$(GO) build -o $(APP_NAME) $(CMD_PATH)
run:
$(GO) run $(CMD_PATH)
swag:
swag init -g cmd/api/main.go
tidy:
$(GO) mod tidy
test:
$(GO) test -v -race ./tests/...
test-coverage:
$(GO) test -v -race -coverprofile=$(COVER_PROFILE) -covermode=atomic -coverpkg=./internal/... ./tests/...
$(GO) tool cover -html=$(COVER_PROFILE) -o $(COVER_HTML)
coverage: test-coverage
coverage-func:
$(GO) tool cover -func=$(COVER_PROFILE)
clean:
$(GO) clean
rm -f $(APP_NAME) $(APP_NAME).exe
rm -f $(COVER_PROFILE) $(COVER_HTML)