@@ -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,106 @@ 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
- pip install -U setuptools wheel
40
- pip install -r requirements.txt
41
51
pip install -r dev_requirements.txt
52
+ pip uninstall -y redis # uninstall Redis package installed via redis-entraid
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
- ["7.4.2"]="rs-7.4.0-v2"
59
- ["7.2.7"]="rs-7.2.0-v14"
60
- ["6.2.17"]="rs-6.2.6-v18"
76
+ ["7.4.4"]="rs-7.4.0-v5"
77
+ ["7.2.9"]="rs-7.2.0-v17"
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
94
+
78
95
else
79
96
echo "Using redis CE for module tests"
97
+ export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=$REDIS_VERSION
80
98
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
81
99
invoke devenv --endpoints all
82
- fi
83
-
100
+ fi
101
+
84
102
sleep 10 # time to settle
85
103
echo "::endgroup::"
86
104
shell : bash
87
105
88
106
- name : Run tests
89
107
run : |
90
108
set -e
91
-
109
+
92
110
run_tests() {
93
111
local protocol=$1
94
112
local eventloop=""
95
-
113
+
96
114
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
97
115
eventloop="--uvloop"
98
116
fi
99
-
117
+
100
118
echo "::group::RESP${protocol} standalone tests"
101
119
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
102
-
120
+
103
121
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
104
122
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
105
123
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
106
- else
124
+ else
107
125
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
108
126
fi
109
-
127
+
128
+ echo "::endgroup::"
129
+
130
+ echo "::group::RESP${protocol} cluster tests"
131
+ invoke cluster-tests $eventloop --protocol=${protocol}
110
132
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
133
}
118
-
134
+
119
135
run_tests 2 "${{inputs.event-loop}}"
120
136
run_tests 3 "${{inputs.event-loop}}"
121
137
shell : bash
0 commit comments