version: '3.8' services: # Unit tests test-unit: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-unit command: > sh -c " echo '๐Ÿงช Running Unit Tests...' && go test -v -race -short -coverprofile=coverage.out ./pkg/... ./internal/... && echo 'โœ… Unit tests passed!' " volumes: - ./coverage:/app/coverage environment: - GO_ENV=test - CGO_ENABLED=1 # Integration tests test-integration: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-integration command: > sh -c " echo '๐Ÿ”— Running Integration Tests...' && go test -v -race -run Integration ./test/integration/... && echo 'โœ… Integration tests passed!' " environment: - GO_ENV=test - CGO_ENABLED=1 depends_on: - test-unit # Race condition tests test-race: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-race command: > sh -c " echo '๐Ÿ Running Race Detector Tests...' && go test -race -v ./pkg/arbitrage/... ./pkg/scanner/... && echo 'โœ… No race conditions detected!' " environment: - GO_ENV=test - CGO_ENABLED=1 # Build verification test-build: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-build command: > sh -c " echo '๐Ÿ”จ Testing Build Process...' && go build -o /tmp/mev-bot-test ./cmd/mev-bot && echo 'โœ… Build successful!' && ls -lh /tmp/mev-bot-test " environment: - GO_ENV=test - CGO_ENABLED=0 # Coverage report test-coverage: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-coverage command: > sh -c " echo '๐Ÿ“Š Generating Coverage Report...' && go test -coverprofile=coverage.out -covermode=atomic ./... && go tool cover -func=coverage.out && go tool cover -html=coverage.out -o coverage/coverage.html && echo 'โœ… Coverage report generated: coverage/coverage.html' " volumes: - ./coverage:/app/coverage environment: - GO_ENV=test - CGO_ENABLED=1 depends_on: - test-unit - test-integration # Security scan test-security: build: context: . dockerfile: Dockerfile.test container_name: mev-bot-test-security command: > sh -c " echo '๐Ÿ”’ Running Security Scans...' && go install github.com/securego/gosec/v2/cmd/gosec@latest && gosec -fmt=json -out=coverage/gosec-report.json ./... && gosec ./... && echo 'โœ… Security scan complete!' " volumes: - ./coverage:/app/coverage environment: - GO_ENV=test # Linting test-lint: build: context: . dockerfile: Dockerfile.test command: > sh -c " echo '๐Ÿงน Running Linters...' && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint run --timeout=5m ./... && echo 'โœ… Linting passed!' " environment: - GO_ENV=test networks: default: name: mev-bot-test-network