|
| 1 | +.PHONY: up down fresh test logs shell composer-install status e2e e2e-fresh e2e-debug db-reset db-post-install |
| 2 | + |
| 3 | +# Start the environment |
| 4 | +up: |
| 5 | + docker compose up -d |
| 6 | + @echo "" |
| 7 | + @echo "papayaCMS is running at http://localhost:8080" |
| 8 | + @echo "MySQL is available at localhost:3306 (user: papaya / pass: papaya)" |
| 9 | + |
| 10 | +# Stop the environment |
| 11 | +down: |
| 12 | + docker compose down |
| 13 | + |
| 14 | +# Nuclear reset: destroy everything and start fresh |
| 15 | +fresh: |
| 16 | + docker compose down -v |
| 17 | + docker compose build --no-cache |
| 18 | + docker compose up -d |
| 19 | + docker compose exec web composer install --prefer-dist |
| 20 | + @echo "" |
| 21 | + @echo "Fresh environment ready at http://localhost:8080" |
| 22 | + |
| 23 | +# Run PHPUnit tests inside the container |
| 24 | +test: |
| 25 | + docker compose exec web vendor/bin/phpunit |
| 26 | + |
| 27 | +# Run PHPUnit with coverage |
| 28 | +test-coverage: |
| 29 | + docker compose exec web vendor/bin/phpunit --coverage-html=coverage |
| 30 | + |
| 31 | +# Install composer dependencies |
| 32 | +composer-install: |
| 33 | + docker compose exec web composer install --prefer-dist |
| 34 | + |
| 35 | +# View logs |
| 36 | +logs: |
| 37 | + docker compose logs -f |
| 38 | + |
| 39 | +# Open a shell in the web container |
| 40 | +shell: |
| 41 | + docker compose exec web bash |
| 42 | + |
| 43 | +# Reset only the database (keeps containers running) |
| 44 | +db-reset: |
| 45 | + docker compose exec db mysql -u root -proot -e "DROP DATABASE IF EXISTS papaya; CREATE DATABASE papaya; GRANT ALL PRIVILEGES ON papaya.* TO 'papaya'@'%';" |
| 46 | + @echo "Database reset complete" |
| 47 | + |
| 48 | +# Show container status |
| 49 | +status: |
| 50 | + docker compose ps |
| 51 | + |
| 52 | +# Apply post-installation settings (password rehash, etc.) |
| 53 | +db-post-install: |
| 54 | + docker compose exec db mysql -u root -proot papaya < docker/mysql-init/01-post-install.sql |
| 55 | + @echo "Post-install settings applied" |
| 56 | + |
| 57 | +# Run E2E tests (Playwright) against running containers, then apply post-install settings |
| 58 | +e2e: |
| 59 | + @mkdir -p e2e/test-results |
| 60 | + cd e2e && npx playwright test |
| 61 | + $(MAKE) db-post-install |
| 62 | + |
| 63 | +# Full reset + E2E: destroy DB, rebuild, install, run E2E tests |
| 64 | +e2e-fresh: |
| 65 | + docker compose down -v |
| 66 | + docker compose up -d |
| 67 | + docker compose exec web composer install --prefer-dist --quiet |
| 68 | + @mkdir -p e2e/test-results |
| 69 | + cd e2e && npx playwright test |
| 70 | + $(MAKE) db-post-install |
| 71 | + |
| 72 | +# Run E2E tests with browser visible (for debugging) |
| 73 | +e2e-debug: |
| 74 | + @mkdir -p e2e/test-results |
| 75 | + cd e2e && npx playwright test --headed --timeout=120000 |
0 commit comments