Skip to content

Commit dc0556b

Browse files
authored
Merge branch 'master' into sentinel-master-detection
2 parents 452ffc6 + 0d0cfe6 commit dc0556b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4538
-1472
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ _Please make sure to review and check all of these items:_
77
- [ ] Is the new or changed code fully tested?
88
- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
99
- [ ] Is there an example added to the examples folder (if applicable)?
10-
- [ ] Was the change added to CHANGES file?
1110

1211
_NOTE: these things are not required to open a PR and can be done
1312
afterwards / while the PR is open._

.github/actions/run-tests/action.yml

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.github/wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ APM
22
ARGV
33
BFCommands
44
CacheImpl
5+
CAS
56
CFCommands
67
CMSCommands
78
ClusterNode
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Hiredis-py integration tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
redis-py-branch:
7+
description: 'redis-py branch to run tests on'
8+
required: true
9+
default: 'master'
10+
hiredis-branch:
11+
description: 'hiredis-py branch to run tests on'
12+
required: true
13+
default: 'master'
14+
15+
concurrency:
16+
group: ${{ github.event.pull_request.number || github.ref }}-hiredis-integration
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read # to fetch code (actions/checkout)
21+
22+
env:
23+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
24+
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
25+
COVERAGE_CORE: sysmon
26+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
27+
CURRENT_REDIS_VERSION: '7.4.2'
28+
29+
jobs:
30+
redis_version:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
CURRENT: ${{ env.CURRENT_REDIS_VERSION }}
34+
steps:
35+
- name: Compute outputs
36+
run: |
37+
echo "CURRENT=${{ env.CURRENT_REDIS_VERSION }}" >> $GITHUB_OUTPUT
38+
39+
hiredis-tests:
40+
runs-on: ubuntu-latest
41+
needs: [redis_version]
42+
timeout-minutes: 60
43+
strategy:
44+
max-parallel: 15
45+
fail-fast: false
46+
matrix:
47+
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
48+
python-version: [ '3.9', '3.13']
49+
parser-backend: [ 'hiredis' ]
50+
hiredis-version: [ 'unstable' ]
51+
event-loop: [ 'asyncio' ]
52+
env:
53+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
54+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
ref: ${{ inputs.redis-py-branch }}
59+
- name: Run tests
60+
uses: ./.github/actions/run-tests
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
parser-backend: ${{ matrix.parser-backend }}
64+
redis-version: ${{ matrix.redis-version }}
65+
hiredis-version: ${{ matrix.hiredis-version }}
66+
hiredis-branch: ${{ inputs.hiredis-branch }}

.github/workflows/integration.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
max-parallel: 15
7575
fail-fast: false
7676
matrix:
77-
redis-version: ['8.0-RC1-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7', '6.2.17']
78-
python-version: ['3.8', '3.13']
77+
redis-version: ['8.0.1-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7']
78+
python-version: ['3.9', '3.13']
7979
parser-backend: ['plain']
8080
event-loop: ['asyncio']
8181
env:
@@ -123,9 +123,9 @@ jobs:
123123
fail-fast: false
124124
matrix:
125125
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
126-
python-version: [ '3.8', '3.13']
126+
python-version: [ '3.9', '3.13']
127127
parser-backend: [ 'hiredis' ]
128-
hiredis-version: [ '>=3.0.0', '<3.0.0' ]
128+
hiredis-version: [ '>=3.2.0', '<3.0.0' ]
129129
event-loop: [ 'asyncio' ]
130130
env:
131131
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
@@ -149,7 +149,7 @@ jobs:
149149
fail-fast: false
150150
matrix:
151151
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
152-
python-version: [ '3.8', '3.13' ]
152+
python-version: [ '3.9', '3.13' ]
153153
parser-backend: [ 'plain' ]
154154
event-loop: [ 'uvloop' ]
155155
env:
@@ -191,7 +191,7 @@ jobs:
191191
strategy:
192192
fail-fast: false
193193
matrix:
194-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
194+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
195195
steps:
196196
- uses: actions/checkout@v4
197197
- uses: actions/setup-python@v5

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Checkout
99
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.48.0
11+
uses: rojopolis/spellcheck-github-actions@0.49.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ vagrant/.vagrant
99
.cache
1010
.eggs
1111
.idea
12+
.vscode
1213
.coverage
1314
env
1415
venv

0 commit comments

Comments
 (0)