@@ -14,6 +14,10 @@ inputs:
14
14
description : ' hiredis version to test against'
15
15
required : false
16
16
default : ' >3.0.0'
17
+ hiredis-branch :
18
+ description : ' hiredis branch to test against'
19
+ required : false
20
+ default : ' master'
17
21
event-loop :
18
22
description : ' Event loop to use'
19
23
required : false
@@ -28,94 +32,104 @@ runs:
28
32
python-version : ${{ inputs.python-version }}
29
33
cache : ' pip'
30
34
35
+ - uses : actions/checkout@v4
36
+ if : ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }}
37
+ with :
38
+ repository : redis/hiredis-py
39
+ submodules : true
40
+ path : hiredis-py
41
+ ref : ${{ inputs.hiredis-branch }}
42
+
31
43
- name : Setup Test environment
32
44
env :
33
45
REDIS_VERSION : ${{ inputs.redis-version }}
34
46
CLIENT_LIBS_TEST_IMAGE_TAG : ${{ inputs.redis-version }}
35
47
run : |
36
48
set -e
37
-
49
+
38
50
echo "::group::Installing dependencies"
39
51
pip install -r dev_requirements.txt
40
52
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
41
53
pip install -e .[jwt] # install the working copy
42
54
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
43
- pip install "hiredis${{inputs.hiredis-version}}"
44
- echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
55
+ if [[ "${{inputs.hiredis-version}}" == "unstable" ]]; then
56
+ echo "Installing unstable version of hiredis from local directory"
57
+ pip install -e ./hiredis-py
58
+ else
59
+ pip install "hiredis${{inputs.hiredis-version}}"
60
+ fi
61
+ echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
45
62
else
46
63
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
47
64
fi
48
65
echo "::endgroup::"
49
-
66
+
50
67
echo "::group::Starting Redis servers"
51
68
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
52
-
69
+ echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
70
+
53
71
if (( redis_major_version < 8 )); then
54
72
echo "Using redis-stack for module tests"
55
-
56
- # Mapping of redis version to stack version
73
+
74
+ # Mapping of redis version to stack version
57
75
declare -A redis_stack_version_mapping=(
58
76
["7.4.2"]="rs-7.4.0-v2"
59
77
["7.2.7"]="rs-7.2.0-v14"
60
- ["6.2.17"]="rs-6.2.6-v18"
61
78
)
62
-
79
+
63
80
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
64
81
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
65
82
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
66
83
else
67
84
echo "Version not found in the mapping."
68
85
exit 1
69
86
fi
70
-
87
+
71
88
if (( redis_major_version < 7 )); then
72
89
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
73
90
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
74
- echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
75
91
fi
76
-
92
+
77
93
invoke devenv --endpoints=all-stack
78
94
else
79
95
echo "Using redis CE for module tests"
80
96
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
81
97
invoke devenv --endpoints all
82
- fi
83
-
98
+ fi
99
+
84
100
sleep 10 # time to settle
85
101
echo "::endgroup::"
86
102
shell : bash
87
103
88
104
- name : Run tests
89
105
run : |
90
106
set -e
91
-
107
+
92
108
run_tests() {
93
109
local protocol=$1
94
110
local eventloop=""
95
-
111
+
96
112
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
97
113
eventloop="--uvloop"
98
114
fi
99
-
115
+
100
116
echo "::group::RESP${protocol} standalone tests"
101
117
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
102
-
118
+
103
119
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
104
120
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
105
121
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
106
- else
122
+ else
107
123
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
108
124
fi
109
-
125
+
126
+ echo "::endgroup::"
127
+
128
+ echo "::group::RESP${protocol} cluster tests"
129
+ invoke cluster-tests $eventloop --protocol=${protocol}
110
130
echo "::endgroup::"
111
-
112
- if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
113
- echo "::group::RESP${protocol} cluster tests"
114
- invoke cluster-tests $eventloop --protocol=${protocol}
115
- echo "::endgroup::"
116
- fi
117
131
}
118
-
132
+
119
133
run_tests 2 "${{inputs.event-loop}}"
120
134
run_tests 3 "${{inputs.event-loop}}"
121
135
shell : bash
0 commit comments