ci: add comprehensive CI/CD pipeline with 100% coverage enforcement
Some checks failed
V2 CI/CD Pipeline / Pre-Flight Checks (push) Has been cancelled
V2 CI/CD Pipeline / Build & Dependencies (push) Has been cancelled
V2 CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
V2 CI/CD Pipeline / Unit Tests (100% Coverage Required) (push) Has been cancelled
V2 CI/CD Pipeline / Integration Tests (push) Has been cancelled
V2 CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
V2 CI/CD Pipeline / Decimal Precision Validation (push) Has been cancelled
V2 CI/CD Pipeline / Modularity Validation (push) Has been cancelled
V2 CI/CD Pipeline / Final Validation Summary (push) Has been cancelled
Some checks failed
V2 CI/CD Pipeline / Pre-Flight Checks (push) Has been cancelled
V2 CI/CD Pipeline / Build & Dependencies (push) Has been cancelled
V2 CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
V2 CI/CD Pipeline / Unit Tests (100% Coverage Required) (push) Has been cancelled
V2 CI/CD Pipeline / Integration Tests (push) Has been cancelled
V2 CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
V2 CI/CD Pipeline / Decimal Precision Validation (push) Has been cancelled
V2 CI/CD Pipeline / Modularity Validation (push) Has been cancelled
V2 CI/CD Pipeline / Final Validation Summary (push) Has been cancelled
Created complete CI/CD infrastructure for V2 development: GitHub Actions Pipeline (.github/workflows/v2-ci.yml): - Pre-flight checks (branch naming, commit messages) - Build & dependency validation - Code quality with 40+ linters (golangci-lint) - Unit tests with MANDATORY 100% coverage enforcement - Integration tests with timeout management - Performance benchmarks (parser < 5ms, detection < 10ms, e2e < 50ms) - Decimal precision validation - Modularity validation (component independence) - Final validation summary with PR comments Code Quality (.golangci.yml): - 40+ enabled linters for comprehensive checks - Cyclomatic complexity limits (max 15) - Magic number detection - Security scanning (gosec) - Style checking with MEV/DEX terminology - Test file exclusions for appropriate linters Build Automation (Makefile): - build, test, test-coverage with 100% enforcement - lint, fmt, vet, security targets - deps-download, deps-verify, deps-tidy, deps-check - validate (full CI/CD locally) - bench (performance benchmarks) - check-modularity, check-circular - Color-coded output for better UX Git Optimization (.gitattributes): - LF normalization for cross-platform consistency - Binary file handling - Diff settings for Go files - Merge strategies - Export-ignore for archives Git Hooks (.git-hooks/): - pre-commit: format, tests, vet, secret detection, go.mod tidy - commit-msg: message format validation - README with installation instructions - install-git-hooks.sh script for easy setup Documentation (docs/planning/05_CI_CD_SETUP.md): - Complete pipeline architecture diagram - Local development workflow - GitHub Actions job descriptions - Performance optimizations (caching, parallel execution) - Failure handling and debugging - Branch protection rules - Deployment process - Best practices and troubleshooting Performance Targets: - Pipeline duration: < 15 minutes - Test coverage: 100% (enforced, non-negotiable) - Parser latency: < 5ms - Arbitrage detection: < 10ms - End-to-end: < 50ms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
90
.git-hooks/commit-msg
Executable file
90
.git-hooks/commit-msg
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Commit message hook for MEV Bot V2
|
||||
# Validates commit message format
|
||||
#
|
||||
# Install: ln -sf ../../.git-hooks/commit-msg .git/hooks/commit-msg
|
||||
#
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
COMMIT_MSG_FILE=$1
|
||||
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
|
||||
|
||||
# Skip if this is a merge commit
|
||||
if git rev-parse -q --verify MERGE_HEAD > /dev/null; then
|
||||
echo -e "${GREEN}ℹ️ Merge commit detected, skipping validation${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Skip if this is an amend
|
||||
if [ -n "$GIT_EDITOR" ]; then
|
||||
echo -e "${GREEN}ℹ️ Amend detected, skipping validation${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}📝 Validating commit message...${NC}"
|
||||
|
||||
# Required format: type(scope): description
|
||||
# type: feat, fix, perf, refactor, test, docs, build, ci
|
||||
# scope: component name (parsers, cache, validation, etc.)
|
||||
|
||||
PATTERN="^(feat|fix|perf|refactor|test|docs|build|ci)\([a-z0-9-]+\): .{10,}"
|
||||
|
||||
if ! echo "$COMMIT_MSG" | grep -qE "$PATTERN"; then
|
||||
echo -e "${RED}❌ Invalid commit message format${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Required format:${NC}"
|
||||
echo -e " type(scope): brief description"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Valid types:${NC}"
|
||||
echo -e " feat - New feature"
|
||||
echo -e " fix - Bug fix"
|
||||
echo -e " perf - Performance improvement"
|
||||
echo -e " refactor - Code refactoring"
|
||||
echo -e " test - Adding or updating tests"
|
||||
echo -e " docs - Documentation updates"
|
||||
echo -e " build - Build system changes"
|
||||
echo -e " ci - CI/CD changes"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Example:${NC}"
|
||||
echo -e " feat(parsers): add UniswapV2 parser with event validation"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Your message:${NC}"
|
||||
echo -e " $COMMIT_MSG"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for minimum description length
|
||||
DESCRIPTION=$(echo "$COMMIT_MSG" | head -n1 | sed 's/^[^:]*: //')
|
||||
if [ ${#DESCRIPTION} -lt 10 ]; then
|
||||
echo -e "${RED}❌ Commit description too short (minimum 10 characters)${NC}"
|
||||
echo -e "${YELLOW}Your description: $DESCRIPTION (${#DESCRIPTION} chars)${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for maximum line length (72 chars for first line)
|
||||
FIRST_LINE=$(echo "$COMMIT_MSG" | head -n1)
|
||||
if [ ${#FIRST_LINE} -gt 72 ]; then
|
||||
echo -e "${YELLOW}⚠️ Warning: First line exceeds 72 characters (${#FIRST_LINE} chars)${NC}"
|
||||
echo -e "${YELLOW} Consider shortening the description${NC}"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Encourage including coverage info for test changes
|
||||
if echo "$COMMIT_MSG" | grep -q "^test"; then
|
||||
if ! echo "$COMMIT_MSG" | grep -qi "coverage"; then
|
||||
echo -e "${YELLOW}💡 Tip: Consider including coverage info in test commits${NC}"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✅ Commit message format valid${NC}"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user