Skip to content

Commit 707ed6a

Browse files
authored
Merge pull request #11 from clyang82/br_api_1
Have a Makefile to install operator-verify
2 parents d2a2fa2 + 5d38ef7 commit 707ed6a

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# kernel-style V=1 build verbosity
2+
ifeq ("$(origin V)", "command line")
3+
BUILD_VERBOSE = $(V)
4+
endif
5+
6+
ifeq ($(BUILD_VERBOSE),1)
7+
Q =
8+
else
9+
Q = @
10+
endif
11+
12+
REPO = github.com/operator-framework/api
13+
BUILD_PATH = $(REPO)/cmd/operator-verify
14+
PKGS = $(shell go list ./... | grep -v /vendor/)
15+
16+
.PHONY: help
17+
help: ## Show this help screen
18+
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
19+
@echo ''
20+
@echo 'Available targets are:'
21+
@echo ''
22+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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)
23+
24+
.PHONY: install
25+
26+
install: ## Build & install the operator-verify
27+
28+
$(Q)go install \
29+
-gcflags "all=-trimpath=${GOPATH}" \
30+
-asmflags "all=-trimpath=${GOPATH}" \
31+
-ldflags " \
32+
-X '${REPO}/version.GitVersion=${VERSION}' \
33+
-X '${REPO}/version.GitCommit=${GIT_COMMIT}' \
34+
" \
35+
$(BUILD_PATH)
36+
37+
# Code management.
38+
.PHONY: format tidy clean
39+
40+
format: ## Format the source code
41+
$(Q)go fmt $(PKGS)
42+
43+
tidy: ## Update dependencies
44+
$(Q)go mod tidy -v
45+
46+
clean: ## Clean up the build artifacts
47+
$(Q)rm -rf build
48+
49+
##############################
50+
# Tests #
51+
##############################
52+
53+
##@ Tests
54+
55+
# Static tests.
56+
.PHONY: test test-unit
57+
58+
test: test-unit ## Run the tests
59+
60+
TEST_PKGS:=$(shell go list ./...)
61+
test-unit: ## Run the unit tests
62+
$(Q)go test -short ${TEST_PKGS}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ Contains the API definitions used by [Operator Lifecycle Manager][olm] (OLM) and
88

99
[olm]:https://github.com/operator-framework/operator-lifecycle-manager
1010
[marketplace]:https://github.com/operator-framework/operator-marketplace
11+
12+
## Usage
13+
14+
You can install the `operator-verify` tool from source using:
15+
16+
`$ make install`
17+
18+
To verify your ClusterServiceVersion yaml,
19+
20+
`$ operator-verify verify /path/to/filename.yaml`

0 commit comments

Comments
 (0)