-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
50 lines (40 loc) · 1.23 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
GO = go
BIN := $(abspath ./bin)
firestore_emulator ?= localhost:8833
default_project ?= emulator
GO_ENV ?= GOBIN=$(BIN)
$(BIN)/testtime:
$(GO_ENV) $(GO) install github.com/tenntenn/testtime/cmd/[email protected]
$(BIN)/mockgen:
$(GO_ENV) $(GO) install go.uber.org/mock/[email protected]
$(BIN)/avro-bq-schema:
$(GO_ENV) $(GO) install github.com/go-oss/[email protected]
.PHONY: clean-mock
clean-mock:
$(RM) -r ./mock
.PHONY: run
run:
$(GO) run ./cmd/linebot
.PHONY: run-with-emulator
run-with-emulator:
FIRESTORE_EMULATOR_HOST="$(firestore_emulator)" \
GOOGLE_CLOUD_PROJECT="$(default_project)" \
$(GO) run ./cmd/linebot
.PHONY: generate
generate: $(BIN)/mockgen
generate: $(BIN)/avro-bq-schema
generate: clean-mock
@$(GO_ENV) PATH="${PATH}:$(BIN)" $(GO) generate ./...
@$(GO_ENV) $(BIN)/avro-bq-schema terraform/access_log_schema/v1.avsc > terraform/access_log_schema/v1.json
.PHONY: lint
lint:
golangci-lint run
.PHONY: test
test: FLAGS ?=
test: $(BIN)/testtime
FIRESTORE_EMULATOR_HOST="$(firestore_emulator)" \
GOOGLE_CLOUD_PROJECT="$(default_project)" \
$(GO_ENV) $(GO) test $(FLAGS) -trimpath -race -overlay="$(shell $(BIN)/testtime -u)" ./...
.PHONY: emulator
emulator:
firebase emulators:start --project="$(default_project)"