-
Notifications
You must be signed in to change notification settings - Fork 15
291 lines (244 loc) · 8.83 KB
/
Copy pathCI.yml
File metadata and controls
291 lines (244 loc) · 8.83 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
lint:
name: Rubocop
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Lint
run: bundle exec rubocop
build-native-library:
name: Build Native Library
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install protoc (protobuf)
uses: arduino/setup-protoc@v3
with:
version: "29.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
valkey-glide/ffi/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('valkey-glide/ffi/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build native library
working-directory: valkey-glide/ffi
run: cargo build --release
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: native-lib-linux-x64
path: valkey-glide/ffi/target/release/libglide_ffi.so
if-no-files-found: error
standalone:
needs: [build-native-library]
runs-on: ubuntu-latest
name: Standalone / Ruby ${{ matrix.ruby }} Valkey ${{ matrix.valkey }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
ruby:
- 3.4
- 3.3
- 3.2
- 3.1
- 3.0
valkey:
- 7.2.10
- 8
- 8.1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download native library
uses: actions/download-artifact@v4
with:
name: native-lib-linux-x64
path: valkey-glide/ffi/target/release/
- name: Copy modules for testing
run: |
echo "Copying modules for testing..."
mkdir -p test/fixtures
echo "Copying RedisJSON module for JSON commands testing..."
cp .github/files/librejson-v2.8.15.so test/fixtures/redisjson.so
chmod +x test/fixtures/redisjson.so
ls -lh test/fixtures/redisjson.so
echo "Copying RedisBloom module..."
cp .github/files/redisbloom-amd64-v2.6.12.so test/fixtures/redisbloom.so
chmod +x test/fixtures/redisbloom.so
ls -lh test/fixtures/redisbloom.so
echo "Copying RediSearch module for Vector Search commands testing..."
cp .github/files/redisearch-amd64-v2.10.24.so test/fixtures/redisearch.so
chmod +x test/fixtures/redisearch.so
ls -lh test/fixtures/redisearch.so
- name: Generate SSL certificates for testing
run: |
echo "Generating SSL certificates for SSL/TLS testing..."
ruby test/fixtures/ssl/generate_certs.rb
echo "SSL certificates generated:"
ls -lh test/fixtures/ssl/*.pem
- name: Start Valkey with MODULE commands enabled
run: |
echo "Starting Valkey ${{ matrix.valkey }} with MODULE commands enabled..."
docker run -d \
--name valkey-test \
-p 6379:6379 \
-v $(pwd)/test/fixtures:/tmp/modules:ro \
valkey/valkey:${{ matrix.valkey }} \
valkey-server --enable-module-command yes
echo "Waiting for Valkey to be ready..."
for i in {1..30}; do
if docker exec valkey-test valkey-cli ping > /dev/null 2>&1; then
echo "Valkey is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 1
done
echo "Verifying MODULE commands are enabled..."
docker exec valkey-test valkey-cli CONFIG GET enable-module-command
echo "Verifying module files are accessible..."
docker exec valkey-test ls -lh /tmp/modules/
- name: Start SSL-enabled Valkey on port 6380
run: |
echo "Creating Valkey SSL configuration..."
cat > /tmp/valkey-ssl.conf << 'EOF'
# Disable regular port, use TLS port only
port 0
tls-port 6380
# SSL/TLS certificate files
tls-cert-file /ssl/server-cert.pem
tls-key-file /ssl/server-key.pem
tls-ca-cert-file /ssl/ca-cert.pem
# Don't require client certificates (optional)
tls-auth-clients no
# Allow TLS v1.2 and v1.3
tls-protocols "TLSv1.2 TLSv1.3"
EOF
echo "SSL configuration created:"
cat /tmp/valkey-ssl.conf
echo "Verifying SSL certificate files exist..."
ls -lh $(pwd)/test/fixtures/ssl/*.pem
echo "Starting SSL-enabled Valkey on port 6380..."
docker run -d \
--name valkey-ssl \
-p 6380:6380 \
-v $(pwd)/test/fixtures/ssl:/ssl:ro \
-v /tmp/valkey-ssl.conf:/etc/valkey-ssl.conf:ro \
valkey/valkey:${{ matrix.valkey }} \
valkey-server /etc/valkey-ssl.conf
echo "Waiting for container to start..."
sleep 2
echo "Checking if container is running..."
docker ps -a | grep valkey-ssl || echo "Container not found!"
echo "Checking container logs..."
docker logs valkey-ssl || echo "Could not get logs"
echo "Verifying SSL cert files are accessible inside container..."
docker exec valkey-ssl ls -lh /ssl/ || echo "Cannot access /ssl/ directory"
docker exec valkey-ssl cat /etc/valkey-ssl.conf || echo "Cannot read config file"
echo "Waiting for SSL Valkey to be ready..."
for i in {1..30}; do
if docker exec valkey-ssl valkey-cli --tls --insecure -p 6380 ping > /dev/null 2>&1; then
echo "SSL Valkey is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 1
done
echo "Verifying SSL connection from host..."
docker exec valkey-ssl valkey-cli --tls --insecure -p 6380 ping || echo "SSL verification failed"
echo "Testing connection from host machine..."
docker run --rm --network host valkey/valkey:${{ matrix.valkey }} valkey-cli --tls --insecure -p 6380 ping || echo "Host connection test failed"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run standalone tests
run: bundle exec rake test:standalone
- name: Stop Valkey containers
if: always()
run: |
docker stop valkey-test && docker rm valkey-test || true
docker stop valkey-ssl && docker rm valkey-ssl || true
cluster:
needs: [build-native-library]
runs-on: ubuntu-latest
name: Cluster / Ruby ${{ matrix.ruby }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
ruby:
- 3.4
- 3.3
- 3.2
- 3.1
- 3.0
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build and install Valkey from source
run: |
echo "Building Valkey 8.0.0 from source..."
git clone https://github.com/valkey-io/valkey.git
cd valkey
git checkout 8.0.0
make BUILD_TLS=yes -j4
sudo make install
echo "Verifying Valkey installation..."
valkey-server --version
- name: Download native library
uses: actions/download-artifact@v4
with:
name: native-lib-linux-x64
path: valkey-glide/ffi/target/release/
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run cluster tests
run: bundle exec rake test:cluster
timeout-minutes: 25
- name: Upload cluster logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: cluster-logs-${{ matrix.ruby }}
path: valkey-glide/utils/clusters/
retention-days: 7