diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..2ba562cc7 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +# kernel-style V=1 build verbosity +ifeq ("$(origin V)", "command line") + BUILD_VERBOSE = $(V) +endif + +ifeq ($(BUILD_VERBOSE),1) + Q = +else + Q = @ +endif + +REPO = github.com/operator-framework/api +BUILD_PATH = $(REPO)/cmd/operator-verify +PKGS = $(shell go list ./... | grep -v /vendor/) + +.PHONY: help +help: ## Show this help screen + @echo 'Usage: make ... ' + @echo '' + @echo 'Available targets are:' + @echo '' + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +.PHONY: install + +install: ## Build & install the operator-verify + + $(Q)go install \ + -gcflags "all=-trimpath=${GOPATH}" \ + -asmflags "all=-trimpath=${GOPATH}" \ + -ldflags " \ + -X '${REPO}/version.GitVersion=${VERSION}' \ + -X '${REPO}/version.GitCommit=${GIT_COMMIT}' \ + " \ + $(BUILD_PATH) + +# Code management. +.PHONY: format tidy clean + +format: ## Format the source code + $(Q)go fmt $(PKGS) + +tidy: ## Update dependencies + $(Q)go mod tidy -v + +clean: ## Clean up the build artifacts + $(Q)rm -rf build + +############################## +# Tests # +############################## + +##@ Tests + +# Static tests. +.PHONY: test test-unit + +test: test-unit ## Run the tests + +TEST_PKGS:=$(shell go list ./...) +test-unit: ## Run the unit tests + $(Q)go test -short ${TEST_PKGS} diff --git a/README.md b/README.md index 91bb12ffb..918a388c4 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,13 @@ Contains the API definitions used by [Operator Lifecycle Manager][olm] (OLM) and [olm]:https://github.com/operator-framework/operator-lifecycle-manager [marketplace]:https://github.com/operator-framework/operator-marketplace + +## Usage + +You can install the `operator-verify` tool from source using: + +`$ make install` + +To verify your ClusterServiceVersion yaml, + +`$ operator-verify verify /path/to/filename.yaml` \ No newline at end of file