-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (95 loc) · 3.7 KB
/
Copy pathMakefile
File metadata and controls
119 lines (95 loc) · 3.7 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
.PHONY: help \
core-build core-test core-clean core-run core-dev core-fmt core-lint core-deps core-deps-update \
web-deps web-dev web-build web-prepare web-clean web-lint \
docker-build docker-run \
dev-env-setup dev-env-clean dev-env-status \
test-workloads-setup test-workloads-clean
# Variables
WEB_DIR=web
PNPM=corepack pnpm
CORE_DIR=core
CORE_BUILD_ENV=CGO_ENABLED=0
BINARY_NAME=mochi
MAIN_PATH=./cmd/mochi
VERSION?=dev
BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
GIT_COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT)"
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-25s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Core (Go)
core-build: ## Build the core binary
@echo "Building $(BINARY_NAME)..."
@cd $(CORE_DIR) && $(CORE_BUILD_ENV) go build $(LDFLAGS) -o ../bin/$(BINARY_NAME) $(MAIN_PATH)
core-test: ## Run core tests (with race detector)
@echo "Running core tests..."
@cd $(CORE_DIR) && go test -v -race ./...
core-clean: ## Clean core build artifacts
@echo "Cleaning..."
@rm -rf bin/
@cd $(CORE_DIR) && go clean
core-run: core-build ## Build and run the core binary
@./bin/$(BINARY_NAME)
core-dev: ## Run core in development mode
@echo "Running core in development mode..."
@cd $(CORE_DIR) && go run $(MAIN_PATH)
core-fmt: ## Format core code
@echo "Formatting core code..."
@cd $(CORE_DIR) && go fmt ./...
core-lint: ## Run go vet on core
@echo "Running go vet on core..."
@cd $(CORE_DIR) && go vet ./...
core-deps: ## Download and tidy core dependencies
@echo "Downloading core dependencies..."
@cd $(CORE_DIR) && go mod download && go mod tidy
core-deps-update: ## Update core dependencies
@echo "Updating core dependencies..."
@cd $(CORE_DIR) && go get -u ./... && go mod tidy
# Web (Nuxt)
web-deps: ## Install web dependencies
@echo "Installing web dependencies..."
@cd $(WEB_DIR) && $(PNPM) install
web-dev: ## Run Nuxt dev server
@echo "Running web dev server..."
@cd $(WEB_DIR) && $(PNPM) dev
web-build: ## Build Nuxt for production
@echo "Building web..."
@cd $(WEB_DIR) && $(PNPM) build
web-prepare: ## Generate Nuxt types and module stubs
@echo "Preparing web..."
@cd $(WEB_DIR) && $(PNPM) exec nuxt prepare
web-clean: ## Remove Nuxt build artifacts
@echo "Cleaning web build artifacts..."
@rm -rf $(WEB_DIR)/.output $(WEB_DIR)/.nitro $(WEB_DIR)/.cache $(WEB_DIR)/.data
web-lint: ## Lint web code
@echo "Linting web..."
@cd $(WEB_DIR) && $(PNPM) lint
# Docker
docker-build: ## Build Docker image
@echo "Building Docker image..."
@docker build \
--build-arg VERSION=$(VERSION) \
--build-arg BUILD_TIME=$(BUILD_TIME) \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
-t $(BINARY_NAME):$(VERSION) .
docker-run: docker-build ## Build and run Docker container
@docker run --rm $(BINARY_NAME):$(VERSION)
# Development environment (minikube / Helm)
dev-env-setup: ## Set up PostgreSQL, Prometheus, and Redis in minikube using Helm
@chmod +x scripts/setup-dev.sh
@./scripts/setup-dev.sh
dev-env-clean: ## Remove PostgreSQL, Prometheus, and Redis from minikube
@chmod +x scripts/cleanup-dev.sh
@./scripts/cleanup-dev.sh
dev-env-status: ## Check status of development environment
@chmod +x scripts/status-dev.sh
@./scripts/status-dev.sh
test-workloads-setup: ## Set up test workloads (Deployment, DaemonSet, Standalone Pod) in minikube
@chmod +x scripts/setup-test-workloads.sh
@./scripts/setup-test-workloads.sh
test-workloads-clean: ## Remove test workloads from minikube
@chmod +x scripts/cleanup-test-workloads.sh
@./scripts/cleanup-test-workloads.sh