generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use ci job matrix and fix acceptance tests
Co-Authored-by: pauhull <[email protected]>
- Loading branch information
Showing
6 changed files
with
78 additions
and
154 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
unit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- run: make test | ||
|
||
acceptance: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
permissions: | ||
id-token: write # Required by hetznercloud/tps-action | ||
|
||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- uses: hetznercloud/tps-action@main | ||
|
||
- run: make testacc |
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,34 +1,38 @@ | ||
NAME=hcloud | ||
BINARY=packer-plugin-${NAME} | ||
BINARY=packer-plugin-$(NAME) | ||
ifeq ($(OS), Windows_NT) | ||
# Prevent "Ignoring plugin match packer-plugin-hcloud, no exe extension" | ||
BINARY=packer-plugin-$(NAME).exe | ||
endif | ||
|
||
COUNT?=1 | ||
TEST?=$(shell go list ./...) | ||
TEST?=./... | ||
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} | ||
go build -o $(BINARY) | ||
|
||
dev: build | ||
@mkdir -p ~/.packer.d/plugins/ | ||
@mv ${BINARY} ~/.packer.d/plugins/${BINARY} | ||
mkdir -p ~/.config/packer/plugins | ||
mv $(BINARY) ~/.config/packer/plugins | ||
|
||
test: | ||
@go test -race -count $(COUNT) $(TEST) -timeout=3m | ||
go test -race -count $(COUNT) -v $(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} | ||
install-packer-sdc: ## Install packer software 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} | ||
packer-sdc plugin-check $(BINARY) | ||
|
||
testacc: dev | ||
@PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m | ||
testacc: build | ||
PACKER_ACC=1 PACKER_PLUGIN_PATH=$(PWD) go test -count $(COUNT) -v $(TEST) -timeout=120m | ||
|
||
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" "hashicorp" | ||
@rm -r ".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" "hashicorp" | ||
rm -r ".docs" |
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