- Add complete Market Manager package with in-memory storage and CRUD operations - Implement arbitrage detection with profit calculations and thresholds - Add database adapter with PostgreSQL schema for persistence - Create comprehensive logging system with specialized log files - Add detailed documentation and implementation plans - Include example application and comprehensive test suite - Update Makefile with market manager build targets - Add check-implementations command for verification
134 lines
3.1 KiB
Makefile
134 lines
3.1 KiB
Makefile
# Makefile for MEV Bot
|
|
|
|
# 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 a specific package
|
|
.PHONY: test-pkg
|
|
test-pkg:
|
|
@echo "Running tests for package..."
|
|
@go test -v ./$(PKG)/...
|
|
|
|
# Run tests with coverage
|
|
.PHONY: test-coverage
|
|
test-coverage:
|
|
@echo "Running tests with coverage..."
|
|
@go test -coverprofile=coverage.out ./...
|
|
@go tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
# Run unit tests
|
|
.PHONY: test-unit
|
|
test-unit:
|
|
@echo "Running unit tests..."
|
|
@go test -v ./test/unit/...
|
|
|
|
# Run integration tests
|
|
.PHONY: test-integration
|
|
test-integration:
|
|
@echo "Running integration tests..."
|
|
@go test -v ./test/integration/...
|
|
|
|
# Run end-to-end tests
|
|
.PHONY: test-e2e
|
|
test-e2e:
|
|
@echo "Running end-to-end tests..."
|
|
@go test -v ./test/e2e/...
|
|
|
|
# Clean build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -rf bin/
|
|
@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 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-pkg - Run tests for a specific package (use PKG=package_name)"
|
|
@echo " test-coverage - Run tests with coverage report"
|
|
@echo " test-unit - Run unit tests"
|
|
@echo " test-integration - Run integration tests"
|
|
@echo " test-e2e - Run end-to-end tests"
|
|
@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"
|