-
-
Notifications
You must be signed in to change notification settings - Fork 18
122 lines (108 loc) · 3.54 KB
/
tests.yml
File metadata and controls
122 lines (108 loc) · 3.54 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Tests
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
tests-single-node:
runs-on: ubuntu-latest
services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
redis:
image: redis:6.0
ports:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: true
matrix:
php: [ '8.2', '8.3', '8.4', '8.5' ]
stability: [ prefer-stable ]
name: PHP ${{ matrix.php }} (Single-Node Redis)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: apcu, redis
ini-values: apc.enable_cli=1
coverage: none
env:
REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4
REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Install Predis
run: composer require predis/predis
- name: Execute tests
run: vendor/bin/phpunit
tests-cluster:
runs-on: ubuntu-latest
services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
strategy:
fail-fast: true
matrix:
php: [ '8.2', '8.3', '8.4', '8.5' ]
stability: [ prefer-stable ]
name: PHP ${{ matrix.php }} (Redis Cluster)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Redis Server for Cluster
run: |
sudo apt-get update
sudo apt-get install -y redis-server
- name: Start Redis Cluster
run: |
BASE_PORT=7000
NODE_COUNT=3
node_addresses=""
for i in $(seq 0 $((NODE_COUNT - 1))); do
port=$((BASE_PORT + i))
mkdir -p ./redis-cluster/node-$port
node_addresses+=" 127.0.0.1:$port"
cat > ./redis-cluster/node-$port/redis.conf <<EOF
port $port
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly no
daemonize yes
bind 127.0.0.1
dir "$(pwd)/redis-cluster/node-$port"
EOF
redis-server ./redis-cluster/node-$port/redis.conf
done
sleep 3
echo "yes" | redis-cli --cluster create $node_addresses --cluster-replicas 0
echo "Redis cluster is up and running."
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: apcu, redis
ini-values: apc.enable_cli=1
coverage: none
env:
REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4
REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Install Predis
run: composer require predis/predis
- name: Execute cluster tests
env:
PCA_REDIS_0_NODES: '["127.0.0.1:7000","127.0.0.1:7001","127.0.0.1:7002"]'
run: vendor/bin/phpunit