-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGNUmakefile
More file actions
44 lines (38 loc) · 1.12 KB
/
GNUmakefile
File metadata and controls
44 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
default: testacc
# Test configuration
TEST ?= ./...
RUN ?= TestAcc
TESTARGS ?=
# Function to run tests with optional .env.test loading
define run_test
@if [ -z "$$HOOKDECK_API_KEY" ] || [ -z "$$TF_ACC" ]; then \
if [ -f .env.test ]; then \
echo "📋 Loading from .env.test..."; \
set -a; source .env.test; set +a; \
else \
echo "❌ Missing configuration:"; \
[ -z "$$HOOKDECK_API_KEY" ] && echo " - HOOKDECK_API_KEY not set"; \
[ -z "$$TF_ACC" ] && echo " - TF_ACC not set"; \
echo ""; \
echo "💡 To fix:"; \
echo " 1. Copy .env.test.example to .env.test"; \
echo " 2. Add your HOOKDECK_API_KEY to .env.test"; \
echo " OR"; \
echo " 3. Export variables in your shell"; \
exit 1; \
fi; \
fi; \
echo "🧪 Running tests on $(1)..."; \
go test $(1) -v -run $(2) $(TESTARGS) -timeout 120m
endef
# Run acceptance tests
.PHONY: testacc
testacc:
$(call run_test,$(TEST),$(RUN))
generate:
go generate ./...
generate-tfdocs:
go generate ./cmd/tfdocs/...
enable-git-hooks:
git config --local include.path ../.gitconfig
$(warning REMEMBER, YOU MUST HAVE REVIEWED THE CUSTOM HOOKS!)