-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(refactor): plugin refactor for v4
- Loading branch information
1 parent
fb262d8
commit 725b061
Showing
49 changed files
with
3,205 additions
and
1,320 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
paths: | ||
- '**.go' | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
permissions: | ||
# Required: allow read access to the content for analysis. | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
pull-requests: read | ||
# Optional: Allow write access to checks to allow the action to annotate code in the PR. | ||
checks: write | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59.1 | ||
args: -c .golang-ci.yml -v --timeout=5m | ||
env: | ||
GO111MODULES: off |
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 +1,3 @@ | ||
example/packer_cache | ||
.envrc | ||
packer-plugin-goss | ||
*.tar |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
linters-settings: | ||
lll: | ||
line-length: 180 | ||
allow-leading-space: true | ||
linters: | ||
enable-all: true | ||
disable: | ||
- testpackage | ||
- forbidigo | ||
- paralleltest | ||
- wrapcheck | ||
- gochecknoglobals | ||
- varnamelen | ||
- funlen | ||
- gomnd | ||
- containedctx | ||
- nlreturn | ||
- wsl | ||
- err113 | ||
- exhaustruct | ||
- nolintlint | ||
- maintidx | ||
- dupl | ||
- revive | ||
- depguard | ||
- tagalign | ||
- perfsprint | ||
- godox | ||
- intrange | ||
- copyloopvar | ||
- gomoddirectives | ||
- goconst | ||
- godot | ||
- execinquery |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: v1.0.0-rc.1 | ||
hooks: | ||
- id: go-build-mod | ||
- id: go-test-mod | ||
- id: go-vet-mod | ||
- id: go-staticcheck-mod | ||
- id: go-fmt | ||
- id: go-fumpt | ||
- id: go-imports | ||
- id: go-lint | ||
- id: golangci-lint-mod | ||
args: [-c.golang-ci.yml] |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
E2E_DIR ?= example | ||
|
||
default: help | ||
|
||
.PHONY: help | ||
help: ## list makefile targets | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
PHONY: lint | ||
lint: ## lint go files | ||
golangci-lint run -c .golang-ci.yml | ||
|
||
.PHONY: fmt | ||
fmt: ## format go files | ||
gofumpt -w . | ||
gci write . | ||
packer fmt -recursive -write . | ||
|
||
.PHONY: build | ||
build: ## build the plugin | ||
go build -ldflags="-X github.com/YaleUniversity/packer-provisioner-goss/version.VersionPrerelease=dev" -o packer-plugin-goss | ||
|
||
.PHONY: install | ||
install: build ## install the plugin | ||
packer plugins install --path packer-plugin-goss github.com/YaleUniversity/goss | ||
|
||
.PHONY: test | ||
test: ## run tests | ||
PACKER_ACC=1 gotestsum | ||
|
||
.PHONY: test-acc | ||
test-acc: clean build install ## run acceptance tests | ||
PACKER_ACC=1 go test -count 1 -v ./provisioner/goss/provisioner_goss_test.go -timeout=120m | ||
|
||
.PHONY: test-e2e | ||
test-e2e: clean build install ## run e2e tests | ||
cd $(E2E_DIR) && packer init . | ||
cd $(E2E_DIR) && packer build complete_example.pkr.hcl | ||
|
||
.PHONY: clean | ||
clean: ## remove tmp files | ||
rm -f $(E2E_DIR)/*.tar $(E2E_DIR)/test-results.xml packer-plugin-goss | ||
|
||
.PHONY: generate | ||
generate: ## go generate | ||
go generate ./... | ||
|
||
.PHONY: plugin-check | ||
plugin-check: build ## will check whether a plugin binary seems to work with packer | ||
@packer-sdc plugin-check packer-plugin-goss | ||
|
||
.PHONY: docs | ||
docs: ## gen packer plugin docs | ||
@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" "YaleUniversity" | ||
@rm -r ".docs" | ||
|
||
.PHONY: example | ||
example: install ## run example | ||
cd examples && packer build . |
Oops, something went wrong.