-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (78 loc) · 3 KB
/
Makefile
File metadata and controls
90 lines (78 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.PHONY: help install dev prod test test-unit test-integration test-functional clean
# Default target
help:
@echo "SSH Key Manager - Available Commands:"
@echo ""
@echo " make install - Install dependencies"
@echo " make dev - Start development environment"
@echo " make prod - Start production environment"
@echo " make test - Run all tests with Docker"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make test-functional - Run functional tests only"
@echo " make test-local - Run tests locally (requires local DB)"
@echo " make clean - Clean up Docker containers and volumes"
@echo ""
# Install dependencies
install:
@echo "📦 Installing dependencies..."
cd backend && composer install
# Development environment
dev:
@echo "🚀 Starting development environment..."
docker-compose up --build
# Production environment
prod:
@echo "🚀 Starting production environment..."
docker-compose -f docker-compose.prod.yml up --build -d
# Test with Docker (full environment)
test:
@echo "🧪 Running tests with Docker..."
@echo "🧹 Cleaning up any existing test containers..."
@docker-compose -f docker-compose.test.yml down -v 2>/dev/null || true
@echo "🔨 Building test environment..."
@docker-compose -f docker-compose.test.yml build
@echo "🚀 Starting test database..."
@docker-compose -f docker-compose.test.yml up -d mariadb-test
@echo "⏳ Waiting for database to be ready..."
@sleep 15
@echo "🧪 Running tests..."
@docker-compose -f docker-compose.test.yml run --rm shellock-test
@echo "🧹 Cleaning up..."
@docker-compose -f docker-compose.test.yml down -v
# Unit tests only
test-unit:
@echo "🧪 Running unit tests..."
cd backend && ./vendor/bin/phpunit --testsuite="Unit"
# Integration tests only
test-integration:
@echo "🧪 Running integration tests..."
cd backend && ./vendor/bin/phpunit --testsuite="Integration"
# Functional tests only
test-functional:
@echo "🧪 Running functional tests..."
cd backend && ./vendor/bin/phpunit --testsuite="Functional"
# Local tests (requires local database setup)
test-local:
@echo "🧪 Setting up test database and running tests..."
cd backend && php bin/setup-test-db
cd backend && ./vendor/bin/phpunit
# Clean up
clean:
@echo "🧹 Cleaning up Docker containers and volumes..."
@docker-compose down -v 2>/dev/null || true
@docker-compose -f docker-compose.test.yml down -v 2>/dev/null || true
@docker volume prune -f
@docker image prune -f
# Clean up tests specifically
clean-test:
@echo "🧹 Cleaning up test environment..."
@docker-compose -f docker-compose.test.yml down -v 2>/dev/null || true
@docker volume prune -f
@docker image prune -f
@docker build prune -f
# Database setup for local development
setup-db:
@echo "🗄️ Setting up development database..."
cd backend && php bin/console doctrine:database:create --if-not-exists
cd backend && php bin/console doctrine:migrations:migrate --no-interaction