1+ # PartDB Makefile for Test Environment Management
2+
3+ .PHONY : help deps-install lint format format-check test coverage pre-commit all test-typecheck \
4+ test-setup test-clean test-db-create test-db-migrate test-cache-clear test-fixtures test-run test-reset \
5+ section-dev dev-setup dev-clean dev-db-create dev-db-migrate dev-cache-clear dev-warmup dev-reset
6+
7+ # Default target
8+ help : # # Show this help
9+ @awk ' BEGIN {FS = ":.*##"}; /^[a-zA-Z0-9][a-zA-Z0-9_-]+:.*##/ {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST )
10+
11+ # Dependencies
12+ deps-install : # # Install PHP dependencies with unlimited memory
13+ @echo " 📦 Installing PHP dependencies..."
14+ COMPOSER_MEMORY_LIMIT=-1 composer install
15+ yarn install
16+ @echo " ✅ Dependencies installed"
17+
18+ # Complete test environment setup
19+ test-setup : test-clean test-db-create test-db-migrate test-fixtures # # Complete test setup (clean, create DB, migrate, fixtures)
20+ @echo " ✅ Test environment setup complete!"
21+
22+ # Clean test environment
23+ test-clean : # # Clean test cache and database files
24+ @echo " 🧹 Cleaning test environment..."
25+ rm -rf var/cache/test
26+ rm -f var/app_test.db
27+ @echo " ✅ Test environment cleaned"
28+
29+ # Create test database
30+ test-db-create : # # Create test database (if not exists)
31+ @echo " 🗄️ Creating test database..."
32+ -php bin/console doctrine:database:create --if-not-exists --env test || echo " ⚠️ Database creation failed (expected for SQLite) - continuing..."
33+
34+ # Run database migrations for test environment
35+ test-db-migrate : # # Run database migrations for test environment
36+ @echo " 🔄 Running database migrations..."
37+ COMPOSER_MEMORY_LIMIT=-1 php bin/console doctrine:migrations:migrate -n --env test
38+
39+ # Clear test cache
40+ test-cache-clear : # # Clear test cache
41+ @echo " 🗑️ Clearing test cache..."
42+ rm -rf var/cache/test
43+ @echo " ✅ Test cache cleared"
44+
45+ # Load test fixtures
46+ test-fixtures : # # Load test fixtures
47+ @echo " 📦 Loading test fixtures..."
48+ php bin/console partdb:fixtures:load -n --env test
49+
50+ # Run PHPUnit tests
51+ test-run : # # Run PHPUnit tests
52+ @echo " 🧪 Running tests..."
53+ php bin/phpunit
54+
55+ # Quick test reset (clean + migrate + fixtures, skip DB creation)
56+ test-reset : test-cache-clear test-db-migrate test-fixtures
57+ @echo " ✅ Test environment reset complete!"
58+
59+ test-typecheck : # # Run static analysis (PHPStan)
60+ @echo " 🧪 Running type checks..."
61+ COMPOSER_MEMORY_LIMIT=-1 composer phpstan
62+
63+ # Development helpers
64+ dev-setup : dev-clean dev-db-create dev-db-migrate dev-warmup # # Complete development setup (clean, create DB, migrate, warmup)
65+ @echo " ✅ Development environment setup complete!"
66+
67+ dev-clean : # # Clean development cache and database files
68+ @echo " 🧹 Cleaning development environment..."
69+ rm -rf var/cache/dev
70+ rm -f var/app_dev.db
71+ @echo " ✅ Development environment cleaned"
72+
73+ dev-db-create : # # Create development database (if not exists)
74+ @echo " 🗄️ Creating development database..."
75+ -php bin/console doctrine:database:create --if-not-exists --env dev || echo " ⚠️ Database creation failed (expected for SQLite) - continuing..."
76+
77+ dev-db-migrate : # # Run database migrations for development environment
78+ @echo " 🔄 Running database migrations..."
79+ COMPOSER_MEMORY_LIMIT=-1 php bin/console doctrine:migrations:migrate -n --env dev
80+
81+ dev-cache-clear : # # Clear development cache
82+ @echo " 🗑️ Clearing development cache..."
83+ rm -rf var/cache/dev
84+ @echo " ✅ Development cache cleared"
85+
86+ dev-warmup : # # Warm up development cache
87+ @echo " 🔥 Warming up development cache..."
88+ COMPOSER_MEMORY_LIMIT=-1 php -d memory_limit=1G bin/console cache:warmup --env dev -n
89+
90+ dev-reset : dev-cache-clear dev-db-migrate # # Quick development reset (cache clear + migrate)
91+ @echo " ✅ Development environment reset complete!"
0 commit comments