-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (62 loc) · 2.12 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
78
79
80
# === CONFIG =======================================================
PROJECT_NAME="league-of-legends-tactics-cli"
COVER_PROFILE="build/cover.out"
# === BUILD =======================================================
# Generate mocks for interfaces
genmocks:
@echo "---> Generating mocks"
go generate ./...
.PHONY: genmocks
# Build
build-lol-tactics:
@echo "---> Building $(PROJECT_NAME)"
go build -o build/league_of_legends_tactics_cli cmd/$(PROJECT_NAME)/main.go
.PHONY: build-lol-tactics
# === INSTALL =======================================================
install-lol-tactics:
@echo "--> Installing $(PROJECT_NAME)"
@go install ./cmd/league-of-legends-tactics-cli
.PHONY: install-lol-tactics
# === TEST =======================================================
test:
@echo "---> Running all tests"
go test -race -cover -coverprofile=$(COVER_PROFILE) ./...
.PHONY: test
# === CLEAN =======================================================
# Clean lol fights
clean-lol-fights:
@echo "---> Cleaning lol fights"
rm fights/*
.PHONY: clean-lol-fights
# Clean lol champions
clean-lol-champions:
@echo "---> Cleaning lol champions data"
rm champions/lol/*
.PHONY: clean-lol-champions
# === TOOLS =======================================================
# Get a decorated HTML presentation of cover file: showing the covered (green), uncovered (red), and un-instrumented (grey) source.
tool-cover:
go tool cover -html=$(COVER_PROFILE)
.PHONY: tool-cover
# Fix go.mod and go.sum
tool-mod-tidy:
@echo "---> Checking module requirements"
go mod tidy
.PHONY: tool-mod-tidy
# Format go code
tool-fmt:
@echo "---> Formatting code"
go fmt ./...
.PHONY: tool-fmt
# Examine Go source code and reports suspicious constructs
tool-vet:
@echo "---> Checking Go source code"
go vet ./...
.PHONY: tool-vet
# Run application using linters: it runs linters in parallel, uses caching, supports yaml config, etc.
run-lint:
@echo "---> Running linter"
golangci-lint run ./... --timeout=3m
.PHONY: run-lint
# === DEVELOPMENT =======================================================
pre-commit: genmocks tool-mod-tidy tool-fmt build-lol-tactics run-lint tool-vet test