-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (42 loc) · 1.33 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
51
52
53
54
SHELL := /bin/bash
REGISTRY ?= "gpay-gacha"
CLOUD_RUN_REGION ?= "us-central1"
TOOLS=$(shell cat tools/tools.go | egrep '^\s_ ' | awk '{ print $$2 }')
.PHONY: proto
proto:
protoc --go_opt=paths=source_relative -I proto -I $(GOPATH)/src/github.com/protocolbuffers/protobuf/src/ -I $(GOPATH)/src/github.com/googleapis/googleapis --go_out=plugins=grpc:api --gohttp_out=api proto/api.proto
protoc --go_opt=paths=source_relative -I proto -I $(GOPATH)/src/github.com/protocolbuffers/protobuf/src/ -I $(GOPATH)/src/github.com/googleapis/googleapis --go_out=resource proto/resource.proto
.PHONY: graphql
graphql:
gqlgenc
.PHONY: tools
tools:
GOBIN=$(PWD)/bin go install -mod readonly $(TOOLS)
.PHONY: build/server
build/server:
go build -o bin/server ./cmd/server/*.go
.PHONY: build/image
build/image: build/web build/server
@echo "building image..."
@echo "registry: $(REGISTRY)"
docker build -t $(REGISTRY) .
.PHONY: push/image
push/image: build/image
docker push $(REGISTRY)
.PHONY: build/web
build/web:
cd ../animekai-web; yarn run build
statik -src ../animekai-web/dist
.PHONY: deploy
deploy: push/image
@gcloud beta run deploy \
--allow-unauthenticated \
--platform managed \
--region $(CLOUD_RUN_REGION) $(CLOUD_RUN_SERVICE_NAME) \
--image $(REGISTRY)
.PHONY: lint
lint:
golangci-lint run
.PHONY: test
test: build lint
go test ./...