@@ -14,6 +14,10 @@ inputs:
1414 description : ' hiredis version to test against'
1515 required : false
1616 default : ' >3.0.0'
17+ hiredis-branch :
18+ description : ' hiredis branch to test against'
19+ required : false
20+ default : ' master'
1721 event-loop :
1822 description : ' Event loop to use'
1923 required : false
@@ -28,94 +32,104 @@ runs:
2832 python-version : ${{ inputs.python-version }}
2933 cache : ' pip'
3034
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+
3143 - name : Setup Test environment
3244 env :
3345 REDIS_VERSION : ${{ inputs.redis-version }}
3446 CLIENT_LIBS_TEST_IMAGE_TAG : ${{ inputs.redis-version }}
3547 run : |
3648 set -e
37-
49+
3850 echo "::group::Installing dependencies"
3951 pip install -r dev_requirements.txt
4052 pip uninstall -y redis # uninstall Redis package installed via redis-entraid
4153 pip install -e .[jwt] # install the working copy
4254 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
4562 else
4663 echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
4764 fi
4865 echo "::endgroup::"
49-
66+
5067 echo "::group::Starting Redis servers"
5168 redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
52-
69+ echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
70+
5371 if (( redis_major_version < 8 )); then
5472 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
5775 declare -A redis_stack_version_mapping=(
5876 ["7.4.2"]="rs-7.4.0-v2"
5977 ["7.2.7"]="rs-7.2.0-v14"
60- ["6.2.17"]="rs-6.2.6-v18"
6178 )
62-
79+
6380 if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
6481 export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
6582 echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
6683 else
6784 echo "Version not found in the mapping."
6885 exit 1
6986 fi
70-
87+
7188 if (( redis_major_version < 7 )); then
7289 export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
7390 export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
74- echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
7591 fi
76-
92+
7793 invoke devenv --endpoints=all-stack
7894 else
7995 echo "Using redis CE for module tests"
8096 echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
8197 invoke devenv --endpoints all
82- fi
83-
98+ fi
99+
84100 sleep 10 # time to settle
85101 echo "::endgroup::"
86102 shell : bash
87103
88104 - name : Run tests
89105 run : |
90106 set -e
91-
107+
92108 run_tests() {
93109 local protocol=$1
94110 local eventloop=""
95-
111+
96112 if [ "${{inputs.event-loop}}" == "uvloop" ]; then
97113 eventloop="--uvloop"
98114 fi
99-
115+
100116 echo "::group::RESP${protocol} standalone tests"
101117 echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
102-
118+
103119 if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
104120 echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
105121 invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
106- else
122+ else
107123 invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
108124 fi
109-
125+
126+ echo "::endgroup::"
127+
128+ echo "::group::RESP${protocol} cluster tests"
129+ invoke cluster-tests $eventloop --protocol=${protocol}
110130 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
117131 }
118-
132+
119133 run_tests 2 "${{inputs.event-loop}}"
120134 run_tests 3 "${{inputs.event-loop}}"
121135 shell : bash
0 commit comments