-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
146 lines (109 loc) · 4.89 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
NAMESPACE = wundergraph
NAME = cosmo
BINARY = terraform-provider-${NAME}
VERSION = 0.0.1
OS_ARCH = linux_amd64
EXAMPLES = examples
TEST ?= $$(go list ./... | grep -v 'vendor')
HOSTNAME ?= terraform.local
COSMO_API_URL ?= http://localhost:3001
COSMO_API_KEY ?= cosmo_669b576aaadc10ee1ae81d9193425705
default: testacc
.PHONY: testacc
testacc:
TF_ACC=1 go test $(TEST) -v -timeout 120m
.PHONY: test-go
test-go:
go test $(TEST) -v
.PHONY: test
test: clean build install testacc e2e
generate:
go generate ./...
tidy:
go mod tidy
fmt:
go fmt ./...
terraform fmt -recursive
build:
go build -o bin/${BINARY}
install:
rm -f examples/**/.terraform.lock.hcl
rm -f ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}/${BINARY}
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
mv bin/${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
clean-local:
rm -rf bin
rm -rf ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
build-all-arches:
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64
release: generate build-all-arches
include examples/Makefile
.PHONY: e2e-apply-cd e2e-destroy-cd e2e-clean-cd
.PHONY: e2e-apply-cosmo e2e-destroy-cosmo e2e-clean-cosmo
.PHONY: e2e-apply-cosmo-monograph e2e-destroy-cosmo-monograph e2e-clean-cosmo-monograph
.PHONY: e2e-cd e2e-cosmo e2e-cosmo-monograph clean
e2e-apply-cd:
rm -rf examples/provider/.terraform.lock.hcl
FEATURE=examples/provider make e2e-init
FEATURE=examples/provider make e2e-apply
e2e-destroy-cd:
make e2e-destroy
e2e-clean-cd:
make e2e-clean
e2e-apply-cosmo:
rm -rf examples/guides/cosmo/.terraform.lock.hcl
FEATURE=examples/guides/cosmo make e2e-init
FEATURE=examples/guides/cosmo make e2e-apply
e2e-destroy-cosmo:
FEATURE=examples/guides/cosmo make e2e-destroy
e2e-clean-cosmo:
FEATURE=examples/guides/cosmo make e2e-clean
e2e-apply-cosmo-monograph:
rm -rf examples/guides/cosmo-monograph/.terraform.lock.hcl
FEATURE=examples/guides/cosmo-monograph make e2e-init
FEATURE=examples/guides/cosmo-monograph make e2e-apply
e2e-destroy-cosmo-monograph:
FEATURE=examples/guides/cosmo-monograph make e2e-destroy
e2e-clean-cosmo-monograph:
FEATURE=examples/guides/cosmo-monograph make e2e-clean
e2e-apply-cosmo-monograph-contract:
rm -rf examples/guides/cosmo-monograph-contract/.terraform.lock.hcl
FEATURE=examples/guides/cosmo-monograph-contract make e2e-init
FEATURE=examples/guides/cosmo-monograph-contract make e2e-apply
e2e-destroy-cosmo-monograph-contract:
FEATURE=examples/guides/cosmo-monograph-contract make e2e-destroy
e2e-clean-cosmo-monograph-contract:
FEATURE=examples/guides/cosmo-monograph-contract make e2e-clean
## Cosmo Local
# Full example installing cosmo locally with a minikube kubernetes cluster
# This will also deploy a router and configure it to use the generated router token
# Ensure to update your /etc/hosts file with
# output "hosts" generated after apply
e2e-apply-cosmo-local:
rm -rf examples/guides/cosmo-local/.terraform.lock.hcl
FEATURE=examples/guides/cosmo-local make e2e-init
FEATURE=examples/guides/cosmo-local make e2e-apply
e2e-destroy-cosmo-local:
FEATURE=examples/guides/cosmo-local make e2e-destroy
e2e-clean-cosmo-local:
FEATURE=examples/guides/cosmo-local make e2e-clean
## Convenience targets to run specific e2e tests
e2e-cd: e2e-apply-cd e2e-destroy-cd
e2e-cosmo: e2e-apply-cosmo e2e-destroy-cosmo
e2e-cosmo-monograph: e2e-apply-cosmo-monograph e2e-destroy-cosmo-monograph
e2e-cosmo-monograph-contract: e2e-apply-cosmo-monograph-contract e2e-destroy-cosmo-monograph-contract
e2e-cosmo-local: e2e-apply-cosmo-local e2e-destroy-cosmo-local
e2e: e2e-cd e2e-cosmo e2e-cosmo-monograph e2e-cosmo-monograph-contract
clean: e2e-clean-cd e2e-clean-cosmo e2e-clean-cosmo-monograph e2e-clean-cosmo-monograph-contract clean-local
destroy: e2e-destroy-cd e2e-destroy-cosmo e2e-destroy-cosmo-monograph e2e-destroy-cosmo-monograph-contract e2e-destroy-cosmo-local