grpc-api-example/Makefile

46 lines
1.1 KiB
Makefile
Raw Normal View History

2024-02-27 19:21:35 +00:00
BUF_VERSION:=v1.29.0
SWAGGER_UI_VERSION:=v5.11.8
2024-02-26 10:12:30 +00:00
install-tools:
2024-02-26 10:18:47 +00:00
go install gotest.tools/gotestsum@v1.11.0
2024-02-27 19:21:35 +00:00
go install github.com/bufbuild/buf/cmd/buf@$(BUF_VERSION)
2024-02-27 19:55:23 +00:00
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.32
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3
2024-02-27 19:21:35 +00:00
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.19.1
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.19.1
2024-02-26 10:12:30 +00:00
build: generate
buf build
go build -o bin/server .
generate:
2024-02-27 19:55:23 +00:00
find ./proto -type f -name "*.go" -delete # Delete existing Go generated files
2024-02-26 10:12:30 +00:00
buf generate
go generate ./...
2024-02-27 19:21:35 +00:00
SWAGGER_UI_VERSION=$(SWAGGER_UI_VERSION) ./scripts/generate-swagger-ui.sh
2024-02-26 10:12:30 +00:00
lint:
buf lint
fmt:
buf format
go fmt ./...
2024-02-26 10:18:47 +00:00
go.mod:
2024-02-26 10:12:30 +00:00
go mod tidy
go mod verify
go.sum: go.mod
test:
2024-02-26 10:18:47 +00:00
gotestsum --format testname --junitfile unit-tests.xml -- -mod=readonly -race -coverprofile=./c.out -covermode=atomic -coverpkg=.,./... ./...
2024-02-26 10:12:30 +00:00
coverage: test
2024-02-26 10:18:47 +00:00
go tool cover -func=cover.out
2024-02-26 10:12:30 +00:00
mocks:
rm -rf mocks/*
mockery --all
2024-02-26 10:18:47 +00:00
clean:
go clean
rm -f bin/*