forked from digitalocean/packer-plugin-digitalocean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
59 lines (45 loc) · 1.68 KB
/
GNUmakefile
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
NAME=digitalocean
BINARY=packer-plugin-${NAME}
COUNT?=1
TEST?=$(shell go list ./...)
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
.PHONY: dev
build:
@go build -o ${BINARY}
dev: build
@mkdir -p ~/.packer.d/plugins/
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}
test:
@go test -v -race -count $(COUNT) ./... $(TEST) -timeout=3m
install-packer-sdc: ## Install packer sofware development command
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
plugin-check: install-packer-sdc build
@packer-sdc plugin-check ${BINARY}
testacc: dev
@PACKER_ACC=1 go test -count $(COUNT) -v ./... $(TEST) -timeout=120m
generate: install-packer-sdc
@go generate ./...
@if [ -d ".docs" ]; then rm -r ".docs"; fi
@packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/"
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "digitalocean"
@rm -r ".docs"
check-generate: generate
echo "==> Checking that auto-generated code is not changed..."
git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found diffs in go generated code."; \
echo "You can use the command: \`make generate\` to regenerate code."; \
exit 1; \
fi
install-golangci-lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
lint: install-golangci-lint
@golangci-lint run ./...
fmt:
@go fmt ./...
check-fmt: fmt
echo "==> Checking that code complies with go fmt requirements..."
git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found files that are not fmt'ed."; \
echo "You can use the command: \`go fmt ./...\` to reformat code."; \
exit 1; \
fi