1717 matrix :
1818 python-version : [ "3.11", "3.12" ]
1919
20+ # Add all required database services
21+ services :
22+ postgres :
23+ image : postgres:15
24+ env :
25+ POSTGRES_DB : chatbot_app
26+ POSTGRES_USER : chatbot_user
27+ POSTGRES_PASSWORD : secure_password
28+ ports :
29+ - 5432:5432
30+ options : >-
31+ --health-cmd pg_isready
32+ --health-interval 10s
33+ --health-timeout 5s
34+ --health-retries 5
35+
36+ redis :
37+ image : redis:6-alpine
38+ ports :
39+ - 6379:6379
40+ options : >-
41+ --health-cmd "redis-cli ping"
42+ --health-interval 10s
43+ --health-timeout 5s
44+ --health-retries 5
45+
46+ mongodb :
47+ image : mongo:6
48+ env :
49+ MONGO_INITDB_ROOT_USERNAME : root
50+ MONGO_INITDB_ROOT_PASSWORD : example
51+ ports :
52+ - 27017:27017
53+ options : >-
54+ --health-cmd "echo 'db.runCommand(\"ping\").ok' | mongosh --quiet"
55+ --health-interval 10s
56+ --health-timeout 5s
57+ --health-retries 5
58+
2059 steps :
2160 - uses : actions/checkout@v4
2261
2665 cache : pip
2766 cache-dependency-path : requirements.txt
2867
68+ # Start ScyllaDB manually since it's not available as a service
69+ - name : Start ScyllaDB
70+ run : |
71+ docker run -d \
72+ --name scylla-node1 \
73+ -p 9042:9042 \
74+ -p 10000:10000 \
75+ scylladb/scylla \
76+ --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0
77+
78+ # Wait for ScyllaDB to be ready
79+ - name : Wait for ScyllaDB
80+ run : |
81+ echo "Waiting for ScyllaDB to be ready..."
82+ for i in {1..30}; do
83+ if docker exec scylla-node1 nodetool status 2>/dev/null | grep -q "UN"; then
84+ echo "ScyllaDB is ready!"
85+ break
86+ fi
87+ echo "Attempt $i/30: ScyllaDB not ready yet..."
88+ sleep 5
89+ done
90+ # Final check
91+ docker exec scylla-node1 nodetool status
92+
93+ # Verify all services are accessible
94+ - name : Verify services connectivity
95+ run : |
96+ echo "Checking Redis..."
97+ nc -zv localhost 6379
98+
99+ echo "Checking MongoDB..."
100+ nc -zv localhost 27017
101+
102+ echo "Checking PostgreSQL..."
103+ nc -zv localhost 5432
104+
105+ echo "Checking ScyllaDB..."
106+ nc -zv localhost 9042
107+
108+ echo "All services are accessible!"
109+
29110 - name : Install deps
30111 run : |
31112 python -m pip install --upgrade pip
@@ -35,9 +116,14 @@ jobs:
35116 - name : Lint (ruff)
36117 run : ruff check .
37118
38- # QUICK tests; skip slow/integration if you have markers
119+ # Set environment variables for database connections
39120 - name : Test (pytest)
40121 env :
41- SKIP_INTEGRATION : " 1"
122+ SKIP_INTEGRATION : " 0" # Enable integration tests since we have databases
123+ MONGODB_URI : " mongodb://root:example@localhost:27017/?directConnection=true"
124+ REDIS_URL : " redis://localhost:6379/0"
125+ POSTGRES_DSN : " postgresql+asyncpg://chatbot_user:secure_password@localhost:5432/chatbot_app"
126+ SCYLLA_HOSTS : " localhost"
127+ SCYLLA_PORT : " 9042"
42128 run : |
43- pytest -q || pytest -q -k "not integration and not slow"
129+ pytest -q || pytest -q -k "not slow"
0 commit comments