-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (99 loc) · 3.73 KB
/
Makefile
File metadata and controls
129 lines (99 loc) · 3.73 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
# Rock Node Makefile
# Common development tasks and commands
.PHONY: help install test fmt lint check build clean pre-commit setup-hooks
# Default target
help: ## Show this help message
@echo "Rock Node Development Commands"
@echo "=============================="
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Setup and Installation
install: ## Install all dependencies and setup development environment
@echo "📦 Installing Rust components..."
rustup component add rustfmt clippy
@echo "🔧 Setting up pre-commit hooks..."
./.pre-commit-install.sh
setup-hooks: ## Setup pre-commit hooks only
./.pre-commit-install.sh
# Code Quality
fmt: ## Format all Rust code
cargo fmt --all
lint: ## Run clippy linter
cargo clippy --all-targets --all-features --workspace -- -W clippy::pedantic -A clippy::doc_overindented_list_items -A clippy::doc_lazy_continuation -A clippy::large_enum_variant -A unused-imports -A dead-code -A clippy::derivable_impls -A clippy::clone_on_copy -A clippy::needless_borrows_for_generic_args -A clippy::empty_line_after_doc_comments -A clippy::assertions_on_constants
check: ## Check if code compiles
cargo check --all-targets --all-features --workspace
audit: ## Run security audit
cargo audit
# Testing
test: ## Run unit tests (excluding e2e)
cargo test --workspace --exclude e2e
test-all: ## Run all tests including e2e
cargo test --workspace
test-core: ## Run only core module tests
cargo test -p rock-node-core
test-coverage: ## Generate test coverage report (requires cargo-llvm-cov)
cargo llvm-cov --html --open
# Building
build: ## Build the project
cargo build
build-release: ## Build optimized release version
cargo build --release
# Cleaning
clean: ## Clean build artifacts
cargo clean
rm -rf target/
# Pre-commit
pre-commit: ## Run pre-commit hooks on all files
pre-commit run --all-files
pre-commit-update: ## Update pre-commit hooks
pre-commit autoupdate
# Development workflow
dev-check: fmt lint check test ## Run full development check (format, lint, compile, test)
@echo "✅ All development checks passed!"
ci-check: check lint test ## Run CI-like checks
@echo "✅ CI checks passed!"
# Quick commands
quick-test: ## Run quick tests for core modules only
cargo test -p rock-node-core --lib
quick-check: ## Quick compile check
cargo check --workspace
# Documentation
docs: ## Generate and open documentation
cargo doc --open --workspace
# Docker
docker-build: ## Build Docker image
docker build -t rock-node .
docker-test: ## Run tests in Docker
docker run --rm rock-node cargo test --workspace --exclude e2e
# Utility commands
deps: ## Show dependency tree
cargo tree
outdated: ## Check for outdated dependencies (requires cargo-outdated)
cargo outdated
update: ## Update dependencies
cargo update
# Git hooks
install-hooks: setup-hooks ## Alias for setup-hooks
# Help for new developers
new-dev: install dev-check ## Complete setup for new developers
@echo ""
@echo "🎉 Setup complete! You're ready to contribute to Rock Node!"
@echo ""
@echo "Next steps:"
@echo " • Make your changes"
@echo " • Run 'make dev-check' before committing"
@echo " • Commit your changes (hooks will run automatically)"
@echo ""
# Show status
status: ## Show project status
@echo "Rock Node Project Status"
@echo "======================="
@echo "📊 Code Statistics:"
@find . -name "*.rs" -not -path "./target/*" | wc -l | awk '{print " Rust files: " $$1}'
@echo ""
@echo "🧪 Test Status:"
@cargo test --workspace --exclude e2e -- --list | grep -c ": test" | awk '{print " Unit tests: " $$1}' || echo " Unit tests: 0"
@echo ""
@echo "📦 Dependencies:"
@cargo tree --depth 1 | head -5
@echo " ..."