forked from instaclustr/terraform-provider-instaclustr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (44 loc) · 1.54 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
BIN_NAME="terraform-provider-instaclustr"
# for VERSION, don't add prefix "v", e.g., use "1.9.8" instead of "v1.9.8" as it could break circleCI stuff
VERSION=1.10.1
INSTALL_FOLDER=$(HOME)/.terraform.d/plugins/terraform.instaclustr.com/instaclustr/instaclustr/$(VERSION)/darwin_amd64
.PHONY: install clean all build test testacc testtarget release_version
release_version:
@echo v$(VERSION)
all: build
clean:
rm $(BIN_NAME)_v$(VERSION)
rm -fr vendor
build:
go build $(FLAGS) -o bin/$(BIN_NAME)_v$(VERSION) main.go
test:
cd instaclustr && go test -v -timeout 120m -count=1 -coverprofile coverage.out -json ./... > report.json
@cd instaclustr && cat report.json | sed -n '/Output/p' | jq '.Output' # Prettify the report.json file to print it to stdout
testacc:
ifndef IC_USERNAME
@echo "IC_USERNAME for provisioning API must be set for acceptance tests"
@exit 1
endif
ifndef IC_API_KEY
@echo "IC_API_KEY for provisioning API must be set for acceptance tests"
@exit 1
endif
ifndef KMS_ARN
@echo "KMS_ARN for provisioning API must be set for acceptance tests"
@exit 1
endif
ifndef IC_PROV_ACC_NAME
@echo "IC_PROV_ACC_NAME for provisioning API must be set for acceptance tests"
@exit 1
endif
ifndef IC_PROV_VPC_ID
@echo "IC_PROV_VPC_ID for provisioning API must be set for acceptance tests"
@exit 1
endif
cd acc_test && TF_ACC=1 go test -v -timeout 120m -count=1
install:
@if [ ! -d $(INSTALL_FOLDER) ]; then \
echo "$(INSTALL_FOLDER) doesn't exist, creating..."; \
mkdir -p $(INSTALL_FOLDER); \
fi
cp ./bin/$(BIN_NAME)_v$(VERSION) $(INSTALL_FOLDER)