forked from operator-framework/operator-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (34 loc) · 1.25 KB
/
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
46
47
48
49
50
MOD_FLAGS := $(shell (go version | grep -q -E "1\.(11|12)") && echo -mod=vendor)
CMDS := $(addprefix bin/, $(shell ls ./cmd))
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
.PHONY: build test vendor clean
all: clean install-go-bindata test build
$(CMDS):
go build $(MOD_FLAGS) $(extra_flags) -o $@ ./cmd/$(shell basename $@)
build: clean $(CMDS)
static: extra_flags=-ldflags '-w -extldflags "-static"'
static: build
unit:
go test $(MOD_FLAGS) $(SPECIFIC_UNIT_TEST) -count=1 -v -race ./pkg/...
image:
docker build .
image-upstream:
docker build -f upstream-example.Dockerfile .
vendor:
go mod vendor
install-go-bindata:
go get -u github.com/go-bindata/go-bindata/...
generate-migration-bundle:
go-bindata -pkg sqlite -o ./pkg/sqlite/migrations.go ./pkg/sqlite/db_migrations/
codegen:
protoc -I pkg/api/ --go_out=plugins=grpc:pkg/api pkg/api/*.proto
protoc -I pkg/api/grpc_health_v1 --go_out=plugins=grpc:pkg/api/grpc_health_v1 pkg/api/grpc_health_v1/*.proto
container-codegen:
docker build -t operator-registry:codegen -f codegen.Dockerfile .
docker run --name temp-codegen operator-registry:codegen /bin/true
docker cp temp-codegen:/codegen/pkg/api/. ./pkg/api
docker rm temp-codegen
generate-fakes:
go generate ./...
clean:
@rm -rf ./bin