-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
163 lines (135 loc) · 7.09 KB
/
Makefile
File metadata and controls
163 lines (135 loc) · 7.09 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Central Makefile chaining targets in other Makefiles
.PHONY: setup lint test test-unit test-component clean-component test-integration clean-integration test-e2e up-e2e clean-e2e diagnostics-e2e build-go build-images clean cov docs-serve docs-build
MAKEFLAGS += --no-print-directory
.EXPORT_ALL_VARIABLES:
GREEN_START := \033[32m
GREEN_END := \033[0m
GOLANGCI_LINT_VERSION := v1.64.8
GOIMPORTS_VERSION := v0.28.0
# =============================================================================
# Development
# =============================================================================
setup: ## Set up development environment (install deps, pre-commit hooks)
@echo "[.] Setting up development environment..."
@command -v uv >/dev/null 2>&1 || (echo "[-] uv not found. Install: curl -LsSf https://astral.sh/uv/install.sh | sh" && exit 1)
@command -v go >/dev/null 2>&1 || (echo "[-] Go not found. Install Go 1.24+" && exit 1)
@echo "[+] Installing Python development tools..."
uv venv --allow-existing
uv pip install pre-commit
@echo "[+] Installing Go linting tools..."
@command -v goimports >/dev/null 2>&1 || go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
@command -v golangci-lint >/dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
@echo "[+] Installing pre-commit hooks..."
uv run pre-commit install
@echo "[+] Syncing Go dependencies..."
cd src/asya-gateway && go mod download && go mod tidy
cd src/asya-sidecar && go mod download && go mod tidy
cd src/asya-injector && go mod download && go mod tidy
cd src/function-asya-overlays && go mod download && go mod tidy
cd src/asya-crew/cmd/dlq-worker && go mod download && go mod tidy
@echo "[++] Setup complete! Ready for development."
setup-dev: setup ## Alias for setup (backwards compatibility)
install-dev: setup ## Alias for setup (backwards compatibility)
lint:
uv run pre-commit run --show-diff-on-failure -a
# =============================================================================
# Unit + integration tests
# =============================================================================
test: test-unit test-integration ## Run all unit+integration tests
@echo "$(GREEN_START)[+++] Success: All unit+integration tests completed successfully!$(GREEN_END)"
# =============================================================================
# Unit tests
# =============================================================================
test-unit: ## Run unit tests (go + python)
$(MAKE) -C src/asya-sidecar test-unit
$(MAKE) -C src/asya-gateway test-unit
$(MAKE) -C src/asya-runtime test-unit
$(MAKE) -C src/asya-crew test-unit
$(MAKE) -C src/asya-crew/cmd/dlq-worker test-unit
$(MAKE) -C src/asya-cli test-unit
$(MAKE) -C src/asya-injector test-unit
$(MAKE) -C src/asya-lab test-unit
$(MAKE) -C src/asya-state-proxy test-unit
$(MAKE) -C src/asya-ui test-unit
$(MAKE) -C src/function-asya-overlays test-unit
$(MAKE) -C src/asya-testing test-unit
@echo "$(GREEN_START)[++] Success: All unit tests completed successfully!$(GREEN_END)"
# =============================================================================
# Component tests (single component + lightweight mocks in docker-compose)
# =============================================================================
test-component: ## Run all component tests
$(MAKE) -C testing/component test
clean-component: ## Clean component test Docker resources
$(MAKE) -C testing/component clean
# =============================================================================
# Integration tests (multiple components in docker-compose)
# =============================================================================
test-integration: ## Run all integration tests
$(MAKE) -C testing/integration test
@echo "$(GREEN_START)[++] Success: All integration tests completed successfully!$(GREEN_END)"
clean-integration: ## Clean up integration test Docker resources
$(MAKE) -C testing/integration clean
docker ps
# =============================================================================
# End-to-end tests (in Kind)
# =============================================================================
test-e2e: ## Run complete E2E tests (deploy → test → cleanup)
$(MAKE) -C testing/e2e test
@echo "$(GREEN_START)[++] Success: All e2e tests completed successfully!$(GREEN_END)"
clean-e2e: ## Delete Kind cluster and cleanup
$(MAKE) -C testing/e2e clean
# =============================================================================
# Coverage
# =============================================================================
cov: ## Run all tests with coverage and display summary
$(MAKE) -C src/asya-sidecar cov-unit
$(MAKE) -C src/asya-gateway cov-unit
$(MAKE) -C src/asya-injector cov-unit
$(MAKE) -C src/asya-runtime cov-unit
$(MAKE) -C src/asya-crew cov-unit
$(MAKE) -C src/asya-crew/cmd/dlq-worker cov-unit
$(MAKE) -C src/asya-cli cov-unit
$(MAKE) -C src/asya-lab cov-unit
$(MAKE) -C src/asya-ui cov-unit
$(MAKE) -C src/function-asya-overlays cov-unit
$(MAKE) -C testing/integration cov
$(MAKE) -C testing/component cov
$(MAKE) -C testing/e2e cov-e2e
# =============================================================================
# Build
# =============================================================================
build-go: ## Build all Go components
$(MAKE) -C src/asya-gateway build
$(MAKE) -C src/asya-sidecar build
$(MAKE) -C src/asya-injector build
$(MAKE) -C src/function-asya-overlays build
$(MAKE) -C src/asya-crew/cmd/dlq-worker build
@echo "$(GREEN_START)[++] Success: All Go components built successfully!$(GREEN_END)"
build-images: ## Build all Docker images for the framework
./src/build-images.sh
clean: clean-integration ## Clean build artifacts
$(MAKE) -C src/function-asya-overlays clean
$(MAKE) -C src/asya-crew clean
$(MAKE) -C src/asya-crew/cmd/dlq-worker clean
$(MAKE) -C src/asya-lab clean
$(MAKE) -C src/asya-sidecar clean
$(MAKE) -C src/asya-runtime clean
$(MAKE) -C src/asya-gateway clean
$(MAKE) -C src/asya-ui clean
PROFILE=sqs-s3 $(MAKE) -C testing/e2e clean
PROFILE=rabbitmq-minio $(MAKE) -C testing/e2e clean
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "cov*.json" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name ".cov-db" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".coverage" -exec rm -rf {} + 2>/dev/null || true
# =============================================================================
# Documentation
# =============================================================================
docs-serve: docs-build ## Serve docs locally at http://127.0.0.1:8000
@uv run mkdocs --version >/dev/null 2>&1 || (echo "[.] Installing MkDocs..." && uv pip install mkdocs mkdocs-shadcn pygments mkdocs-mermaid2-plugin)
uv run mkdocs serve
docs-build: ## Build docs to site/ directory
@uv run mkdocs --version >/dev/null 2>&1 || (echo "[.] Installing MkDocs..." && uv pip install mkdocs mkdocs-shadcn pygments mkdocs-mermaid2-plugin)
uv run mkdocs build