141 lines
3.5 KiB
Makefile
141 lines
3.5 KiB
Makefile
# Makefile for Qwen Code Integration
|
|
|
|
# Variables
|
|
BINARY=mev-bot
|
|
MAIN_FILE=cmd/mev-bot/main.go
|
|
BINARY_PATH=bin/$(BINARY)
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: build
|
|
|
|
# Build the application
|
|
.PHONY: build
|
|
build:
|
|
@echo "Building $(BINARY)..."
|
|
@mkdir -p bin
|
|
@go build -o $(BINARY_PATH) $(MAIN_FILE)
|
|
@echo "Build successful!"
|
|
|
|
# Run the application
|
|
.PHONY: run
|
|
run: build
|
|
@echo "Running $(BINARY)..."
|
|
@$(BINARY_PATH)
|
|
|
|
# Run tests
|
|
.PHONY: test
|
|
test:
|
|
@echo "Running tests..."
|
|
@go test -v ./...
|
|
|
|
# Run tests for mathematical functions
|
|
.PHONY: test-math
|
|
test-math:
|
|
@echo "Running mathematical function tests..."
|
|
@go test -v ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Run property-based tests
|
|
.PHONY: test-property
|
|
test-property:
|
|
@echo "Running property-based tests..."
|
|
@go test -v -run=Property ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Run fuzz tests
|
|
.PHONY: test-fuzz
|
|
test-fuzz:
|
|
@echo "Running fuzz tests..."
|
|
@go test -fuzz=Fuzz ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Run benchmarks for mathematical functions
|
|
.PHONY: bench-math
|
|
bench-math:
|
|
@echo "Running mathematical function benchmarks..."
|
|
@go test -bench=. -benchmem ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Run benchmarks with CPU profiling
|
|
.PHONY: bench-cpu
|
|
bench-cpu:
|
|
@echo "Running benchmarks with CPU profiling..."
|
|
@go test -bench=. -cpuprofile=cpu.prof ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Run benchmarks with memory profiling
|
|
.PHONY: bench-mem
|
|
bench-mem:
|
|
@echo "Running benchmarks with memory profiling..."
|
|
@go test -bench=. -memprofile=mem.prof ./pkg/uniswap/... ./pkg/math/...
|
|
|
|
# Clean build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -rf bin/
|
|
@rm -f *.prof
|
|
@rm -f coverage.out coverage.html
|
|
@echo "Clean complete!"
|
|
|
|
# Install dependencies
|
|
.PHONY: deps
|
|
deps:
|
|
@echo "Installing dependencies..."
|
|
@go mod tidy
|
|
@echo "Dependencies installed!"
|
|
|
|
# Format code
|
|
.PHONY: fmt
|
|
fmt:
|
|
@echo "Formatting code..."
|
|
@go fmt ./...
|
|
|
|
# Vet code
|
|
.PHONY: vet
|
|
vet:
|
|
@echo "Vetting code..."
|
|
@go vet ./...
|
|
|
|
# Lint code (requires golangci-lint)
|
|
.PHONY: lint
|
|
lint:
|
|
@echo "Linting code..."
|
|
@which golangci-lint > /dev/null || (echo "golangci-lint not found, installing..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
|
|
@golangci-lint run
|
|
|
|
# Update dependencies
|
|
.PHONY: update
|
|
update:
|
|
@echo "Updating dependencies..."
|
|
@go get -u ./...
|
|
@go mod tidy
|
|
@echo "Dependencies updated!"
|
|
|
|
# Install test dependencies
|
|
.PHONY: test-deps
|
|
test-deps:
|
|
@echo "Installing test dependencies..."
|
|
@go get github.com/stretchr/testify/assert
|
|
@go get github.com/leanovate/gopter/...
|
|
@go mod tidy
|
|
@echo "Test dependencies installed!"
|
|
|
|
# Help
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " all - Build the application (default)"
|
|
@echo " build - Build the application"
|
|
@echo " run - Build and run the application"
|
|
@echo " test - Run tests"
|
|
@echo " test-math - Run tests for mathematical functions"
|
|
@echo " test-property - Run property-based tests"
|
|
@echo " test-fuzz - Run fuzz tests"
|
|
@echo " bench-math - Run benchmarks for mathematical functions"
|
|
@echo " bench-cpu - Run benchmarks with CPU profiling"
|
|
@echo " bench-mem - Run benchmarks with memory profiling"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " deps - Install dependencies"
|
|
@echo " test-deps - Install test dependencies"
|
|
@echo " fmt - Format code"
|
|
@echo " vet - Vet code"
|
|
@echo " lint - Lint code (requires golangci-lint)"
|
|
@echo " update - Update dependencies"
|
|
@echo " help - Show this help"
|