-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (68 loc) · 1.88 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
81
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=monica
GOINST = $(GOCMD) install
# Default target executed when `make` is called without arguments.
.PHONY: all
all: help
# Installs the dependencies.
.PHONY: build-deps
build-deps:
$(GOINST) "github.com/goreleaser/goreleaser/v2@latest"
# Builds the project.
.PHONY: build
build: generate
$(GOBUILD) -o $(BINARY_NAME) -v
# Runs the project.
.PHONY: run
run:
./$(BiNARY_NAME)
# Tests the project.
.PHONY: test
test: generate
$(GOTEST) -v ./... -cover
# Cleans the project.
.PHONY: clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
# Installs the dependencies.
.PHONY: deps
deps:
$(GOGET) -u ./...
# Format the code.
.PHONY: fmt
fmt:
$(GOCMD) fmt ./...
# Runs static analysis on the code.
.PHONY: lint
lint:
golint ./...
.PHONY: release
release: build-deps pr lint
goreleaser release --rm-dist
.PHONY: pr
pr: generate test fmt
echo "All checks passed"
.PHONY: generate
generate:
$(GOCMD) generate ./...
# Prints help information.
.PHONY: help
help:
@echo "Available targets:"
@echo " all - Runs the 'test' and 'build' targets."
@echo " build - Compiles the project and generates an executable named '$(BINARY_NAME)'."
@echo " run - Executes the compiled binary '$(BINARY_NAME)'."
@echo " test - Runs all tests in the project."
@echo " clean - Cleans up the project by removing the compiled binaries and any temporary files."
@echo " deps - Installs or updates the project dependencies."
@echo " fmt - Formats the Go code according to the Go style guidelines."
@echo " lint - Runs static analysis on the code to identify potential issues."
@echo " build-deps - Installs the dependencies needed to build the project."
@echo " release - Creates a ignition Release."