61 lines
1.4 KiB
Makefile
61 lines
1.4 KiB
Makefile
default: fmt lint install generate
|
|
|
|
clean:
|
|
go clean -cache -modcache -testcache
|
|
|
|
build:
|
|
go build -v ./...
|
|
|
|
install: build
|
|
go install -v ./...
|
|
|
|
lint:
|
|
go mod tidy
|
|
golangci-lint run
|
|
|
|
generate:
|
|
cd tools; go generate ./...
|
|
|
|
fmt:
|
|
gofmt -s -w -e .
|
|
|
|
fmtcheck:
|
|
@if [ -n "$$(gofmt -s -l .)" ]; then \
|
|
echo "The following files are not formatted:"; \
|
|
gofmt -s -l .; \
|
|
echo "Run 'make fmt' to fix formatting issues."; \
|
|
exit 1; \
|
|
fi
|
|
|
|
test:
|
|
go test -v -cover -timeout=120s -parallel=10 ./...
|
|
|
|
testacc:
|
|
TF_ACC=1 go test -v -cover -timeout 120m ./...
|
|
|
|
e2e:
|
|
@echo "Running end-to-end test..."
|
|
cd e2e-test && \
|
|
rm -rf .terraform/ .terraform.lock.hcl terraform.tfstate* && \
|
|
./setup-dev.sh && \
|
|
TF_CLI_CONFIG_FILE=.terraformrc tofu plan && \
|
|
TF_CLI_CONFIG_FILE=.terraformrc tofu apply -auto-approve && \
|
|
echo "✓ E2E test passed! Cleaning up..." && \
|
|
TF_CLI_CONFIG_FILE=.terraformrc tofu destroy -auto-approve && \
|
|
echo "✓ E2E test completed successfully"
|
|
|
|
ci:
|
|
@echo "Running CI pipeline..."
|
|
@echo "1/5 Checking code formatting..."
|
|
$(MAKE) fmtcheck
|
|
@echo "2/5 Building provider..."
|
|
$(MAKE) build
|
|
@echo "3/5 Running linter..."
|
|
$(MAKE) lint
|
|
@echo "4/5 Running acceptance tests..."
|
|
$(MAKE) testacc
|
|
@echo "5/5 Running end-to-end tests..."
|
|
$(MAKE) e2e
|
|
@echo "✓ CI pipeline completed successfully!"
|
|
|
|
.PHONY: fmt fmtcheck lint test testacc build install generate e2e ci clean
|