forked from ethanmdavidson/packer-plugin-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
60 lines (48 loc) · 2.06 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
60
NAME=git
BINARY=packer-plugin-${NAME}
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
COUNT?=1
TEST?=$(shell go list ./...)
prep: phony
go install honnef.co/go/tools/cmd/staticcheck@latest
build: phony
@go build -o ${BINARY}
dev: phony
@go build -ldflags="-X '${PLUGIN_FQN}/version.VersionPrerelease=dev'" -o '${BINARY}'
packer plugins install --path ${BINARY} "$(shell echo "${PLUGIN_FQN}" | sed 's/packer-plugin-//')"
run-example: phony dev
@packer build ./example
test: phony
go mod tidy
go fmt ./...
go vet ./...
staticcheck -checks="all" -tests ./...
go test -race -count $(COUNT) $(TEST) -timeout=3m
test-releaser: export API_VERSION = x5.0
test-releaser: phony
go install github.com/goreleaser/goreleaser/v2@latest
goreleaser check
goreleaser release --snapshot --clean --skip=sign
# the acceptance tests have a weird habit of messing up the tty (e.g. turning off echo mode, so
# terminal stops showing what you type). If this happens to you, run `reset` or `stty sane` to fix.
testacc: phony dev
@PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m
install-packer-sdc: phony ## Install packer software development command
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
plugin-check: phony install-packer-sdc build
@packer-sdc plugin-check ${BINARY}
generate: phony install-packer-sdc
@go generate -v ./...
@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" "ethanmdavidson"
@rm -r ".docs"
# see the .docs folder for a preview of the docs
# instead of listing every target in .PHONY, we create one
# 'phony' target which all the other targets depend on.
# This saves me from having to remember to add each new target
# to the .PHONY list, and is a little cleaner than putting
# `.PHONY: target` before each target
.PHONY: phony
phony: