-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 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
51
52
BIN := $(abspath ./bin)
BUILD := build
GO ?= go
GO_ENV ?= GOBIN=$(BIN) CGO_ENABLE=0
$(BIN)/stringer:
$(GO_ENV) $(GO) install -mod=mod golang.org/x/tools/cmd/[email protected]
$(BIN)/wire:
$(GO_ENV) $(GO) install -mod=mod github.com/google/wire/cmd/[email protected]
$(BIN)/mockgen:
$(GO_ENV) $(GO) install -mod=mod github.com/golang/mock/[email protected]
$(BIN)/testtime:
$(GO_ENV) $(GO) install -mod=mod github.com/tenntenn/testtime/cmd/[email protected]
$(BUILD)/server:
$(GO_ENV) go build -o $(BUILD)/server ./cmd/server
.PHONY: clean
clean:
$(RM) -r ./build ./bin
.PHONY: clean-mock
clean-mock:
$(RM) -r ./mock
.PHONY: build
build:
docker build -t calendar-notifier .
.PHONY: run
run: CONFIG_BASE64 ?= $(shell base64 < config.yml)
run: SERVICE_ACCOUNT ?= $(shell base64 < service_account.json)
run:
@CONFIG_BASE64=$(CONFIG_BASE64) \
docker-compose up -d
docker logs -f calendar-notifier
.PHONY: generate
generate: $(BIN)/stringer $(BIN)/wire $(BIN)/mockgen
generate: clean-mock
@PATH=$(BIN):${PATH} $(GO_ENV) $(GO) generate ./...
.PHONY: scan
scan: $(BUILD)/server
trivy fs -s "HIGH,CRITICAL" --ignore-unfixed --exit-code 1 $(BUILD)
.PHONY: test
test: $(BIN)/testtime
$(GO_ENV) $(GO) test -v -race -overlay="$(shell $(BIN)/testtime)" ./...