github.com/qiniu/go-sdk/v7@v7.27.0/Makefile (about)

     1  .PHONY: test unittest integrationtest staticcheck sync-api-specs generate generate-sandbox sandbox-examples
     2  
     3  test:
     4  	go test -tags='unit integration' -failfast -count=1 -v -timeout 350m -coverprofile=coverage.txt `go list ./... | egrep -v 'examples|sms'` | tee -a test.log
     5  
     6  unittest:
     7  	go test -tags=unit -failfast -count=1 -v -coverprofile=coverage.txt `go list ./... | egrep -v 'examples|sms'`
     8  
     9  integrationtest:
    10  	go test -tags=integration -failfast -count=1 -parallel 1 -v -coverprofile=coverage.txt `go list ./... | egrep -v 'examples|sms'`
    11  
    12  staticcheck:
    13  	staticcheck `go list ./... | egrep -v 'examples|sms'`
    14  
    15  # 从远端更新 api-specs submodule 到最新提交。
    16  # 运行后请先检查 api-specs 的变更,再运行 make generate 或 make generate-sandbox 并提交。
    17  sync-api-specs:
    18  	git submodule update --init --recursive --remote api-specs
    19  
    20  generate:
    21  	go generate ./storagev2/
    22  	go generate ./iam/
    23  	go generate ./media/
    24  	go generate ./audit/
    25  	gofmt -w .
    26  	gofumpt -w .
    27  
    28  generate-sandbox:
    29  	# 控制面 API
    30  	go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 \
    31  		--config sandbox/internal/apis/oapi-codegen.yaml \
    32  		api-specs/sandbox/openapi.yml
    33  	# envd HTTP API
    34  	go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.4.1 \
    35  		--config sandbox/internal/envdapi/oapi-codegen.yaml \
    36  		api-specs/sandbox/envd/envd.yaml
    37  	# envd ConnectRPC(需要安装 buf、protoc-gen-go、protoc-gen-connect-go)
    38  	cd api-specs/sandbox/envd && buf generate
    39  	# 验证编译
    40  	go build ./sandbox/...
    41  
    42  sandbox-examples:
    43  	@for dir in examples/sandbox_*/; do \
    44  		name=$$(basename $$dir); \
    45  		echo "=== $$name ==="; \
    46  		go run ./$$dir || exit 1; \
    47  		echo ""; \
    48  	done