-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (70 loc) · 2.39 KB
/
Makefile
File metadata and controls
92 lines (70 loc) · 2.39 KB
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
82
83
84
85
86
87
88
89
90
91
92
-include Makefile.local
TESTARGS ?=
GENERATED_OUT_PATH=target/
CODEGEN_LOG_LEVEL ?= error
CODEGEN_SPECS := $(shell find specs/ -name '*.yaml')
CODEGEN_SOURCES := $(shell find pkg/ cmd/ -name '*.go')
CODEGEN_TEMPLATES := $(shell find templates/ -type f)
target/codegen: $(CODEGEN_SOURCES) $(CODEGEN_TEMPLATES)
go build -o target/codegen ./cmd/codegen
ASSETS_SRC := $(shell find assets/ -type f)
ASSETS_DST := $(patsubst assets/%,$(GENERATED_OUT_PATH)/%,$(ASSETS_SRC))
.PHONY: assets
assets: $(ASSETS_DST)
.PHONY: codegen
codegen: codegen-stamp
codegen-stamp: target/codegen $(CODEGEN_SPECS)
CODEGEN_LOG_LEVEL=$(CODEGEN_LOG_LEVEL) ./target/codegen -config cmd/codegen/config.yaml
touch $@
$(GENERATED_OUT_PATH)/%: assets/%
@mkdir -p $(@D)
cp $< $@
.PHONY: install
install: codegen assets
cd $(GENERATED_OUT_PATH)/terraform/ && go install
$(GENERATED_OUT_PATH)terraform/terraform-provider-panos: codegen-stamp assets
cd $(GENERATED_OUT_PATH)terraform && go build -o terraform-provider-panos ./main.go
.PHONY: examples
examples: install
TF_CLI_CONFIG_FILE= ./scripts/validate-terraform-examples.sh
.PHONY: test
test: test/codegen test/pango test/terraform
.PHONY: test/codegen
test/codegen:
go test -v ./...
.PHONY: test/pango
test/pango: codegen assets
cd $(GENERATED_OUT_PATH)/pango && \
go test -v ./...
.PHONY: test/pango-commit
test/pango-commit: codegen assets
cd $(GENERATED_OUT_PATH)/pango && \
ginkgo run -v ./commit/
.PHONY: test/pango-movement
test/pango-movement: codegen assets
cd $(GENERATED_OUT_PATH)/pango && \
go test -v ./movement/
.PHONY: test/pango-example
test/pango-example:
cd $(GENERATED_OUT_PATH)/pango && \
go build example/main.go
.PHONY: test/terraform
test/terraform: test/terraform-acc test/terraform-manager
.PHONY: test/terraform-manager
test/terraform-manager: codegen assets
cd $(GENERATED_OUT_PATH)/terraform/ && \
go test -coverprofile cover.profile -v ./internal/manager/
.PHONY: test/terraform-acc
test/terraform-acc: codegen assets
cd $(GENERATED_OUT_PATH)/terraform/ && \
TF_ACC=1 PANOS_HOSTNAME=$(PANOS_HOSTNAME) \
PANOS_SKIP_VERIFY_CERTIFICATE=1 \
PANOS_USE_CREDENTIALS=1 \
PANOS_USERNAME=$(PANOS_USERNAME) PANOS_PASSWORD=$(PANOS_PASSWORD) \
go test -v ./test $(TESTARGS) |grep -v -E "(No slog handler provided|Pango logging configured)"
.PHONY: clean
clean:
rm -rf *-stamp target/codegen $(GENERATED_OUT_PATH)/ panos-api-key.txt
ifndef VERBOSE
.SILENT:
endif