-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (48 loc) · 1.87 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
TEST?=$$(go list ./... | grep -v 'vendor')
HOSTNAME=zedwerks
NAME=smilecdr
OUTPUT_DIR=./bin
VERSION:=$(shell git describe --tags --abbrev=0 | sed 's/^v//')
OS_ARCH?=darwin_arm64
DIST_DIR=./dist
BINARY=terraform-provider-${NAME}_v${VERSION}
OS_ARCH?=darwin_arm64
LOCAL_DEPLOY_DIR=~/.terraform.d/plugins/local.providers/${HOSTNAME}/${NAME}/${VERSION}/${OS_ARCH}
default: docs build
update:
go get -u
go mod tidy
build: show-version
mkdir -p ${OUTPUT_DIR}
@echo "Building ${OUTPUT_DIR}/${BINARY}"
go build -o ${OUTPUT_DIR}/${BINARY}
docs:
@echo "Generating docs"
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
show-version:
@echo "Version: ${VERSION}"
release:
goreleaser release --clean --snapshot --skip=publish --skip=sign
binaries: build
GOOS=darwin GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_darwin_amd64
GOOS=darwin GOARCH=arm64 go build -o ${OUTPUT_DIR}/${BINARY}_darwin_arm64
GOOS=freebsd GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_freebsd_amd64
GOOS=freebsd GOARCH=arm go build -o ${OUTPUT_DIR}/${BINARY}_freebsd_arm
GOOS=linux GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_linux_amd64
GOOS=linux GOARCH=arm go build -o ${OUTPUT_DIR}/${BINARY}_linux_arm
GOOS=openbsd GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_openbsd_amd64
GOOS=solaris GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_solaris_amd64
GOOS=windows GOARCH=amd64 go build -o ${OUTPUT_DIR}/${BINARY}_windows_amd64
install: show-version build
mkdir -p ${LOCAL_DEPLOY_DIR}
cp -R ${OUTPUT_DIR}/${BINARY} ${LOCAL_DEPLOY_DIR}
test:
go test -i $(TEST) || exit 1
@echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
testacc:
@echo "Running acceptance tests"
clear
TF_ACC=1 TF_LOG=INFO go test $(TEST) -v $(TESTARGS) -timeout 120m
clean:
rm -rf ${OUTPUT_DIR}
rm -rf ${DIST_DIR}