-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
45 lines (33 loc) · 908 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
42
43
44
45
.PHONY: test lint fmt dispatch clean image push
BUILD = build/$(GOOS)/$(GOARCH)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOEXE ?= $(shell go env GOEXE)
GO ?= go
DOCKER ?= docker
TAG ?= $(shell git log --pretty=format:'%h' -n 1)
REGISTRY ?= 714918108619.dkr.ecr.us-west-2.amazonaws.com
DISPATCH = $(BUILD)/dispatch$(GOEXE)
IMAGE = $(REGISTRY)/dispatch:$(TAG)
test: dispatch
$(GO) test ./...
test-cover: dispatch
$(GO) test -cover ./...
lint:
golangci-lint run ./...
fmt:
$(GO) fmt ./...
dispatch:
$(GO) build -o $(DISPATCH) .
clean:
rm -rf ./build
image:
$(DOCKER) build -t $(IMAGE) .
push: image
$(DOCKER) push $(IMAGE)
update:
for ref in $$(yq -r '.deps[] | .remote + "/gen/go/" + .owner + "/" + .repository + "/protocolbuffers/go@" + .commit' proto/buf.lock); do go get $$ref; done
go mod tidy
dispatch-docs:
${GO} build -tags docs -o ${DISPATCH} .
${DISPATCH}