-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
98 lines (77 loc) · 3.06 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
####################
# Go configuration #
####################
TEST?=$$(go list ./... | grep -v 'vendor')
HOSTNAME=budisky.com
NAMESPACE=couchbase
NAME=couchbase
VERSION=1.1.1
BINARY="terraform-provider-${NAME}_${VERSION}"
OS_ARCH=linux_amd64
CGO_ENABLED=0
#########################
# Linters configuration #
#########################
WORKSPACE="$(shell pwd)"
GIT_BRANCH="$(shell git rev-parse --abbrev-ref HEAD)"
LOG_LEVEL="INFO"
##################
# Build provider #
##################
default: install
build:
GOOS=linux GOARCH=amd64 go build -v -a -o ${BINARY}
release:
GOOS=darwin GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_darwin_amd64_${VERSION}"
GOOS=freebsd GOARCH=386 go build -v -a -o "./bin/${BINARY}_freebsd_386_${VERSION}"
GOOS=freebsd GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_freebsd_amd64_${VERSION}"
GOOS=freebsd GOARCH=arm go build -v -a -o "./bin/${BINARY}_freebsd_arm_${VERSION}"
GOOS=linux GOARCH=386 go build -v -a -o "./bin/${BINARY}_linux_386_${VERSION}"
GOOS=linux GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_linux_amd64_${VERSION}"
GOOS=linux GOARCH=arm go build -v -a -o "./bin/${BINARY}_linux_arm_${VERSION}"
GOOS=openbsd GOARCH=386 go build -v -a -o "./bin/${BINARY}_openbsd_386_${VERSION}"
GOOS=openbsd GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_openbsd_amd64_${VERSION}"
GOOS=solaris GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_solaris_amd64_${VERSION}"
GOOS=windows GOARCH=386 go build -v -a -o "./bin/${BINARY}_windows_386_${VERSION}"
GOOS=windows GOARCH=amd64 go build -v -a -o "./bin/${BINARY}_windows_amd64_${VERSION}"
move:
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
install: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
#################
# Test provider #
#################
test:
go clean -testcache
go test -count=1 $(TEST) || exit 1
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
testacc:
go clean -testcache
CB_ADDRESS=127.0.0.1 CB_CLIENT_PORT=8091 CB_NODE_PORT=11210 CB_USERNAME=Administrator CB_PASSWORD=123456 TF_ACC=1 go test -count=1 $(TEST) -v $(TESTARGS) -timeout 120m
########################
# Local infrastructure #
########################
cbnetup:
docker network create couchbase
cbnetdown:
docker network rm couchbase
cbup:
docker-compose -f terraform_example/docker-compose.yml up -d --build
cbinit:
./terraform_example/initialization.sh http://127.0.0.1 8091
cbdown:
docker-compose -f terraform_example/docker-compose.yml down
###########
# Linters #
###########
lint:
docker run --rm --platform=linux/amd64 \
-e LOG_LEVEL=${LOG_LEVEL} \
-e VALIDATE_ALL_CODEBASE=true \
-e RUN_LOCAL=true \
-e DEFAULT_BRANCH=${GIT_BRANCH} \
-e VALIDATE_GO=false \
-v ${WORKSPACE}:/tmp/lint \
ghcr.io/super-linter/super-linter:latest