github.com/oam-dev/kubevela@v1.9.11/Makefile (about) 1 include makefiles/const.mk 2 include makefiles/dependency.mk 3 include makefiles/release.mk 4 include makefiles/develop.mk 5 include makefiles/build.mk 6 include makefiles/e2e.mk 7 8 .DEFAULT_GOAL := all 9 all: build 10 11 # ============================================================================== 12 # Targets 13 14 ## test: Run tests 15 test: unit-test-core test-cli-gen 16 @$(OK) unit-tests pass 17 18 ## test-cli-gen: Run the unit tests for cli gen 19 test-cli-gen: 20 @mkdir -p ./bin/doc 21 @go run ./hack/docgen/cli/gen.go ./bin/doc 22 23 ## unit-test-core: Run the unit tests for core 24 unit-test-core: 25 go test -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... ./apis/... | grep -v apiserver | grep -v applicationconfiguration) 26 go test $(shell go list ./references/... | grep -v apiserver) 27 28 ## build: Build vela cli binary 29 build: vela-cli kubectl-vela 30 @$(OK) build succeed 31 32 ## build-cli: Clean build 33 build-cleanup: 34 @echo "===========> Cleaning all build output" 35 @rm -rf _bin 36 37 ## fmt: Run go fmt against code 38 fmt: goimports installcue 39 go fmt ./... 40 $(GOIMPORTS) -local github.com/oam-dev/kubevela -w $$(go list -f {{.Dir}} ./...) 41 $(CUE) fmt ./vela-templates/definitions/internal/* 42 $(CUE) fmt ./vela-templates/definitions/deprecated/* 43 $(CUE) fmt ./vela-templates/definitions/registry/* 44 $(CUE) fmt ./pkg/stdlib/pkgs/* 45 $(CUE) fmt ./pkg/stdlib/op.cue 46 $(CUE) fmt ./pkg/workflow/tasks/template/static/* 47 48 ## sdk_fmt: Run go fmt against code 49 sdk_fmt: 50 ./hack/sdk/reviewable.sh 51 52 ## vet: Run go vet against code 53 vet: 54 @$(INFO) go vet 55 @go vet $(shell go list ./...|grep -v scaffold) 56 57 ## staticcheck: Run the staticcheck 58 staticcheck: staticchecktool 59 @$(INFO) staticcheck 60 @$(STATICCHECK) $(shell go list ./...|grep -v scaffold) 61 62 ## lint: Run the golangci-lint 63 lint: golangci 64 @$(INFO) lint 65 @$(GOLANGCILINT) run --fix --verbose --skip-dirs 'scaffold' 66 67 ## reviewable: Run the reviewable 68 reviewable: manifests fmt vet lint staticcheck helm-doc-gen sdk_fmt 69 go mod tidy 70 71 # check-diff: Execute auto-gen code commands and ensure branch is clean. 72 check-diff: reviewable 73 git --no-pager diff 74 git diff --quiet || ($(ERR) please run 'make reviewable' to include all changes && false) 75 @$(OK) branch is clean 76 77 ## docker-push: Push the docker image 78 docker-push: 79 @echo "===========> Pushing docker image" 80 @docker push $(VELA_CORE_IMAGE) 81 82 ## image-cleanup: Delete Docker images 83 image-cleanup: 84 ifneq (, $(shell which docker)) 85 # Delete Docker images 86 87 ifneq ($(shell docker images -q $(VELA_CORE_TEST_IMAGE)),) 88 docker rmi -f $(VELA_CORE_TEST_IMAGE) 89 endif 90 91 endif 92 93 ## image-load: load docker image to the kind cluster 94 image-load: 95 docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e . 96 kind load docker-image $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; } 97 98 ## core-test: Run tests 99 core-test: 100 go test ./pkg/... -coverprofile cover.out 101 102 ## manager: Build vela core manager binary 103 manager: 104 $(GOBUILD_ENV) go build -o bin/manager -a -ldflags $(LDFLAGS) ./cmd/core/main.go 105 106 ## manifests: Generate manifests e.g. CRD, RBAC etc. 107 manifests: installcue kustomize 108 go generate $(foreach t,pkg apis,./$(t)/...) 109 # TODO(yangsoon): kustomize will merge all CRD into a whole file, it may not work if we want patch more than one CRD in this way 110 $(KUSTOMIZE) build config/crd -o config/crd/base/core.oam.dev_applications.yaml 111 ./hack/crd/cleanup.sh 112 go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds 113 rm -f config/crd/base/* 114 ./vela-templates/gen_definitions.sh 115 116 117 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]') 118 HOSTARCH := $(shell uname -m) 119 ifeq ($(HOSTARCH),x86_64) 120 HOSTARCH := amd64 121 endif 122 123 124 ## check-license-header: Check license header 125 check-license-header: 126 ./hack/licence/header-check.sh 127 128 ## def-gen: Install definitions 129 def-install: 130 ./hack/utils/installdefinition.sh 131 132 ## helm-doc-gen: Generate helm chart README.md 133 helm-doc-gen: helmdoc 134 readme-generator -v charts/vela-core/values.yaml -r charts/vela-core/README.md 135 136 ## help: Display help information 137 help: Makefile 138 @echo "" 139 @echo "Usage:" 140 @echo "" 141 @echo " make [target]" 142 @echo "" 143 @echo "Targets:" 144 @echo "" 145 @awk -F ':|##' '/^[^\.%\t][^\t]*:.*##/{printf " \033[36m%-20s\033[0m %s\n", $$1, $$NF}' $(MAKEFILE_LIST) | sort 146 @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'