-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (56 loc) · 1.74 KB
/
Makefile
File metadata and controls
74 lines (56 loc) · 1.74 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
DOCKER_REGISTRY ?= radixdev.azurecr.io
BINS = radix-github-webhook
IMAGES = radix-github-webhook
GIT_TAG = $(shell git describe --tags --always 2>/dev/null)
VERSION ?= ${GIT_TAG}
IMAGE_TAG ?= ${VERSION}
LDFLAGS += -s -w
CX_OSES = linux windows
CX_ARCHS = amd64
.PHONY: build
build: $(BINS)
.PHONY: test
test:
go test -cover `go list ./...`
.PHONY: lint
lint: bootstrap
golangci-lint run --max-same-issues 0
.PHONY: $(BINS)
$(BINS):
go build -ldflags '$(LDFLAGS)' -o bin/$@ .
.PHONY: docker-build
docker-build: $(addsuffix -image,$(IMAGES))
%-image:
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_REGISTRY)/$*:$(IMAGE_TAG) .
.PHONY: docker-push
docker-push: $(addsuffix -push,$(IMAGES))
%-push:
az acr login --name $(DOCKER_REGISTRY)
docker push $(DOCKER_REGISTRY)/$*:$(IMAGE_TAG)
.PHONY: deploy
deploy: docker-build docker-push
.PHONY: radixconfigs
radixconfigs:
ENV=qa envsubst < radixconfig.tpl.yaml > radixconfig.dev.yaml
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.c2.yaml
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.c3.yaml
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.platform.yaml
ENV=prod envsubst < radixconfig.tpl.yaml > radixconfig.playground.yaml
.PHONY: mocks
mocks: bootstrap
mockgen -source ./radix/api_server.go -destination ./radix/api_server_mock.go -package radix
.PHONY: generate
generate: mocks radixconfigs
.PHONY: verify-generate
verify-generate: generate
git diff --exit-code
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;)
HAS_MOCKGEN := $(shell command -v mockgen;)
.PHONY: bootstrap
bootstrap:
ifndef HAS_GOLANGCI_LINT
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1
endif
ifndef HAS_MOCKGEN
go install go.uber.org/mock/mockgen@v0.6.0
endif