# Makefile for OpenCompletion Testing Framework .PHONY: help help: @echo "OpenCompletion Testing Framework" @echo "================================" @echo "" @echo "๐Ÿงช Test Commands:" @echo " test - Run all tests (unit, integration, functional)" @echo " test-unit - Run only unit tests" @echo " test-integration - Run only integration tests" @echo " test-functional - Run only functional tests" @echo " test-validator - Run YAML validator tests" @echo " test-yaml-loading - Run YAML loading/parsing tests" @echo " test-activity-flows - Run activity flow tests" @echo " test-battleship - Run battleship game tests" @echo " test-guarded-ai - Run guarded_ai.py functionality tests" @echo " test-multiple-files - Run integration tests across all activity files" @echo "" @echo "๐Ÿ“‹ Validation Commands:" @echo " validate-yaml - Validate all YAML files in research/" @echo "" @echo "๐Ÿ› ๏ธ Development Commands:" @echo " venv - Create virtual environment and install dependencies" @echo " dev-setup - Install development dependencies" @echo " lint - Run code linting and formatting" @echo " clean - Clean up generated files" @echo " clean-all - Remove virtual environment" # Setup virtual environment .PHONY: venv venv: @if [ ! -d "venv" ]; then \ echo "๐Ÿš€ Creating virtual environment..."; \ python3 -m venv venv; \ echo "๐Ÿ“ฆ Installing basic dependencies..."; \ venv/bin/pip install --upgrade pip; \ venv/bin/pip install -r requirements.txt || echo "โš ๏ธ Failed to install basic dependencies"; \ echo "โœ… Virtual environment ready!"; \ else \ echo "โœ… Virtual environment already exists"; \ fi # ============================================================================ # MAIN TEST COMMANDS # ============================================================================ # Run all tests .PHONY: test test: test-unit test-integration test-functional test-validator test-yaml-loading test-activity-flows test-battleship test-guarded-ai test-multiple-files validate-yaml @echo "" @echo "๐ŸŽ‰ All tests completed!" @echo "๐Ÿ“Š Test Summary:" @echo " โœ… Unit tests - Core functionality" @echo " โœ… Integration tests - Cross-component testing" @echo " โœ… Functional tests - End-to-end workflows" @echo " โœ… YAML validation - All activity files" @echo " โœ… All specific test targets completed" # Run unit tests only .PHONY: test-unit test-unit: venv @echo "๐Ÿ”ฌ Running unit tests..." @if command -v pytest >/dev/null 2>&1; then \ python -m pytest tests/unit/ -v --tb=short; \ else \ echo "๐Ÿ“ Running unit tests directly..."; \ python tests/unit/test_yaml_loading.py; \ python tests/unit/test_activity_yaml_validator.py; \ fi # Run integration tests only .PHONY: test-integration test-integration: venv @echo "๐Ÿ”— Running integration tests..." @if command -v pytest >/dev/null 2>&1; then \ python -m pytest tests/integration/ -v --tb=short; \ else \ echo "๐Ÿ“ Running integration tests directly..."; \ python tests/integration/test_multiple_activities.py; \ fi # Run functional tests only .PHONY: test-functional test-functional: venv @echo "โšก Running functional tests..." @if command -v pytest >/dev/null 2>&1; then \ python -m pytest tests/functional/ -v --tb=short; \ else \ echo "๐Ÿ“ Running functional tests directly..."; \ python tests/functional/test_activity_flows.py; \ python tests/functional/test_battleship_pre_script.py; \ fi # ============================================================================ # SPECIFIC TEST COMMANDS # ============================================================================ # Run YAML validator tests only .PHONY: test-validator test-validator: venv @echo "๐Ÿ“‹ Running YAML validator tests..." python tests/unit/test_activity_yaml_validator.py # Run YAML loading tests only .PHONY: test-yaml-loading test-yaml-loading: venv @echo "๐Ÿ“„ Running YAML loading/parsing tests..." python tests/unit/test_yaml_loading.py # Run activity flow tests .PHONY: test-activity-flows test-activity-flows: venv @echo "๐Ÿ”„ Running activity flow tests..." python tests/functional/test_activity_flows.py # Run battleship game tests .PHONY: test-battleship test-battleship: venv @echo "๐Ÿšข Running battleship game tests..." python tests/functional/test_battleship_pre_script.py # Run guarded_ai functionality tests .PHONY: test-guarded-ai test-guarded-ai: venv @echo "๐Ÿ›ก๏ธ Running guarded_ai.py functionality tests..." python tests/integration/test_regression_fixes.py # Run integration tests across all activity files .PHONY: test-multiple-files test-multiple-files: venv @echo "๐Ÿ“ Running integration tests across all activity files..." python tests/integration/test_multiple_activities.py # ============================================================================ # VALIDATION COMMANDS # ============================================================================ # Validate all YAML files .PHONY: validate-yaml validate-yaml: venv @echo "๐Ÿ“‹ Validating all YAML files..." python activity_yaml_validator.py research/*.yaml # ============================================================================ # DEVELOPMENT AND CI/CD COMMANDS # ============================================================================ # Run tests with coverage (requires pytest and coverage) .PHONY: test-cov test-cov: dev-setup @echo "๐Ÿ“Š Running tests with coverage..." venv/bin/pip install pytest-cov venv/bin/python -m pytest tests/ --cov=. --cov-report=html --cov-report=term-missing -v # Format and lint code .PHONY: format format: dev-setup @echo "๐ŸŽจ Formatting code..." venv/bin/black . venv/bin/isort . .PHONY: lint lint: dev-setup @echo "๐Ÿ” Linting code..." venv/bin/black --check . venv/bin/isort --check-only . venv/bin/flake8 . # Install development dependencies .PHONY: dev-setup dev-setup: venv @echo "๐Ÿ› ๏ธ Installing development dependencies..." venv/bin/pip install black flake8 isort pytest coverage @echo "โœ… Development environment ready!" # ============================================================================ # CI/CD AND AUTOMATION COMMANDS # ============================================================================ # Full CI pipeline .PHONY: ci ci: clean test validate-yaml lint @echo "" @echo "๐ŸŽฏ CI Pipeline Results:" @echo " โœ… Tests passed" @echo " โœ… YAML validation passed" @echo " โœ… Code linting completed" @echo "๐Ÿš€ Ready for deployment!" # ============================================================================ # UTILITY COMMANDS # ============================================================================ # Clean generated files .PHONY: clean clean: @echo "๐Ÿงน Cleaning generated files..." find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true find . -name "*.pyc" -delete 2>/dev/null || true find . -name "*.pyo" -delete 2>/dev/null || true find . -name "*~" -delete 2>/dev/null || true rm -rf .pytest_cache/ 2>/dev/null || true rm -rf htmlcov/ 2>/dev/null || true rm -rf .coverage 2>/dev/null || true rm -rf *.tmp 2>/dev/null || true # Remove virtual environment .PHONY: clean-all clean-all: clean @echo "๐Ÿ’ฃ Removing virtual environment..." rm -rf venv # Show test structure .PHONY: test-info test-info: @echo "๐Ÿ“ Test Structure:" @echo " tests/" @echo " โ”œโ”€โ”€ unit/ - Unit tests for individual components" @echo " โ”‚ โ”œโ”€โ”€ test_yaml_loading.py - YAML loading/parsing tests" @echo " โ”‚ โ””โ”€โ”€ test_activity_yaml_validator.py - Validator functionality tests" @echo " โ”œโ”€โ”€ integration/ - Integration tests across components" @echo " โ”‚ โ”œโ”€โ”€ test_multiple_activities.py - Tests across all activity files" @echo " โ”‚ โ””โ”€โ”€ test_regression_fixes.py - Regression and fix validation" @echo " โ””โ”€โ”€ functional/ - End-to-end functional tests" @echo " โ”œโ”€โ”€ test_activity_flows.py - Complete activity workflows" @echo " โ””โ”€โ”€ test_battleship_pre_script.py - Battleship game functionality" @echo "" @echo "๐ŸŽฏ Key Test Commands:" @echo " make test - Run all tests" @echo " make validate-yaml - Validate all YAML files"