3 Star 0 Fork 0

mirrors_vmware-archive/operator-builder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
INIT_OPTS=init \
--workload-config .workloadConfig/workload.yaml \
--repo github.com/acme/acme-cnp-mgr \
--skip-go-version-check
CREATE_OPTS=create api \
--workload-config .workloadConfig/workload.yaml \
--controller \
--resource
define create_path
if [ ! -d $(1)/.workloadConfig ]; then\
mkdir -p $(1)/.workloadConfig;\
fi
endef
export BASE_DIR := $(shell pwd)
export OPERATOR_BUILDER_PATH := $(BASE_DIR)/bin
.PHONY: build install test debug
build:
go build -o bin/operator-builder cmd/operator-builder/main.go
install: build
sudo cp bin/operator-builder /usr/local/bin/operator-builder
#
# traditional testing
#
GOLANGCI_LINT_VERSION ?= v1.45.2
install-linter:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
lint:
golangci-lint run
test:
go test -cover -coverprofile=./bin/coverage.out ./...
test-coverage-view: test
go tool cover -html=./bin/coverage.out
test-commit:
test/scripts/commit-check-latest.sh
#
# debug testing with delve
#
TEST_WORKLOAD_PATH ?= test/cases/standalone
debug-clean:
rm -rf $(TEST_WORKLOAD_PATH)/*
debug-init: debug-clean
dlv debug ./cmd/operator-builder --wd $(TEST_WORKLOAD_PATH) -- $(INIT_OPTS)
debug-create:
dlv debug ./cmd/operator-builder --wd $(TEST_WORKLOAD_PATH) -- $(CREATE_OPTS)
debug: debug-init debug-create
#
# simple functional code generation testing outside of codebase itself
#
FUNC_TEST_PATH ?= /tmp/operator-builder-func-test
func-test-clean:
if [ -d $(FUNC_TEST_PATH) ]; then rm -rf $(FUNC_TEST_PATH)/*; fi
func-test-init: build func-test-clean
$(call create_path,$(FUNC_TEST_PATH))
cp -r $(BASE_DIR)/$(TEST_WORKLOAD_PATH)/.workloadConfig/* $(FUNC_TEST_PATH)/.workloadConfig ;
cd $(FUNC_TEST_PATH) && $(OPERATOR_BUILDER_PATH)/operator-builder $(INIT_OPTS)
func-test-create:
cd $(FUNC_TEST_PATH) && $(OPERATOR_BUILDER_PATH)/operator-builder $(CREATE_OPTS)
func-test: func-test-init func-test-create
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_vmware-archive/operator-builder.git
git@gitee.com:mirrors_vmware-archive/operator-builder.git
mirrors_vmware-archive
operator-builder
operator-builder
main

搜索帮助