forked from iflytek/astron-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (93 loc) Β· 5.42 KB
/
Makefile
File metadata and controls
111 lines (93 loc) Β· 5.42 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
# =============================================================================
# Multi-language CI/CD Toolchain - Optimized Main Makefile (Only 15 Core Commands)
# Streamlined from 95 commands to 15 core commands, providing intelligent project detection and automated workflows
# =============================================================================
# Include core modules
include makefiles/core/detection.mk
include makefiles/core/workflows.mk
# Include original language modules (for internal calls)
include makefiles/go.mk
include makefiles/typescript.mk
include makefiles/java.mk
include makefiles/python.mk
include makefiles/git.mk
include makefiles/common.mk
include makefiles/comment-check.mk
# =============================================================================
# Core command declarations
# =============================================================================
.PHONY: help setup check test build push clean status info lint ci hooks
# =============================================================================
# Tier 1: Daily Core Commands (7) - These are all you need to remember!
# =============================================================================
# Default target - Intelligent help
.DEFAULT_GOAL := help
help: ## π Show help information and project status
@echo "$(BLUE)π Multi-language CI/CD Toolchain - Intelligent Version$(RESET)"
@echo "$(YELLOW)Active Projects:$(RESET) $(GREEN)$(ACTIVE_PROJECTS)$(RESET) | $(YELLOW)Current Context:$(RESET) $(GREEN)$(CURRENT_CONTEXT)$(RESET)"
@echo ""
@echo "$(BLUE)π Core Commands (Daily Development):$(RESET)"
@echo " $(GREEN)make setup$(RESET) π οΈ One-time environment setup (tools+hooks+branch strategy)"
@echo " $(GREEN)make check$(RESET) π Quality check including format (intelligent detection: $(ACTIVE_PROJECTS))"
@echo " $(GREEN)make test$(RESET) π§ͺ Run tests (intelligent detection: $(ACTIVE_PROJECTS))"
@echo " $(GREEN)make build$(RESET) π¦ Build projects (intelligent detection: $(ACTIVE_PROJECTS))"
@echo " $(GREEN)make push$(RESET) π€ Safe push to remote (with pre-checks)"
@echo " $(GREEN)make clean$(RESET) π§Ή Clean build artifacts"
@echo ""
@echo "$(BLUE)π§ Professional Commands:$(RESET)"
@echo " $(GREEN)make status$(RESET) π Show detailed project status"
@echo " $(GREEN)make info$(RESET) βΉοΈ Show tools and dependency information"
@echo " $(GREEN)make lint$(RESET) π§ Run code linting (alias for check)"
@echo " $(GREEN)make ci$(RESET) π€ Complete CI pipeline (check+test+build)"
@echo " $(GREEN)make hooks$(RESET) βοΈ Git hooks management menu"
@echo ""
@echo "$(YELLOW)β οΈ CI Philosophy: Check-only, no auto-fix$(RESET)"
@echo " CI systems detect issues, developers fix them manually"
@echo ""
@if [ "$(IS_MULTI_PROJECT)" = "true" ]; then \
echo "$(YELLOW)π‘ Multi-project environment detected, all commands will intelligently handle multiple projects$(RESET)"; \
else \
echo "$(YELLOW)π‘ Single project environment, please run common commands in corresponding subdirectories (setup/check/test/build)$(RESET)"; \
fi
# Core workflow commands - Direct calls to intelligent implementations
setup: smart_setup ## π οΈ One-time environment setup (tools+hooks+branch strategy)
check: smart_check ## π Intelligent code quality check (detect active projects)
test: smart_test ## π§ͺ Intelligent test execution (detect active projects)
build: smart_build ## π¦ Intelligent project build (detect active projects)
push: smart_push ## π€ Intelligent safe push (branch check + quality check)
clean: smart_clean ## π§Ή Intelligent cleanup of build artifacts
# =============================================================================
# Tier 2: Professional Commands (5)
# =============================================================================
status: smart_status ## π Show detailed project status
info: smart_info ## βΉοΈ Show tools and dependency information
lint: smart_check ## π§ Run code linting (alias for check)
ci: smart_ci ## π€ Complete CI pipeline (check + test + build)
hooks: ## βοΈ Git hooks management menu
@echo "$(BLUE)βοΈ Git Hooks Management$(RESET)"
@echo ""
@echo "$(GREEN)Install Hooks:$(RESET)"
@echo " make hooks-install π Install all hooks (recommended)"
@echo " make hooks-commit-msg π¬ Commit message hooks only"
@echo " make hooks-pre-push π Pre-push hooks only"
@echo ""
@echo "$(RED)Uninstall Hooks:$(RESET)"
@echo " make hooks-uninstall β Uninstall all hooks"
@echo ""
@echo "$(YELLOW)β οΈ Note: Hooks only check code, no auto-formatting$(RESET)"
@echo ""
@echo "$(YELLOW)Current Hook Status:$(RESET)"
@ls -la .git/hooks/ | grep -E "(pre-commit|commit-msg|pre-push)" | head -3
# =============================================================================
# Hidden utility commands (for debugging and testing)
# =============================================================================
_debug: ## π [Debug] Test project detection and Makefile status
@echo "$(YELLOW)Project Detection Test:$(RESET)"
@echo "ACTIVE_PROJECTS: '$(ACTIVE_PROJECTS)'"
@echo "CURRENT_CONTEXT: '$(CURRENT_CONTEXT)'"
@echo "PROJECT_COUNT: $(PROJECT_COUNT)"
@echo "IS_MULTI_PROJECT: $(IS_MULTI_PROJECT)"
$(call show_project_status)
@echo ""
@echo "$(BLUE)Current Makefile Status:$(RESET)"
@echo "Included modules: detection.mk workflows.mk + original language modules"