-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
83 lines (65 loc) · 2.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=kubevirt
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
DESTINATION_PREFIX=$(APPDATA)/terraform.d/plugins
else
DESTINATION_PREFIX=$(HOME)/.terraform.d/plugins
endif
export BIN_DIR=$(CURDIR)/build/_output/bin
export GOROOT=$(BIN_DIR)/go
export GOBIN=$(GOROOT)/bin
export GO=$(GOBIN)/go
export GOFMT=$(GOBIN)/gofmt
all: test install-local-provider
$(GO):
scripts/install-go.sh $(BIN_DIR)
test-tools: $(GO)
scripts/install-terraform.sh $(BIN_DIR)
clean: $(GO)
$(GO) clean
@echo "==> Removing $(DESTINATION_PREFIX)/$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH) directory"
@rm -rf $(DESTINATION_PREFIX)/$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)
build: $(GO) test-fmt
$(GO) build
install-local-provider: build $(GO)
@mkdir -p $(DESTINATION_PREFIX)/terraform.local/local/kubevirt/1.0.0/$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)
@cp ./terraform-provider-kubevirt $(DESTINATION_PREFIX)/terraform.local/local/kubevirt/1.0.0/$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)
@echo "==> Installing plugin to $(DESTINATION_PREFIX)/terraform.local/local/kubevirt/1.0.0/$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)"
test-fmt:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
test-vet: $(GO)
@echo "go vet ."
$(GO) vet $$($(GO) list ./... | grep -v vendor/)
@if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
fmt: $(GO)
$(GOFMT) -w $(GOFMT_FILES)
test: $(GO) test-fmt
$(GO) test ./kubevirt/... $(TESTARGS) -timeout=30s -parallel=4
functest: test-tools
$(CURDIR)/scripts/func-test.sh $(BIN_DIR)
errcheck:
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
cluster-up:
./kubevirtci up
cluster-down:
./kubevirtci down
.PHONY: \
clean \
build \
install-local-provider \
test-fmt \
test-vet \
fmt \
test \
test-acc \
functest \
errcheck \
test-compile \
cluster-up \
cluster-down \