2025-06-03 13:23:45 +02:00
|
|
|
default: fmt lint install generate
|
|
|
|
|
2025-06-06 10:51:40 +02:00
|
|
|
dist-clean:
|
2025-06-03 14:37:44 +02:00
|
|
|
go clean -cache -modcache -testcache
|
|
|
|
|
2025-06-06 10:51:40 +02:00
|
|
|
clean:
|
|
|
|
rm -f ./terraform-provider-tor ./provider.test
|
|
|
|
find e2e-tests -type f -name '*.tfstate*' -delete
|
|
|
|
find e2e-tests -type d -name '.terraform' -prune -exec rm -rf ./{} \;
|
|
|
|
find e2e-tests -type d -name 'providers' -prune -exec rm -rf ./{} \;
|
|
|
|
|
2025-06-03 13:23:45 +02:00
|
|
|
build:
|
2025-06-06 10:51:40 +02:00
|
|
|
go build
|
2025-06-03 13:23:45 +02:00
|
|
|
|
|
|
|
install: build
|
2025-06-06 10:51:40 +02:00
|
|
|
go install
|
2025-06-03 13:23:45 +02:00
|
|
|
|
|
|
|
lint:
|
2025-06-03 14:37:44 +02:00
|
|
|
go mod tidy
|
2025-06-03 13:23:45 +02:00
|
|
|
golangci-lint run
|
|
|
|
|
|
|
|
generate:
|
|
|
|
cd tools; go generate ./...
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
gofmt -s -w -e .
|
|
|
|
|
2025-06-03 14:37:44 +02:00
|
|
|
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
|
|
|
|
|
2025-06-03 13:23:45 +02:00
|
|
|
test:
|
|
|
|
go test -v -cover -timeout=120s -parallel=10 ./...
|
|
|
|
|
|
|
|
testacc:
|
|
|
|
TF_ACC=1 go test -v -cover -timeout 120m ./...
|
|
|
|
|
2025-06-06 10:51:40 +02:00
|
|
|
e2e/%:
|
|
|
|
@echo "Executing end-to-end test: $*"
|
|
|
|
cd e2e-tests/$* && ./test.sh
|
|
|
|
|
|
|
|
e2e: clean build e2e/obfs4 e2e/tor-family
|
2025-06-03 14:28:37 +02:00
|
|
|
|
2025-06-03 14:34:20 +02:00
|
|
|
ci:
|
2025-06-03 14:37:44 +02:00
|
|
|
@echo "Running CI pipeline..."
|
|
|
|
@echo "1/5 Checking code formatting..."
|
|
|
|
$(MAKE) fmtcheck
|
|
|
|
@echo "2/5 Building provider..."
|
2025-06-03 14:34:20 +02:00
|
|
|
$(MAKE) build
|
2025-06-03 14:37:44 +02:00
|
|
|
@echo "3/5 Running linter..."
|
|
|
|
$(MAKE) lint
|
|
|
|
@echo "4/5 Running acceptance tests..."
|
2025-06-03 14:34:20 +02:00
|
|
|
$(MAKE) testacc
|
2025-06-03 14:37:44 +02:00
|
|
|
@echo "5/5 Running end-to-end tests..."
|
2025-06-03 14:34:20 +02:00
|
|
|
$(MAKE) e2e
|
2025-06-03 14:37:44 +02:00
|
|
|
@echo "✓ CI pipeline completed successfully!"
|
2025-06-03 14:34:20 +02:00
|
|
|
|
2025-06-03 14:37:44 +02:00
|
|
|
.PHONY: fmt fmtcheck lint test testacc build install generate e2e ci clean
|