-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
41 lines (32 loc) · 900 Bytes
/
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
.DEFAULT_GOAL := help
TEST_FLAGS ?= -race
PKGS ?= $(shell go list ./... | grep -v /vendor/)
BINARY := pod-image-swap-webhook
IMAGE ?= pod-image-swap-webhook
TAG ?= latest
.PHONY: all clean
.PHONY: help
help:
@grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "[32m%-12s[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## build pod-image-swap-webhook
go build \
-ldflags "-s -w" \
-o $(BINARY) \
main.go
.PHONY: docker-build
docker-build: ## build docker image
docker build -t $(IMAGE):$(TAG) .
.PHONY: test
test: ## run tests
go test $(TEST_FLAGS) $(PKGS)
.PHONY: vet
vet: ## run go vet
go vet $(PKGS)
.PHONY: coverage
coverage: ## generate code coverage
go test $(TEST_FLAGS) -covermode=atomic -coverprofile=coverage.txt $(PKGS)
go tool cover -func=coverage.txt
.PHONY: lint
lint: ## run golangci-lint
golangci-lint run