-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (50 loc) · 1.69 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
55
56
57
58
59
60
61
62
63
64
65
GOLANGCI_LINT_VERSION := 1.64.6
LATEST_TAG := $(shell git describe --tags --abbrev=0)
MACOS_VERSION := $(shell sw_vers -productVersion)
MACOS_ARCH := $(shell uname -m)
all:
$(MAKE) clean
$(MAKE) prepare
$(MAKE) validate
$(MAKE) build
$(MAKE) build_gui
prepare:
go mod tidy
go install ./...
$(MAKE) apis
validate:
go vet ./...
$(MAKE) lint
$(MAKE) test
build:
go build $(build_arguments) ./cmd/tgnotifier
build_without_gprc:
go build -tags no_grpc $(build_arguments) ./cmd/tgnotifier
build_without_http:
go build -tags no_http $(build_arguments) ./cmd/tgnotifier
build_without_servers:
go build -tags no_http,no_grpc $(build_arguments) ./cmd/tgnotifier
build_gui:
go build -tags gui,no_http,no_grpc $(build_arguments) ./cmd/tgnotifierui
build_gui_local:
@echo Building $(CURRENT_TAG)...
go build -tags gui,no_http,no_grpc -o ./tgnotifierui_$(LATEST_TAG)_macOS-v$(MACOS_VERSION)_$(MACOS_ARCH) ./cmd/tgnotifierui
apis:
protoc -I api/grpc api/grpc/tgnotifier.proto --go_out=./internal/api/grpc/ --go_opt=paths=source_relative --go-grpc_out=./internal/api/grpc/ --go-grpc_opt=paths=source_relative --oas_out=./api/http/
oapi-codegen --config=./api/http/oapi.config.yml ./api/http/openapi.yaml
lint:
if [ ! -f ./bin/golangci-lint ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "./bin" "v${GOLANGCI_LINT_VERSION}"; \
fi;
./bin/golangci-lint run ./...
test:
go test -race -coverprofile=coverage_out ./...
go tool cover -func=coverage_out
go tool cover -html=coverage_out -o coverage.html
rm -f coverage_out
test_short:
go test -short ./...
test_grpc:
go test ./internal/api/tests/... -v -tags grpc_tests -count 1
clean:
go clean