This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (50 loc) · 2.47 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
name = waypoint
organization = hashicorp
version = 0.1.0
arch = darwin_arm64
#arch = linux_amd64
build:
go build -o bin/terraform-provider-$(name)_v$(version)
install: build
mkdir -p ~/.terraform.d/plugins/local/$(organization)/$(name)/$(version)/$(arch)
mv bin/terraform-provider-$(name)_v$(version) ~/.terraform.d/plugins/local/$(organization)/$(name)/$(version)/$(arch)/
test:
go test ./internal/provider -v
.PHONY: docs
docs:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
.PHONY: tools
tools: # Install dependencies and tools required to build
@echo "Fetching tools..."
go generate -tags tools tools/tools.go
@echo
@echo "Done!"
multi_build:
@echo ""
@echo "Compile Provider"
# Clear the output
rm -rf ./bin
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o ./bin/linux_arm64/terraform-provider-$(name)_v$(version) ./main.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./bin/linux_amd64/terraform-provider-$(name)_v$(version) ./main.go
GOOS=darwin GOARCH=arm64 go build -o ./bin/darwin_arm64/terraform-provider-$(name)_v$(version) ./main.go
GOOS=darwin GOARCH=amd64 go build -o ./bin/darwin_amd64/terraform-provider-$(name)_v$(version) ./main.go
GOOS=windows GOARCH=amd64 go build -o ./bin/windows_amd64/terraform-provider-$(name)_v$(version).exe ./main.go
GOOS=windows GOARCH=386 go build -o ./bin/windows_386/terraform-provider-$(name)_v$(version).exe ./main.go
zip:
pwd
zip -j ./bin/terraform-provider-$(name)_$(version)_linux_arm64.zip ./bin/linux_arm64/terraform-provider-$(name)_v$(version)
zip -j ./bin/terraform-provider-$(name)_$(version)_linux_amd64.zip ./bin/linux_amd64/terraform-provider-$(name)_v$(version)
zip -j ./bin/terraform-provider-$(name)_$(version)_darwin_arm64.zip ./bin/darwin_arm64/terraform-provider-$(name)_v$(version)
zip -j ./bin/terraform-provider-$(name)_$(version)_darwin_amd64.zip ./bin/darwin_amd64/terraform-provider-$(name)_v$(version)
zip -j ./bin/terraform-provider-$(name)_$(version)_windows_amd64.zip ./bin/windows_amd64/terraform-provider-$(name)_v$(version).exe
zip -j ./bin/terraform-provider-$(name)_$(version)_windows_386.zip ./bin/windows_386/terraform-provider-$(name)_v$(version).exe
ls -lha ./bin
shasum:
cd bin/; shasum -a 256 *.zip > terraform-provider-$(name)_$(version)_SHA256SUMS
gpg:
gpg --detach-sign ./bin/terraform-provider-$(name)_$(version)_SHA256SUMS
release_package: multi_build zip shasum gpg
# Run acceptance tests
.PHONY: testacc
testacc:
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m