Makefile 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # SeaweedFS RDMA Sidecar Makefile
  2. .PHONY: help build test clean docker-build docker-test docker-clean integration-test
  3. # Default target
  4. help: ## Show this help message
  5. @echo "SeaweedFS RDMA Sidecar - Available Commands:"
  6. @echo ""
  7. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
  8. @echo ""
  9. @echo "Examples:"
  10. @echo " make build # Build all components locally"
  11. @echo " make docker-test # Run complete Docker integration tests"
  12. @echo " make test # Run unit tests"
  13. # Local Build Targets
  14. build: build-go build-rust ## Build all components locally
  15. build-go: ## Build Go components (sidecar, demo-server, test-rdma)
  16. @echo "🔨 Building Go components..."
  17. go build -o bin/sidecar ./cmd/sidecar
  18. go build -o bin/demo-server ./cmd/demo-server
  19. go build -o bin/test-rdma ./cmd/test-rdma
  20. @echo "✅ Go build complete"
  21. build-rust: ## Build Rust RDMA engine
  22. @echo "🦀 Building Rust RDMA engine..."
  23. cd rdma-engine && cargo build --release
  24. @echo "✅ Rust build complete"
  25. # Testing Targets
  26. test: test-go test-rust ## Run all unit tests
  27. test-go: ## Run Go tests
  28. @echo "🧪 Running Go tests..."
  29. go test ./...
  30. @echo "✅ Go tests complete"
  31. test-rust: ## Run Rust tests
  32. @echo "🧪 Running Rust tests..."
  33. cd rdma-engine && cargo test
  34. @echo "✅ Rust tests complete"
  35. integration-test: build ## Run local integration test
  36. @echo "🔗 Running local integration test..."
  37. ./scripts/demo-e2e.sh
  38. @echo "✅ Local integration test complete"
  39. # Docker Targets
  40. docker-build: ## Build all Docker images
  41. @echo "🐳 Building Docker images..."
  42. docker-compose build
  43. @echo "✅ Docker images built"
  44. docker-start: ## Start Docker services
  45. @echo "🚀 Starting Docker services..."
  46. ./tests/docker-test-helper.sh start
  47. @echo "✅ Docker services started"
  48. docker-test: ## Run Docker integration tests
  49. @echo "🧪 Running Docker integration tests..."
  50. ./tests/docker-test-helper.sh test
  51. @echo "✅ Docker integration tests complete"
  52. docker-stop: ## Stop Docker services
  53. @echo "🛑 Stopping Docker services..."
  54. ./tests/docker-test-helper.sh stop
  55. @echo "✅ Docker services stopped"
  56. docker-clean: ## Clean Docker services and volumes
  57. @echo "🧹 Cleaning Docker environment..."
  58. ./tests/docker-test-helper.sh clean
  59. docker system prune -f
  60. @echo "✅ Docker cleanup complete"
  61. docker-logs: ## Show Docker logs
  62. ./tests/docker-test-helper.sh logs
  63. docker-status: ## Show Docker service status
  64. ./tests/docker-test-helper.sh status
  65. docker-shell: ## Open interactive shell in test container
  66. ./tests/docker-test-helper.sh shell
  67. # RDMA Simulation Targets
  68. rdma-sim-build: ## Build RDMA simulation environment
  69. @echo "🚀 Building RDMA simulation environment..."
  70. docker-compose -f docker-compose.rdma-sim.yml build
  71. @echo "✅ RDMA simulation images built"
  72. rdma-sim-start: ## Start RDMA simulation environment
  73. @echo "🚀 Starting RDMA simulation environment..."
  74. docker-compose -f docker-compose.rdma-sim.yml up -d
  75. @echo "✅ RDMA simulation environment started"
  76. rdma-sim-test: ## Run RDMA simulation tests
  77. @echo "🧪 Running RDMA simulation tests..."
  78. docker-compose -f docker-compose.rdma-sim.yml run --rm integration-tests-rdma
  79. @echo "✅ RDMA simulation tests complete"
  80. rdma-sim-stop: ## Stop RDMA simulation environment
  81. @echo "🛑 Stopping RDMA simulation environment..."
  82. docker-compose -f docker-compose.rdma-sim.yml down
  83. @echo "✅ RDMA simulation environment stopped"
  84. rdma-sim-clean: ## Clean RDMA simulation environment
  85. @echo "🧹 Cleaning RDMA simulation environment..."
  86. docker-compose -f docker-compose.rdma-sim.yml down -v --remove-orphans
  87. docker system prune -f
  88. @echo "✅ RDMA simulation cleanup complete"
  89. rdma-sim-status: ## Check RDMA simulation status
  90. @echo "📊 RDMA simulation status:"
  91. docker-compose -f docker-compose.rdma-sim.yml ps
  92. @echo ""
  93. @echo "🔍 RDMA device status:"
  94. docker-compose -f docker-compose.rdma-sim.yml exec rdma-simulation /opt/rdma-sim/test-rdma.sh || true
  95. rdma-sim-shell: ## Open shell in RDMA simulation container
  96. @echo "🐚 Opening RDMA simulation shell..."
  97. docker-compose -f docker-compose.rdma-sim.yml exec rdma-simulation /bin/bash
  98. rdma-sim-logs: ## Show RDMA simulation logs
  99. docker-compose -f docker-compose.rdma-sim.yml logs
  100. rdma-sim-ucx: ## Show UCX information in simulation
  101. @echo "📋 UCX information in simulation:"
  102. docker-compose -f docker-compose.rdma-sim.yml exec rdma-simulation /opt/rdma-sim/ucx-info.sh
  103. # Development Targets
  104. dev-setup: ## Set up development environment
  105. @echo "🛠️ Setting up development environment..."
  106. go mod tidy
  107. cd rdma-engine && cargo check
  108. chmod +x scripts/*.sh tests/*.sh
  109. @echo "✅ Development environment ready"
  110. format: ## Format code
  111. @echo "✨ Formatting code..."
  112. go fmt ./...
  113. cd rdma-engine && cargo fmt
  114. @echo "✅ Code formatted"
  115. lint: ## Run linters
  116. @echo "🔍 Running linters..."
  117. go vet ./...
  118. cd rdma-engine && cargo clippy -- -D warnings
  119. @echo "✅ Linting complete"
  120. # Cleanup Targets
  121. clean: clean-go clean-rust ## Clean all build artifacts
  122. clean-go: ## Clean Go build artifacts
  123. @echo "🧹 Cleaning Go artifacts..."
  124. rm -rf bin/
  125. go clean -testcache
  126. @echo "✅ Go artifacts cleaned"
  127. clean-rust: ## Clean Rust build artifacts
  128. @echo "🧹 Cleaning Rust artifacts..."
  129. cd rdma-engine && cargo clean
  130. @echo "✅ Rust artifacts cleaned"
  131. # Full Workflow Targets
  132. check: format lint test ## Format, lint, and test everything
  133. ci: check integration-test docker-test ## Complete CI workflow
  134. demo: build ## Run local demo
  135. @echo "🎮 Starting local demo..."
  136. ./scripts/demo-e2e.sh
  137. # Docker Development Workflow
  138. docker-dev: docker-clean docker-build docker-test ## Complete Docker development cycle
  139. # Quick targets
  140. quick-test: build ## Quick local test
  141. ./bin/test-rdma --help
  142. quick-docker: ## Quick Docker test
  143. docker-compose up -d rdma-engine rdma-sidecar
  144. sleep 5
  145. curl -s http://localhost:8081/health | jq '.'
  146. docker-compose down
  147. # Help and Documentation
  148. docs: ## Generate/update documentation
  149. @echo "📚 Documentation ready:"
  150. @echo " README.md - Main project documentation"
  151. @echo " DOCKER-TESTING.md - Docker integration testing guide"
  152. @echo " Use 'make help' for available commands"
  153. # Environment Info
  154. info: ## Show environment information
  155. @echo "🔍 Environment Information:"
  156. @echo " Go Version: $$(go version)"
  157. @echo " Rust Version: $$(cd rdma-engine && cargo --version)"
  158. @echo " Docker Version: $$(docker --version)"
  159. @echo " Docker Compose Version: $$(docker-compose --version)"
  160. @echo ""
  161. @echo "🏗️ Project Structure:"
  162. @echo " Go Components: cmd/ pkg/"
  163. @echo " Rust Engine: rdma-engine/"
  164. @echo " Tests: tests/"
  165. @echo " Scripts: scripts/"