terraform-provider-stackitp.../Makefile
Marcel S. Henselin 9f41c4da7f
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 29s
Publish / Publish provider (push) Failing after 4m24s
feat: auto generated files and new structure (#4)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 14:10:25 +00:00

68 lines
2.1 KiB
Makefile

ROOT_DIR ?= $(shell git rev-parse --show-toplevel)
SCRIPTS_BASE ?= $(ROOT_DIR)/scripts
VERSION ?= ${VER}
# SETUP AND TOOL INITIALIZATION TASKS
project-help:
@$(SCRIPTS_BASE)/project.sh help
project-tools:
@$(SCRIPTS_BASE)/project.sh tools
# LINT
lint-golangci-lint:
@echo "Linting with golangci-lint"
@$(SCRIPTS_BASE)/lint-golangci-lint.sh
lint-tf:
@echo "Linting terraform files"
@terraform fmt -check -diff -recursive
lint: lint-golangci-lint lint-tf
# DOCUMENTATION GENERATION
generate-docs:
@echo "Generating documentation with tfplugindocs"
@$(SCRIPTS_BASE)/tfplugindocs.sh
build:
@go build -o bin/terraform-provider-stackitprivatepreview
fmt:
@gofmt -s -w .
@go tool goimports -w .
@terraform fmt -diff -recursive
# TEST
test:
@echo "Running tests for the terraform provider"
@cd $(ROOT_DIR)/stackit && go test ./... -count=1 -coverprofile=coverage.out && cd $(ROOT_DIR)
# Test coverage
coverage:
@echo ">> Creating test coverage report for the terraform provider"
@cd $(ROOT_DIR)/stackit && (go test ./... -count=1 -coverprofile=coverage.out || true) && cd $(ROOT_DIR)
@cd $(ROOT_DIR)/stackit && go tool cover -html=coverage.out -o coverage.html && cd $(ROOT_DIR)
test-acceptance-tf:
@if [ -z $(TF_ACC_PROJECT_ID) ]; then echo "Input TF_ACC_PROJECT_ID missing"; exit 1; fi
@if [ -z $(TF_ACC_ORGANIZATION_ID) ]; then echo "Input TF_ACC_ORGANIZATION_ID missing"; exit 1; fi
@if [ -z $(TF_ACC_REGION) ]; then echo "Input TF_ACC_REGION missing"; exit 1; fi
@if [ -z $(TF_ACC_TEST_IMAGE_LOCAL_FILE_PATH) ]; then \
echo "Input TF_ACC_TEST_IMAGE_LOCAL_FILE_PATH missing. Creating a default file for testing."; \
fi
@echo "Running acceptance tests for the terraform provider"
@cd $(ROOT_DIR)/stackit && TF_ACC=1 \
TF_ACC_PROJECT_ID=$(TF_ACC_PROJECT_ID) \
TF_ACC_ORGANIZATION_ID=$(TF_ACC_ORGANIZATION_ID) \
TF_ACC_REGION=$(TF_ACC_REGION) \
go test ./... -count=1 -timeout=30m && \
cd $(ROOT_DIR)
publish: build
ifeq ($(strip $(VERSION)),)
@echo "please call like this: VER=0.1.0 make publish"
else
@echo "version: $(VERSION)"
endif