Makefile
1 # Kamaji Go Makefile 2 3 .PHONY: test test-unit test-integration test-cli test-coverage build clean help install 4 5 # Default target 6 all: test build 7 8 # Run all tests 9 test: 10 @echo "๐งช Running complete test suite..." 11 @./run_tests.sh 12 13 # Run unit tests only 14 test-unit: 15 @echo "๐ Running unit tests..." 16 @go test -v ./internal/tools/... ./internal/config/... ./internal/providers/... 17 18 # Run integration tests only 19 test-integration: 20 @echo "๐ Running integration tests..." 21 @go test -v ./test/... 22 23 # Run CLI tests only 24 test-cli: 25 @echo "๐ป Running CLI tests..." 26 @go test -v ./test/cli_test.go 27 28 # Run tests with coverage 29 test-coverage: 30 @echo "๐ Running tests with coverage..." 31 @go test -cover ./internal/... ./test/... 32 33 # Run benchmarks 34 bench: 35 @echo "โก Running benchmarks..." 36 @go test -bench=. -benchmem ./test/... 37 38 # Build binary 39 build: 40 @echo "๐๏ธ Building Kamaji..." 41 @./scripts/bump_version.sh 42 @go build -o bin/kamaji ./cmd/kamaji 43 @echo "โ Build complete: bin/kamaji" 44 45 # Build for multiple platforms 46 build-all: 47 @echo "๐ Building for multiple platforms..." 48 @./scripts/bump_version.sh 49 @GOOS=linux GOARCH=amd64 go build -o bin/kamaji-linux-amd64 ./cmd/kamaji 50 @GOOS=darwin GOARCH=amd64 go build -o bin/kamaji-darwin-amd64 ./cmd/kamaji 51 @GOOS=darwin GOARCH=arm64 go build -o bin/kamaji-darwin-arm64 ./cmd/kamaji 52 @GOOS=windows GOARCH=amd64 go build -o bin/kamaji-windows-amd64.exe ./cmd/kamaji 53 @echo "โ Multi-platform build complete" 54 55 # Install globally 56 install: build 57 @echo "๐ฆ Installing Kamaji globally..." 58 @sudo rm -f /usr/local/bin/kamaji 59 @sudo cp bin/kamaji /usr/local/bin/kamaji 60 @sudo chmod +x /usr/local/bin/kamaji 61 @sudo xattr -d com.apple.quarantine /usr/local/bin/kamaji 2>/dev/null || true 62 @echo "โ Kamaji installed to /usr/local/bin/kamaji" 63 @echo "๐ฅ You can now run 'kamaji' from anywhere!" 64 @echo "" 65 @echo "Testing installation..." 66 @/usr/local/bin/kamaji version || (echo "โ Installation failed, using local binary" && echo "#!/bin/bash" > /tmp/kamaji_wrapper && echo "exec \"$(PWD)/bin/kamaji\" \"\$$@\"" >> /tmp/kamaji_wrapper && sudo mv /tmp/kamaji_wrapper /usr/local/bin/kamaji && sudo chmod +x /usr/local/bin/kamaji) 67 68 # Clean build artifacts 69 clean: 70 @echo "๐งน Cleaning..." 71 @rm -rf bin/ 72 @go clean 73 @echo "โ Clean complete" 74 75 # Install dependencies 76 deps: 77 @echo "๐ฆ Installing dependencies..." 78 @go mod tidy 79 @go mod download 80 @echo "โ Dependencies installed" 81 82 # Run linter 83 lint: 84 @echo "๐ Running linter..." 85 @go vet ./... 86 @go fmt ./... 87 @echo "โ Linting complete" 88 89 # Quick test (fast subset) 90 test-quick: 91 @echo "โก Running quick tests..." 92 @go test -short ./internal/tools/... ./test/suite_test.go 93 94 # Development workflow 95 dev: deps lint test-quick build 96 @echo "๐ Development build complete" 97 98 # Release workflow 99 release: deps lint test build-all 100 @echo "๐ Release build complete" 101 102 # Help 103 help: 104 @echo "Kamaji Go Build System" 105 @echo "=====================" 106 @echo "" 107 @echo "Targets:" 108 @echo " build - Build single binary" 109 @echo " install - Install to ~/.local/bin" 110 @echo " test - Run complete test suite" 111 @echo " test-unit - Run unit tests only" 112 @echo " test-integration - Run integration tests only" 113 @echo " test-cli - Run CLI tests only" 114 @echo " test-coverage - Run tests with coverage" 115 @echo " bench - Run benchmarks" 116 @echo " build-all - Build for multiple platforms" 117 @echo " clean - Clean build artifacts" 118 @echo " deps - Install dependencies" 119 @echo " lint - Run linter and formatter" 120 @echo " test-quick - Run fast subset of tests" 121 @echo " dev - Development workflow" 122 @echo " release - Release workflow" 123 @echo " help - Show this help"