-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 1.08 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
IMAGE_REGISTRY?=localhost:5000/
IMAGE_VERSION?=latest
IMAGE_NAME?=$(IMAGE_REGISTRY)sriov-metrics-exporter:$(IMAGE_VERSION)
IMAGE_BUILDER?=docker
DOCKERARGS?=
ifdef HTTP_PROXY
DOCKERARGS += --build-arg http_proxy=$(HTTP_PROXY)
endif
ifdef HTTPS_PROXY
DOCKERARGS += --build-arg https_proxy=$(HTTPS_PROXY)
endif
all: build image-build test
clean:
rm -rf bin
go clean -modcache -testcache
build:
GO111MODULE=on go build -ldflags "-s -w" -buildmode=pie -o bin/sriov-exporter cmd/sriov-network-metrics-exporter.go
image-build:
@echo "Bulding container image $(IMAGE_NAME)"
$(IMAGE_BUILDER) build -f Dockerfile -t $(IMAGE_NAME) $(DOCKERARGS) .
image-push:
$(IMAGE_BUILDER) push $(IMAGE_NAME)
test:
go test ./... -count=1
test-coverage:
go test ./... -coverprofile cover.out
go tool cover -func cover.out
go-lint-install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49
go-lint: go-lint-install
go mod tidy
go fmt ./...
golangci-lint run --color always -v ./...
go-lint-report: go-lint-install
golangci-lint run --color always -v ./... &> golangci-lint.txt