forked from salmane123455/GoAnyBusiness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (63 loc) · 1.6 KB
/
Makefile
File metadata and controls
84 lines (63 loc) · 1.6 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
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
78
79
80
81
82
83
84
.PHONY: run build stop tests quality
APP_ANY_BUSINESS := any-business
# ============================
# Local
# ============================
# //////////////////////
# App (any-business)
# //////////////////////
run:
@go run ./cmd/$(APP_ANY_BUSINESS)/ .
run-reload:
@air -c .air.any-business.toml
build:
@go build -v -o ./bin/any-business ./cmd/any-business
# --------------------------
# Init
# --------------------------
init: update-env-file .install-deps
.install-deps: go-tidy
go-tidy:
@go mod tidy
go-verify:
@go mod verify
install-go-static-check:
@go install honnef.co/go/tools/cmd/staticcheck@latest
@staticcheck --version
update-env-file:
@echo 'Updating .env from .env.example 🖋️...'
@cp .env.example .env
@echo '.env Updated ✨'
# ============================
# Docker
# ============================
# ============================
# CI/CD -- Tests & Code Quality
# ============================
# //////////////////////
# Tests
# //////////////////////
tests: tests-unit
tests-unit:
@go test -v ./... -coverprofile=coverage.out && go tool cover -o coverage.html -html=coverage.out
test-race:
@go test -race ./...
test-specific:
ifndef TEST
@echo "Please provide a test pattern using TEST=<pattern>"
@echo "Example: make test-specific TEST=TestGetEnv/string_tests"
@echo "\nAvailable test patterns:"
@go test ./... -v -list=. | grep "^Test"
else
@go test ./... -v -run $(TEST)
endif
# //////////////////////
# Code Quality
# //////////////////////
quality: go-lint
go-vet:
@go vet ./...
go-static-check:
@staticcheck -f stylish ./...
go-lint:
@golangci-lint run --fix