forked from ethanmdavidson/packer-plugin-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
59 lines (47 loc) · 1.89 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=git
BINARY=packer-plugin-${NAME}
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 build
@mkdir -p ~/.packer.d/plugins/
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}
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@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: