From 636b6c228f2db3e41ac974072746aeedeeb16a54 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:33:27 -0400 Subject: [PATCH] chore(ci): cleanup and update project configs --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- .github/workflows/semgrep.yml | 3 +-- .github/workflows/test.yml | 26 +------------------------- Makefile | 22 ++++++++++++++++++++-- 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 638072168..e196f749b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,6 +28,7 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. +- Single or clustered Proxmox: - Provider version (ideally it should be the latest version): - Terraform version: - OS (where you run Terraform from): diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5fc0c4acf..70d864f5b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,8 +2,8 @@ Please mark the following items with an [x] if they apply to your PR. Leave the [ ] if they are not applicable, or if you have not completed the item. - [ ] I have added / updated documentation in `/docs` for any user-facing features or additions. -- [ ] I have added / updated templates in `/examples` for any new or updated resources / data sources. -- [ ] I have ran `make examples` to verify that the change works as expected. +- [ ] I have added / updated templates in `/example` for any new or updated resources / data sources. +- [ ] I have ran `make example` to verify that the change works as expected. ### Community Note diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 21b8ac830..840f5668f 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -3,7 +3,6 @@ on: push: branches: - main - - master paths: - .github/workflows/semgrep.yml schedule: @@ -13,7 +12,7 @@ name: Semgrep jobs: semgrep: name: Scan - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} container: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4801567c5..3ec9fc9d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,27 +31,10 @@ jobs: - name: Build run: go vet . && go build -v . -# Very noisy, temporarily disabled -# - name: Run coverage -# run: go test -race -coverprofile=coverage.out -covermode=atomic ./... -# -# - name: Upload coverage to Codecov -# uses: codecov/codecov-action@v3 - - # run acceptance tests in a matrix with Terraform core versions test: - name: Matrix Test + name: Unit Tests needs: build runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - fail-fast: false - matrix: - # list whatever Terraform versions here you would like to support - terraform: - - '1.2.9' - - '1.3.8' - - '1.4.2' steps: - name: Check out code into the Go module directory @@ -65,13 +48,6 @@ jobs: - name: Get dependencies run: go mod download -# - name: TF acceptance tests -# timeout-minutes: 10 -# env: -# TF_ACC: "1" -# TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} -# run: go test -v -cover ./... - - name: Unit tests timeout-minutes: 10 run: go test -v -cover ./... diff --git a/Makefile b/Makefile index 013d8bcdd..1d1e93017 100644 --- a/Makefile +++ b/Makefile @@ -19,18 +19,22 @@ TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE=$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)/$(NAME) default: build +.PHONY: clean clean: rm -rf ./dist rm -rf ./cache rm -rf ./build +.PHONY: build build: mkdir -p "$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)" rm -f "$(TERRAFORM_PLUGIN_EXECUTABLE)" go build -o "$(TERRAFORM_PLUGIN_EXECUTABLE)" +.PHONY: example example: example-build example-init example-apply example-destroy +.PHONY: example-apply example-apply: export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \ && export TF_DISABLE_CHECKPOINT="true" \ @@ -38,11 +42,13 @@ example-apply: && cd ./example \ && terraform apply -auto-approve +.PHONY: example-build example-build: mkdir -p "$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)" rm -rf "$(TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE)" go build -o "$(TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE)" +.PHONY: example-destroy example-destroy: export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \ && export TF_DISABLE_CHECKPOINT="true" \ @@ -50,6 +56,7 @@ example-destroy: && cd ./example \ && terraform destroy -auto-approve +.PHONY: example-init example-init: export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \ && export TF_DISABLE_CHECKPOINT="true" \ @@ -58,6 +65,7 @@ example-init: && rm -f .terraform.lock.hcl \ && terraform init +.PHONY: example-plan example-plan: export TF_CLI_CONFIG_FILE="$(shell pwd -P)/example.tfrc" \ && export TF_DISABLE_CHECKPOINT="true" \ @@ -65,27 +73,39 @@ example-plan: && cd ./example \ && terraform plan +.PHONY: fmt fmt: gofmt -s -w $(GOFMT_FILES) +.PHONY: init init: go get ./... +.PHONY: test test: go test ./... +.PHONY: testacc +testacc: + TF_ACC=1 go test ./... + +.PHONY: lint lint: go run -modfile=tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --fix +.PHONY: release-build release-build: go run -modfile=tools/go.mod github.com/goreleaser/goreleaser build --clean --skip-validate +.PHONY: docs docs: @mkdir -p ./build/docs-gen @cd ./tools && go generate tools.go +.PHONY: targets targets: $(TARGETS) +.PHONY: $(TARGETS) $(TARGETS): GOOS=$@ GOARCH=amd64 CGO_ENABLED=0 go build \ -o "dist/$@/$(NAME)_v$(VERSION)-custom" \ @@ -93,5 +113,3 @@ $(TARGETS): zip \ -j "dist/$(NAME)_v$(VERSION)-custom_$@_amd64.zip" \ "dist/$@/$(NAME)_v$(VERSION)-custom" - -.PHONY: clean build example example-apply example-destroy example-init example-plan fmt init targets test docs $(TARGETS)