generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize Linode DX Makefile; cleanup duplicated integration tests (#…
…196)
- Loading branch information
1 parent
1f6fcae
commit d8759cc
Showing
5 changed files
with
45 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,73 @@ | ||
NAME=linode | ||
BINARY=packer-plugin-${NAME} | ||
GOFMT_FILES?=$$(find . -name '*.go') | ||
COUNT?=1 | ||
TEST?=$(shell go list ./builder/...) | ||
UNIT_TEST_TARGET?=$(shell go list ./builder/...) | ||
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2) | ||
PACKER_SDC_REPO ?= github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc | ||
.DEFAULT_GOAL = dev | ||
|
||
.PHONY: dev | ||
|
||
build: fmtcheck | ||
@go build -o ${BINARY} | ||
# install is an alias of dev | ||
.PHONY: install | ||
install: dev | ||
|
||
.PHONY: dev | ||
dev: build | ||
@mkdir -p ~/.packer.d/plugins/ | ||
@mv ${BINARY} ~/.packer.d/plugins/${BINARY} | ||
|
||
test: dev fmtcheck | ||
@PACKER_ACC=1 go test -count $(COUNT) ./... -v -timeout=100m | ||
.PHONY: build | ||
build: fmtcheck | ||
@go build -o ${BINARY} | ||
|
||
.PHONY: test | ||
test: dev fmtcheck acctest | ||
|
||
.PHONY: install-packer-sdc | ||
install-packer-sdc: ## Install packer sofware development command | ||
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION} | ||
@go install ${PACKER_SDC_REPO}@${HASHICORP_PACKER_PLUGIN_SDK_VERSION} | ||
|
||
.PHONY: plugin-check | ||
plugin-check: install-packer-sdc build | ||
@packer-sdc plugin-check ${BINARY} | ||
|
||
.PHONY: unit-test | ||
unit-test: dev | ||
go test -count $(COUNT) -v $(TEST) -timeout=10m | ||
@go test -count $(COUNT) -v $(UNIT_TEST_TARGET) -timeout=10m | ||
|
||
int-test: dev | ||
@go test -v test/integration/e2e_test.go | ||
# int-test is an alias of acctest | ||
.PHONY: int-test | ||
int-test: acctest | ||
|
||
.PHONY: acctest | ||
acctest: dev | ||
@PACKER_ACC=1 go test -count $(COUNT) ./... -v -timeout=100m | ||
|
||
.PHONY: generate | ||
generate: install-packer-sdc | ||
@go generate ./... | ||
@rm -rf .docs | ||
@packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/" | ||
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "linode" | ||
@rm -r ".docs" | ||
|
||
.PHONY: fmtcheck | ||
fmtcheck: | ||
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" | ||
|
||
.PHONY: lint | ||
lint: fmtcheck | ||
golangci-lint run --timeout 15m0s | ||
@golangci-lint run | ||
|
||
fmt: | ||
gofmt -w $(GOFMT_FILES) | ||
gofumpt -w . | ||
.PHONY: format | ||
format: | ||
@gofumpt -w . | ||
|
||
.PHONY: deps | ||
deps: install-packer-sdc | ||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
@go install mvdan.cc/gofumpt@latest | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf .docs | ||
@rm -rf ./packer-plugin-linode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.