github.com/Axway/agent-sdk@v1.1.101/Makefile (about)

     1  .PHONY: all build
     2  
     3  WORKSPACE ?= $$(pwd)
     4  RACEFLAG ?= -race
     5  
     6  GO_TEST_LIST := $(shell go list ./... | grep -v /mock)
     7  
     8  GO_PKG_LIST := $(shell go list ./... | grep -v /mock | grep -v ./pkg/apic/apiserver/clients \
     9  	| grep -v ./pkg/apic/apiserver/models | grep -v ./pkg/apic/unifiedcatalog/models)
    10  
    11  export GOFLAGS := -mod=mod
    12  
    13  PROTO_OUT_PATH := ${WORKSPACE}
    14  
    15  all : clean
    16  
    17  clean:
    18  	@echo "Clean complete"
    19  
    20  dep-check:
    21  	@go mod verify
    22  
    23  resolve-dependencies:
    24  	@echo "Resolving go package dependencies"
    25  	@go mod tidy
    26  	@echo "Package dependencies completed"
    27  
    28  dep: resolve-dependencies
    29  
    30  test: dep
    31  	@go vet ${GO_TEST_LIST}
    32  	@go test -short ${RACEFLAG} -coverprofile=${WORKSPACE}/gocoverage.out -count=1 ${GO_TEST_LIST}
    33  
    34  test-sonar: dep
    35  	@go vet ${GO_PKG_LIST}
    36  	@go test -short -coverpkg=./... -coverprofile=${WORKSPACE}/gocoverage.out -count=1 ${GO_PKG_LIST} -json > ${WORKSPACE}/goreport.json
    37  
    38  apiserver-generate: # generate api server resources, prod by default. ex: make apiserver-generate protocol=https host=apicentral.axway.com port=443
    39  	docker run --rm -v $(shell pwd)/scripts/apiserver:/codegen/scripts -v $(shell pwd)/pkg/apic/apiserver:/codegen/output -e PROTOCOL='$(protocol)' -e HOST='$(host)'  -e PORT='$(port)' -e USERID=$(shell id -u) -e GROUPID=$(shell id -g) -w /codegen/scripts --entrypoint ./apiserver_generate.sh ampc-beano-docker-release-phx.artifactory-phx.ecd.axway.int/base-images/beano-alpine-codegen:latest
    40  
    41  PROTOFILES := $(shell find $(WORKSPACE)/proto -type f -name '*.proto')
    42  PROTOTARGETS := $(PROTOFILES:.proto=.pb.go)
    43  
    44  %.pb.go : %.proto
    45  	@echo $<
    46  	@docker run --rm -u $(shell id -u) \
    47  	  -v${WORKSPACE}:${WORKSPACE} \
    48  	  -w${WORKSPACE} rvolosatovs/protoc:latest \
    49  	  --proto_path=${WORKSPACE}/proto --go_out=${PROTO_OUT_PATH} --go-grpc_out=${PROTO_OUT_PATH} \
    50  	  $<
    51  
    52  # generate protobufs
    53  protoc: $(PROTOTARGETS)