This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (79 loc) · 2.12 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
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
ifeq ($(GOOS), windows)
EXT?=.exe
else
EXT?=
endif
ifeq ($(GOARCH), amd64)
GOARCH_FULL?=amd64_v1
else
GOARCH_FULL=$(GOARCH)
endif
.PHONY: install-tools
install-tools:
go install github.com/securego/gosec/v2/cmd/[email protected]
go install github.com/google/[email protected]
go install github.com/mgechev/[email protected]
go install github.com/uw-labs/[email protected]
go install github.com/goreleaser/[email protected]
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/client9/misspell/cmd/[email protected]
.PHONY: tidy
tidy:
go mod tidy
.PHONY: provider
provider:
goreleaser build \
--skip-validate \
--single-target \
--snapshot \
--rm-dist \
--config release/goreleaser.yml
.PHONY: test-local
test-local: provider
rm -rf test/local/providers
mkdir -p test/local/providers
cp dist/provider_$(GOOS)_$(GOARCH_FULL)/terraform-provider-bindplane* test/local/providers/terraform-provider-bindplane-enterprise_v0.0.0
.PHONY: test-end-to-end
test-end-to-end: dev-tls provider
mkdir -p test/integration/providers
cp dist/provider_$(GOOS)_$(GOARCH_FULL)/terraform-provider-bindplane* test/integration/providers/terraform-provider-bindplane-enterprise_v0.0.0
BINDPLANE_LICENSE=${BINDPLANE_LICENSE} test/integration/test.sh
dev-tls: test/tls
test/tls:
mkdir test/tls
docker run \
-v ${PWD}/test/scripts/generate-dev-certificates.sh:/generate-dev-certificates.sh \
-v ${PWD}/test/tls:/tls \
--entrypoint=/bin/sh \
alpine/openssl /generate-dev-certificates.sh
.PHONY: clean-dev-tls
clean-dev-tls:
rm -rf test/tls
.PHONY: ci-check
ci-check: lint misspell check-fmt gosec vet test check-license
.PHONY: lint
lint:
revive -config .revive.toml -formatter friendly -set_exit_status ./...
.PHONY: misspell
misspell:
misspell $(ALLDOC)
.PHONY: misspell-fix
misspell-fix:
misspell -w $(ALLDOC)
.PHONY: check-fmt
check-fmt:
goimports -d ./ | diff -u /dev/null -
.PHONY: fmt
fmt:
goimports -w .
.PHONY: gosec
gosec:
gosec -exclude-generated -exclude-dir internal/tools ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: test
test:
go test ./... -cover -race