12
12
runs-on : ubuntu-latest
13
13
strategy :
14
14
matrix :
15
- python-version : ["3.9", "3.10", "3.11", "3.12"]
16
-
17
- services :
18
- redis :
19
- image : redis:7-alpine
20
- ports :
21
- - 6379:6379
22
- options : >-
23
- --health-cmd "redis-cli ping"
24
- --health-interval 10s
25
- --health-timeout 5s
26
- --health-retries 5
15
+ python-version : ["3.10", "3.11", "3.12"]
27
16
28
17
steps :
29
18
- uses : actions/checkout@v4
@@ -41,30 +30,10 @@ jobs:
41
30
42
31
# Install coverage for test reporting
43
32
pip install pytest-cov>=4.0.0
44
-
45
- # Install storage backend dependencies for comprehensive testing
46
- # Use modern redis library for Python 3.11+ compatibility
47
- if [[ "${{ matrix.python-version }}" == "3.11" || "${{ matrix.python-version }}" == "3.12" ]]; then
48
- pip install 'redis[hiredis]>=4.5.0'
49
- else
50
- pip install aioredis>=2.0.0
51
- fi
52
-
53
- # Install Vault dependencies
54
- pip install hvac>=1.2.0 aiohttp>=3.8.0
55
-
56
- - name : Wait for Redis
57
- run : |
58
- timeout 30 bash -c 'until redis-cli ping; do sleep 1; done'
59
33
60
34
- name : Run tests with coverage
61
35
run : |
62
36
python -m pytest -v --tb=short --cov=src --cov-report=xml --cov-report=term-missing
63
- env :
64
- # Redis service connection for testing
65
- REDIS_HOST : localhost
66
- REDIS_PORT : 6379
67
- REDIS_PASSWORD : " "
68
37
69
38
- name : Upload coverage to Codecov
70
39
uses : codecov/codecov-action@v3
77
46
run : |
78
47
python -m src.gateway --help
79
48
80
- - name : Test storage backends
81
- run : |
82
- # Test memory storage (default)
83
- python -c "
84
- import asyncio
85
- from src.storage.manager import StorageManager
86
- from src.config.config import StorageConfig
87
-
88
- async def test():
89
- config = StorageConfig(type='memory')
90
- manager = StorageManager(config)
91
- storage = await manager.start_storage()
92
- await storage.set('test', {'data': 'value'})
93
- result = await storage.get('test')
94
- assert result == {'data': 'value'}
95
- await manager.stop_storage()
96
- print('✅ Memory storage test passed')
97
-
98
- asyncio.run(test())
99
- "
100
-
101
- # Test Redis storage with service
102
- python -c "
103
- import asyncio
104
- from src.storage.manager import StorageManager
105
- from src.config.config import StorageConfig, RedisStorageConfig
106
-
107
- async def test():
108
- config = StorageConfig(
109
- type='redis',
110
- redis=RedisStorageConfig(
111
- host='localhost',
112
- port=6379,
113
- password='',
114
- db=0,
115
- ssl=False,
116
- max_connections=20
117
- )
118
- )
119
- manager = StorageManager(config)
120
- storage = await manager.start_storage()
121
- await storage.set('test', {'redis': 'works'})
122
- result = await storage.get('test')
123
- assert result == {'redis': 'works'}
124
- await manager.stop_storage()
125
- print('✅ Redis storage test passed')
126
-
127
- asyncio.run(test())
128
- "
129
- env :
130
- REDIS_HOST : localhost
49
+
0 commit comments