-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (60 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
74 lines (60 loc) · 1.71 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
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
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
PROJECT := external-dns-poweradmin-webhook
DOCKER_IMAGE ?= poweradmin/$(PROJECT)
LDFLAGS := -s -w \
-X main.Version=$(VERSION)
.PHONY: all
all: build
.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o $(PROJECT) ./cmd/webhook
.PHONY: test
test:
go test -v -race -coverprofile=coverage.out ./...
.PHONY: lint
lint:
golangci-lint run ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: clean
clean:
rm -f $(PROJECT)
rm -f coverage.out
.PHONY: docker-build
docker-build:
docker build -t $(DOCKER_IMAGE):$(VERSION) .
docker tag $(DOCKER_IMAGE):$(VERSION) $(DOCKER_IMAGE):latest
.PHONY: docker-push
docker-push:
docker push $(DOCKER_IMAGE):$(VERSION)
docker push $(DOCKER_IMAGE):latest
.PHONY: run
run: build
./$(PROJECT)
.PHONY: integration-test
integration-test: ## Run integration tests against PowerAdmin
@bash scripts/integration-test.sh
.PHONY: deps
deps:
go mod download
go mod tidy
.PHONY: help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " test - Run tests with coverage"
@echo " lint - Run golangci-lint"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " clean - Remove build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-push - Push Docker image"
@echo " run - Build and run locally"
@echo " integration-test - Run integration tests against PowerAdmin"
@echo " deps - Download and tidy dependencies"