8000 Test against valkey · phpredis/phpredis@a819a44 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit a819a44

Browse files
Test against valkey
Add Valkey to our server matrix in addition to making the jobs a bit more efficient by only installing the specific server we're testing on each run. For now we allow tests to fail against Valkey as they don't yet have an official release. Once there is an official release we'll remove the `continue-on-error` setting for Valkey.
1 parent b698901 commit a819a44

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
fail-fast: false
7575
matrix:
7676
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
77-
server: ['redis-server', 'keydb-server']
77+
server: ['redis', 'keydb', 'valkey']
7878

7979
steps:
8080
- name: Checkout
@@ -91,8 +91,10 @@ jobs:
9191
- name: Install system dependencies
9292
run: |
9393
sudo apt-get update
94-
sudo apt-get install valgrind libzstd-dev liblz4-dev
94+
sudo apt-get install valgrind libzstd-dev liblz4-dev libssl-dev
95+
9596
- name: Install Redis
97+
if: matrix.server == 'redis'
9698
env:
9799
REDIS_PPA_URI: "packages.redis.io/deb"
98100
REDIS_PPA_KEY: "packages.redis.io/gpg"
@@ -105,6 +107,7 @@ jobs:
105107
sudo apt-get install redis
106108
107109
- name: Install KeyDB
110+
if: matrix.server == 'keydb'
108111
env:
109112
KEYDB_PPA_URI: "download.keydb.dev/open-source-dist"
110113
KEYDB_PPA_KEY: "download.keydb.dev/open-source-dist/keyring.gpg"
@@ -114,6 +117,13 @@ jobs:
114117
sudo wget -O /etc/apt/trusted.gpg.d/keydb.gpg "https://$KEYDB_PPA_KEY"
115118
sudo apt-get update
116119
sudo apt-get install keydb
120+
121+
- name: Install ValKey
122+
if: matrix.server == 'valkey'
123+
run: |
124+
git clone https://github.com/valkey-io/valkey.git
125+
cd valkey && BUILD_TLS=yes sudo make install
126+
117127
- name: Build phpredis
118128
run: |
119129
phpize
@@ -127,28 +137,32 @@ jobs:
127137
sudo make -j"$(nproc)" install
128138
129139
echo 'extension = redis.so' | sudo tee -a "$(php --ini | grep 'Scan for additional .ini files' | awk '{print $7}')"/90-redis.ini
130-
- name: Start redis
140+
141+
- name: Attempt to shutdown default server
142+
run: ${{ matrix.server }}-cli SHUTDOWN NOSAVE || true
143+
144+
- name: Start ${{ matrix.server }}-server
131145
run: |
132-
redis-cli SHUTDOWN NOSAVE
133146
for PORT in $(seq 6379 6382) $(seq 32767 32769); do
134-
${{ matrix.server }} \
147+
${{ matrix.server }}-server \
135148
--port "$PORT" \
136149
--daemonize yes \
137150
--aclfile tests/users.acl \
138151
--acl-pubsub-default allchannels
139152
done
140-
${{ matrix.server }} \
153+
${{ matrix.server }}-server \
141154
--port 0 \
142155
--unixsocket /tmp/redis.sock \
143156
--daemonize yes \
144157
--aclfile tests/users.acl \
145158
--acl-pubsub-default allchannels
146-
- name: Start redis cluster
159+
160+
- name: Start ${{ matrix.server }} cluster
147161
run: |
148162
mkdir -p tests/nodes
149163
echo -n > tests/nodes/nodemap
150164
for PORT in $(seq 7000 7005); do
151-
${{ matrix.server }} \
165+
${{ matrix.server }}-server \
152166
--port "$PORT" \
153167
--cluster-enabled yes \
154168
--cluster-config-file "$PORT".conf \
@@ -157,21 +171,25 @@ jobs:
157171
--acl-pubsub-default allchannels
158172
echo 127.0.0.1:"$PORT" >> tests/nodes/nodemap
159173
done
160-
echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 7000 7005) \
174+
echo yes | ${{ matrix.server }}-cli --cluster create $(seq -f 127.0.0.1:%g 7000 7005) \
161175
--cluster-replicas 1 --user phpredis -a phpredis
162-
- name: Start redis sentinel
176+
177+
- name: Start ${{ matrix.server }} sentinel
178+
continue-on-error: ${{ matrix.server == 'valkey' }}
163179
run: |
164180
wget raw.githubusercontent.com/redis/redis/7.0/sentinel.conf
165181
for PORT in $(seq 26379 26380); do
166182
cp sentinel.conf "$PORT.conf"
167183
sed -i '/^sentinel/Id' "$PORT.conf"
168-
${{ matrix.server }} "$PORT.conf" \
184+
${{ matrix.server }}-server "$PORT.conf" \
169185
--port "$PORT" \
170186
--daemonize yes \
171187
--sentinel monitor mymaster 127.0.0.1 6379 1 \
172188
--sentinel auth-pass mymaster phpredis
173189
done
190+
174191
- name: Run tests
192+
continue-on-error: ${{ matrix.server == 'valkey' }}
175193
run: |
176194
php tests/TestRedis.php --class Redis --user phpredis --auth phpredis
177195
php tests/TestRedis.php --class RedisArray --user phpredis --auth phpredis
@@ -182,10 +200,14 @@ jobs:
182200
- name: Run tests using valgrind
183201
continue-on-error: true
184202
run: |
185-
valgrind --suppressions=tests/vg.supp --error-exitcode=1 php tests/TestRedis.php --class Redis --user phpredis --auth phpredis
186-
valgrind --suppressions=tests/vg.supp --error-exitcode=1 php tests/TestRedis.php --class RedisArray --user phpredis --auth phpredis
187-
valgrind --suppressions=tests/vg.supp --error-exitcode=1 php tests/TestRedis.php --class RedisCluster --user phpredis --auth phpredis
188-
valgrind --suppressions=tests/vg.supp --error-exitcode=1 php tests/TestRedis.php --class RedisSentinel --auth phpredis
203+
valgrind --suppressions=tests/vg.supp --error-exitcode=1 \
204+
php tests/TestRedis.php --class Redis --user phpredis --auth phpredis
205+
valgrind --suppressions=tests/vg.supp --error-exitcode=1 \
206+
php tests/TestRedis.php --class RedisArray --user phpredis --auth phpredis
207+
valgrind --suppressions=tests/vg.supp --error-exitcode=1 \
208+
php tests/TestRedis.php --class RedisCluster --user phpredis --auth phpredis
209+
valgrind --suppressions=tests/vg.supp --error-exitcode=1 \
210+
php tests/TestRedis.php --class RedisSentinel --auth phpredis
189211
env:
190212
TEST_PHP_ARGS: -e
191213
USE_ZEND_ALLOC: 0

0 commit comments

Comments
 (0)
0