temp for tree extraction
This commit is contained in:
109
Makefile
Normal file
109
Makefile
Normal file
@ -0,0 +1,109 @@
|
||||
# Makefile for Onyx
|
||||
.PHONY: build test clean install lint security ci integration
|
||||
|
||||
# Default target
|
||||
all: clean lint test build
|
||||
|
||||
build:
|
||||
@echo "Building Onyx CLI and daemon..."
|
||||
@mkdir -p bin
|
||||
go build -ldflags="-s -w" -o bin/onx ./cmd/onx
|
||||
go build -ldflags="-s -w" -o bin/onxd ./cmd/onxd
|
||||
@echo "Build complete: bin/onx, bin/onxd"
|
||||
|
||||
test:
|
||||
@echo "Running unit tests..."
|
||||
go test -v -race -coverprofile=coverage.out ./...
|
||||
@echo "Test coverage generated: coverage.out"
|
||||
|
||||
integration: build
|
||||
@echo "Running integration tests..."
|
||||
@mkdir -p test
|
||||
@./test/integration_test.sh
|
||||
|
||||
coverage: test
|
||||
@echo "Coverage report:"
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
@echo "Coverage report generated: coverage.html"
|
||||
|
||||
lint:
|
||||
@echo "Running linter..."
|
||||
golangci-lint run
|
||||
|
||||
security:
|
||||
@echo "Running security scan..."
|
||||
@which gosec > /dev/null || (echo "Installing gosec..." && go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest)
|
||||
gosec ./...
|
||||
|
||||
ci: lint security test build
|
||||
@echo "CI pipeline completed successfully"
|
||||
|
||||
install:
|
||||
go install ./cmd/onx
|
||||
go install ./cmd/onxd
|
||||
|
||||
clean:
|
||||
rm -rf bin/ coverage.out coverage.html
|
||||
|
||||
# Development targets
|
||||
dev-setup:
|
||||
@echo "Setting up development environment..."
|
||||
go mod download
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
|
||||
@echo "Development tools installed"
|
||||
|
||||
fmt:
|
||||
@echo "Formatting code..."
|
||||
go fmt ./...
|
||||
goimports -w .
|
||||
|
||||
mod-tidy:
|
||||
@echo "Tidying modules..."
|
||||
go mod tidy
|
||||
|
||||
deps-update:
|
||||
@echo "Updating dependencies..."
|
||||
go get -u ./...
|
||||
go mod tidy
|
||||
|
||||
# Cross-platform builds
|
||||
build-all:
|
||||
@echo "Building for all platforms..."
|
||||
@mkdir -p bin
|
||||
|
||||
# Linux
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-linux-amd64 ./cmd/onx
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-linux-amd64 ./cmd/onxd
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/onx-linux-arm64 ./cmd/onx
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/onxd-linux-arm64 ./cmd/onxd
|
||||
|
||||
# macOS
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-darwin-amd64 ./cmd/onx
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-darwin-amd64 ./cmd/onxd
|
||||
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/onx-darwin-arm64 ./cmd/onx
|
||||
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/onxd-darwin-arm64 ./cmd/onxd
|
||||
|
||||
# Windows
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-windows-amd64.exe ./cmd/onx
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-windows-amd64.exe ./cmd/onxd
|
||||
|
||||
@echo "Cross-platform builds completed"
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Clean, lint, test, and build"
|
||||
@echo " build - Build CLI and daemon for current platform"
|
||||
@echo " build-all - Cross-platform builds"
|
||||
@echo " test - Run unit tests with coverage"
|
||||
@echo " integration - Run end-to-end integration tests"
|
||||
@echo " coverage - Generate HTML coverage report"
|
||||
@echo " lint - Run code linting"
|
||||
@echo " security - Run security scanning"
|
||||
@echo " ci - Run full CI pipeline"
|
||||
@echo " install - Install to PATH"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " fmt - Format code"
|
||||
@echo " mod-tidy - Tidy Go modules"
|
||||
@echo " dev-setup - Install development tools"
|
||||
@echo " help - Show this help message"
|
Reference in New Issue
Block a user