-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 1.1 KB
/
Makefile
File metadata and controls
47 lines (36 loc) · 1.1 KB
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
BIN_DIR = ./bin
TOOLS_DIR := $(BIN_DIR)/dev-tools
BINARY_NAME = k8s-webhook
WEBHOOK_DOCKER_IMAGE_NAME=newrelic/k8s-webhook
WEBHOOK_DOCKER_IMAGE_TAG=latest
GOLANGCILINT_VERSION = 1.12
# required for enabling Go modules inside $GOPATH
export GO111MODULE=on
.PHONY: all
all: build
.PHONY: build
build: lint test build-container
$(TOOLS_DIR):
@mkdir -p $@
$(TOOLS_DIR)/golangci-lint: $(TOOLS_DIR)
@echo "[tools] Downloading 'golangci-lint'"
@wget -O - -q https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINDIR=$(@D) sh -s v$(GOLANGCILINT_VERSION) > /dev/null 2>&1
.PHONY: lint
lint: $(TOOLS_DIR)/golangci-lint
@echo "[validate] Validating source code running golangci-lint"
@$(TOOLS_DIR)/golangci-lint run
.PHONY: build-container
build-container:
docker build -t $(WEBHOOK_DOCKER_IMAGE_NAME):$(WEBHOOK_DOCKER_IMAGE_TAG) .
.PHONY: test
test:
@echo "[test] Running unit tests"
@go test ./...
.PHONY: e2e-test
e2e-test:
@echo "[test] Running e2e tests"
./e2e-tests/tests.sh
.PHONY: benchmark-test
benchmark-test:
@echo "[test] Running benchmark tests"
@go test -run=^Benchmark* -bench .