-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (51 loc) · 1.34 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
# Use bash syntax
SHELL=/bin/bash
# Go parameters
GOCMD=go
GOBINPATH=$(shell $(GOCMD) env GOPATH)/bin
GOMOD=$(GOCMD) mod
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=gotestsum
GOGET=$(GOCMD) get
GOINSTALL=$(GOCMD) install
GOTOOL=$(GOCMD) tool
GOFMT=$(GOCMD) fmt
GIT_TAG=$(shell git describe --abbrev=0 --tags)
GIT_COMMIT=$(shell git rev-parse --short HEAD)
.PHONY: FORCE
.PHONY: all
all: fmt lint test build go.mod
.PHONY: build
build:
go generate ./...
go build -v -ldflags="-s -w -X 'github.com/sundowndev/cloudping/cmd/cloudping/internal/build.version=${GIT_TAG}' -X 'github.com/sundowndev/cloudping/cmd/cloudping/internal/build.commit=${GIT_COMMIT}'" -o ./bin/cloudping ./cmd/cloudping
.PHONY: test
test:
$(GOTEST) --format testname --junitfile unit-tests.xml -- -mod=readonly -race -coverprofile=./c.out -covermode=atomic -coverpkg=.,./... ./...
.PHONY: coverage
coverage: test
$(GOTOOL) cover -func=c.out
#.PHONY: mocks
#mocks:
# rm -rf mocks
# mockery --all
.PHONY: fmt
fmt:
$(GOFMT) ./...
.PHONY: clean
clean:
$(GOCLEAN)
rm -f bin/*
.PHONY: lint
lint:
gocritic check ./...
.PHONY: install-tools
install-tools:
$(GOINSTALL) -v github.com/go-critic/go-critic/cmd/gocritic@v0.9.0
$(GOINSTALL) gotest.tools/gotestsum@v1.6.3
#$(GOINSTALL) github.com/vektra/mockery/v2@v2.16.0
go.mod: FORCE
$(GOMOD) tidy
$(GOMOD) verify
go.sum: go.mod