-
-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (68 loc) · 1.97 KB
/
redis.yml
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
# https://docs.github.com/en/actions/guides/creating-redis-service-containers
name: Redis
on: push
jobs:
redis-container:
runs-on: ubuntu-latest
container: node
services:
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
REDIS_HOST: redis
steps:
- name: Install redis-cli
run: |
apt-get update
apt-get install --yes redis-tools
- name: Connect to Redis with CLI
run: redis-cli -h $REDIS_HOST INFO SERVER | grep redis_version
- name: Install redis
run: npm install redis
- name: Connect to Redis with Node.js
run: |
cat > client.js << EOF
const redis = require('redis');
const client = redis.createClient({
host: process.env.REDIS_HOST,
});
client.on('ready', () => {
console.log(client.server_info.redis_version);
client.end(true);
});
EOF
node client.js
redis-service:
runs-on: ubuntu-latest
services:
redis:
image: redis
# Opens tcp port 6379 on the host and service container
ports:
- 6379:6379
steps:
- name: Install redis-cli
run: |
sudo apt-get update
sudo apt-get install --yes redis-tools
- name: Connect to Redis with CLI
run: redis-cli INFO SERVER | grep redis_version
- name: Install redis
run: npm install redis
- name: Connect to Redis with Node.js
run: |
cat > client.js << EOF
const redis = require('redis');
const client = redis.createClient();
client.on('ready', () => {
console.log(client.server_info.redis_version);
client.end(true);
});
EOF
node client.js