@@ -41,13 +41,76 @@ jobs:
4141
4242 unittest :
4343 runs-on : ubuntu-latest
44+ strategy :
45+ matrix :
46+ python-version : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
47+
48+ services :
49+ redis-standalone :
50+ image : redis:alpine
51+ options : >-
52+ --health-cmd "redis-cli ping | grep PONG"
53+ --health-interval 10s
54+ --health-timeout 5s
55+ --health-retries 5
56+ ports :
57+ - 6379:6379
58+
59+ redis-cluster-0 :
60+ image : redis:alpine
61+ options : >-
62+ --entrypoint sh
63+ -c "rm -f /tmp/redis-cluster-nodes.conf && redis-server --appendonly no --save '' --cluster-enabled yes --cluster-config-file /tmp/redis-cluster-nodes.conf"
64+ ports :
65+ - 6380:6379
66+
67+ redis-cluster-1 :
68+ image : redis:alpine
69+ options : >-
70+ --entrypoint sh
71+ -c "rm -f /tmp/redis-cluster-nodes.conf && redis-server --appendonly no --save '' --cluster-enabled yes --cluster-config-file /tmp/redis-cluster-nodes.conf"
72+ ports :
73+ - 6381:6379
74+
75+ redis-cluster-2 :
76+ image : redis:alpine
77+ options : >-
78+ --entrypoint sh
79+ -c "rm -f /tmp/redis-cluster-nodes.conf && redis-server --appendonly no --save '' --cluster-enabled yes --cluster-config-file /tmp/redis-cluster-nodes.conf"
80+ ports :
81+ - 6382:6379
4482
4583 steps :
4684 - uses : actions/checkout@v4
4785
48- - name : Compose up for unittest
49- working-directory : .github
50- run : docker compose up --abort-on-container-exit
86+ - name : Set up Python ${{ matrix.python-version }}
87+ uses : actions/setup-python@v5
88+ with :
89+ python-version : ${{ matrix.python-version }}
90+ cache : pip
91+
92+ - name : Install dependencies
93+ run : |
94+ python -m pip install --upgrade pip
95+ pip install -e . -r tests/requirements.txt
96+
97+ - name : Wait for Redis Cluster nodes to be ready
98+ run : |
99+ timeout 30 sh -c 'until redis-cli -p 6380 ping && redis-cli -p 6381 ping && redis-cli -p 6382 ping; do sleep 1; done'
100+
101+ - name : Create Redis Cluster
102+ run : |
103+ redis-cli --cluster create localhost:6380 localhost:6381 localhost:6382 --cluster-yes
104+
105+ - name : Wait for Redis Cluster to be ready
106+ run : |
107+ timeout 30 sh -c 'until redis-cli -p 6380 --cluster info; do sleep 1; done'
108+
109+ - name : Run tests
110+ run : |
111+ export REDIS_URL=redis://localhost:6379
112+ export REDIS_CLUSTER_NODES="localhost:6380 localhost:6381 localhost:6382"
113+ pytest -x --cov --cov-report=xml --junitxml=junit.xml
51114
52115 - name : Upload coverage to Codecov
53116 uses : codecov/codecov-action@v5
0 commit comments