Skip to content

Commit d5d0f27

Browse files
committed
introduce github workflow for ci similar to the one in redis-py
use prerelease for 8.0-M4
1 parent 94b88f5 commit d5d0f27

File tree

7 files changed

+159
-39
lines changed

7 files changed

+159
-39
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 'Run go-redis tests'
2+
description: 'Runs go-redis tests against different Redis versions and configurations'
3+
inputs:
4+
go-version:
5+
description: 'Go version to use for running tests'
6+
default: '1.23'
7+
redis-version:
8+
description: 'Redis version to test against'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up ${{ inputs.go-version }}
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: ${{ inputs.go-version }}
17+
18+
- name: Setup Test environment
19+
env:
20+
REDIS_VERSION: ${{ inputs.redis-version }}
21+
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
22+
run: |
23+
set -e
24+
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
25+
if (( redis_major_version < 8 )); then
26+
echo "Using redis-stack for module tests"
27+
else
28+
echo "Using redis CE for module tests"
29+
fi
30+
31+
# Mapping of redis version to redis testing containers
32+
declare -A redis_version_mapping=(
33+
["8.0-M03"]="8.0-M04-pre"
34+
["7.4.2"]="rs-7.4.0-v2"
35+
["7.2.7"]="rs-7.2.0-v14"
36+
)
37+
38+
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
39+
echo "REDIS_IMAGE=redis:${{ inputs.redis-version }}" >> $GITHUB_ENV
40+
echo "CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:${redis_version_mapping[$REDIS_VERSION]}" >> $GITHUB_ENV
41+
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
42+
else
43+
echo "Version not found in the mapping."
44+
exit 1
45+
fi
46+
sleep 10 # time to settle
47+
shell: bash
48+
- name: Set up Docker Compose environment with redis ${{ inputs.redis-version }}
49+
run: docker compose --profile all up -d
50+
shell: bash
51+
- name: Run tests
52+
env:
53+
USE_CONTAINERIZED_REDIS: "true"
54+
RE_CLUSTER: "true"
55+
run: |
56+
go test \
57+
--ginkgo.skip-file="ring_test.go" \
58+
--ginkgo.skip-file="sentinel_test.go" \
59+
--ginkgo.skip-file="osscluster_test.go" \
60+
--ginkgo.skip-file="pubsub_test.go" \
61+
--ginkgo.skip-file="gears_commands_test.go" \
62+
--ginkgo.label-filter='!NonRedisEnterprise'
63+
shell: bash

.github/workflows/build.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
go-version: [1.19.x, 1.20.x, 1.21.x]
19+
go-version: [1.21.x, 1.22.x, 1.23.x]
2020

2121
services:
2222
redis:
@@ -50,39 +50,22 @@ jobs:
5050
strategy:
5151
fail-fast: false
5252
matrix:
53-
redis_version:
54-
- "8.0-M01"
55-
- "7.4.1"
56-
- "7.2.6"
57-
- "6.2.16"
53+
redis-version:
54+
- "8.0-M03" # 8.0 milestone 4
55+
- "7.4.2" # should use redis stack 7.4
56+
- "7.2.7" # should redis stack 7.2
5857
go-version:
59-
- "1.19.x"
60-
- "1.20.x"
61-
- "1.21.x"
58+
- "1.22.x"
59+
- "1.23.x"
6260

6361
steps:
64-
- name: Set up ${{ matrix.go-version }}
65-
uses: actions/setup-go@v5
66-
with:
67-
go-version: ${{ matrix.go-version }}
6862

6963
- name: Checkout code
7064
uses: actions/checkout@v4
71-
72-
# Set up Docker Compose environment
73-
- name: Set up Docker Compose environment
74-
run: |
75-
docker compose --profile all up -d
76-
65+
7766
- name: Run tests
78-
env:
79-
USE_CONTAINERIZED_REDIS: "true"
80-
RE_CLUSTER: "true"
81-
run: |
82-
go test \
83-
--ginkgo.skip-file="ring_test.go" \
84-
--ginkgo.skip-file="sentinel_test.go" \
85-
--ginkgo.skip-file="osscluster_test.go" \
86-
--ginkgo.skip-file="pubsub_test.go" \
87-
--ginkgo.skip-file="gears_commands_test.go" \
88-
--ginkgo.label-filter='!NonRedisEnterprise'
67+
uses: ./.github/actions/run-tests
68+
with:
69+
go-version: ${{matrix.go-version}}
70+
redis-version: ${{ matrix.redis-version }}
71+

.github/workflows/doctests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
go-version: [ "1.18", "1.19", "1.20", "1.21" ]
28+
go-version: [ "1.20", "1.21", "1.22", "1.23" ]
2929

3030
steps:
3131
- name: Set up ${{ matrix.go-version }}

.github/workflows/test-redis-enterprise.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
re-build: ["7.4.2-54"]
2020

2121
steps:
@@ -46,8 +46,8 @@ jobs:
4646

4747
- name: Test
4848
env:
49-
RE_CLUSTER: "1"
50-
USE_CONTAINERIZED_REDIS: "1"
49+
RE_CLUSTER: true
50+
USE_CONTAINERIZED_REDIS: true
5151
run: |
5252
go test \
5353
--ginkgo.skip-file="ring_test.go" \

docker-compose.yml

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,88 @@
22

33
services:
44

5-
redis-stanalone:
6-
image: redislabs/client-libs-test:8.0-M02
5+
redis:
6+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1}
77
container_name: redis-standalone
88
environment:
9+
- TLS_ENABLED=yes
910
- REDIS_CLUSTER=no
1011
- PORT=6379
1112
- TLS_PORT=6666
12-
13+
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --tls-auth-clients optional --save ""}
1314
ports:
1415
- 6379:6379
15-
- 6380:6379
1616
- 6666:6666 # TLS port
1717
volumes:
18-
- "./dockers/redis-standalone:/redis/work"
18+
- "./dockers/standalone:/redis/work"
1919
profiles:
2020
- standalone
21+
- sentinel
22+
- all-stack
2123
- all
24+
25+
cluster:
26+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1}
27+
container_name: redis-cluster
28+
environment:
29+
- REDIS_CLUSTER=yes
30+
- NODES=6
31+
- REPLICAS=1
32+
- TLS_ENABLED=yes
33+
- PORT=16379
34+
- TLS_PORT=27379
35+
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --tls-auth-clients optional --save ""}
36+
ports:
37+
- "16379-16384:16379-16384"
38+
- "27379-27384:27379-27384"
39+
volumes:
40+
- "./dockers/cluster:/redis/work"
41+
profiles:
42+
- cluster
43+
- all-stack
44+
- all
45+
46+
sentinel:
47+
image: ${REDIS_IMAGE:-redis:7.4.1}
48+
container_name: redis-sentinel
49+
depends_on:
50+
- redis
51+
entrypoint: "redis-sentinel /redis.conf --port 26379"
52+
ports:
53+
- 26379:26379
54+
volumes:
55+
- "./dockers/sentinel.conf:/redis.conf"
56+
profiles:
57+
- sentinel
58+
- all-stack
59+
- all
60+
61+
sentinel2:
62+
image: ${REDIS_IMAGE:-redis:7.4.1}
63+
container_name: redis-sentinel2
64+
depends_on:
65+
- redis
66+
entrypoint: "redis-sentinel /redis.conf --port 26380"
67+
ports:
68+
- 26380:26380
69+
volumes:
70+
- "./dockers/sentinel.conf:/redis.conf"
71+
profiles:
72+
- sentinel
73+
- all-stack
74+
- all
75+
76+
sentinel3:
77+
image: ${REDIS_IMAGE:-redis:7.4.1}
78+
container_name: redis-sentinel3
79+
depends_on:
80+
- redis
81+
entrypoint: "redis-sentinel /redis.conf --port 26381"
82+
ports:
83+
- 26381:26381
84+
volumes:
85+
- "./dockers/sentinel.conf:/redis.conf"
86+
profiles:
87+
- sentinel
88+
- all-stack
89+
- all

dockers/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
redis-standalone

dockers/sentinel.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sentinel resolve-hostnames yes
2+
sentinel monitor go-redis-test redis 6379 2
3+
sentinel down-after-milliseconds go-redis-test 5000
4+
sentinel failover-timeout go-redis-test 60000
5+
sentinel parallel-syncs go-redis-test 1

0 commit comments

Comments
 (0)