github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/Makefile (about)

     1  # Copyright (C) 2021 Zilliz. All rights reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
     4  # with the License. You may obtain a copy of the License at
     5  #
     6  # http://www.apache.org/licenses/LICENSE-2.0
     7  #
     8  # Unless required by applicable law or agreed to in writing, software distributed under the License
     9  # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
    10  # or implied. See the License for the specific language governing permissions and limitations under the License.
    11  
    12  GO		?= go
    13  PWD 	:= $(shell pwd)
    14  GOPATH 	:= $(shell $(GO) env GOPATH)
    15  PROTOC	:= $(shell which protoc)
    16  PROTOC_VER := $(shell protoc --version)
    17  INSTALL_PATH := $(PWD)/bin
    18  
    19  all: check-protoc-version 
    20  
    21  check-protoc:
    22  ifeq (, $(shell which protoc))
    23  	$(error "No protoc in PATH, consider doing apt-get install protoc")
    24  else
    25  	@echo "using $(shell which protoc)"
    26  endif
    27  
    28  install-tool:
    29  	@mkdir -p $(INSTALL_PATH)
    30  	@$(INSTALL_PATH)/golangci-lint --version 2>&1 1>/dev/null || (echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v1.46.2)
    31  	@$(INSTALL_PATH)/mockery --version 2>&1 1>/dev/null || (echo "Installing mockery v2.32.4 to ./bin/" && GOBIN=$(INSTALL_PATH)/ go install github.com/vektra/mockery/v2@v2.32.4)
    32  
    33  
    34  check-protoc-version: check-protoc
    35  	@(env bash $(PWD)/scripts/check_protoc_version.sh)
    36  
    37  generate-proto: check-protoc-version
    38  	@which protoc-gen-go 1>/dev/null || (echo "Installing protoc-gen-go" && go get github.com/golang/protobuf/protoc-gen-go@v1.5.2)
    39  	@(env bash $(PWD)/scripts/proto_gen_go.sh)
    40  
    41  generate-mockery: install-tool
    42  	@echo "generating mockery milvus service server"
    43  	@$(INSTALL_PATH)/mockery --srcpkg=github.com/milvus-io/milvus-proto/go-api/v2/milvuspb --name=MilvusServiceServer --output=mocks --outpkg=mocks --with-expecter
    44  
    45  static-check:
    46  	@echo "Running $@ check:"
    47  	@golangci-lint cache clean
    48  	@$(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./entity/...
    49  	@$(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./client/...
    50  	@$(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./internal/...
    51  	@$(INSTALL_PATH)/golangci-lint run --timeout=30m --config ./.golangci.yml ./test/...
    52  
    53  test-go:
    54  	@echo "Running unit tests:"
    55  	@(env bash $(PWD)/scripts/run_go_unittest.sh)
    56  
    57  clean: 
    58  	@echo "Cleaning up all generated file"