Skip to content

Commit 7130e1a

Browse files
uglidepetyaslavova
andauthored
Test against unstable hiredis-py (#3617)
* Test against unstable hiredis-py * Create a separate workflow instead * Remove outdated guard for hiredis-py The guard was required to prevent cluster tests on RESP3 with hiredis-py before 3.1.0 --------- Co-authored-by: petyaslavova <petya.slavova@redis.com>
1 parent 4fd1100 commit 7130e1a

File tree

2 files changed

+89
-8
lines changed

2 files changed

+89
-8
lines changed

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

Lines changed: 23 additions & 8 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,6 +32,14 @@ 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 }}
@@ -40,8 +52,13 @@ runs:
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
@@ -108,12 +125,10 @@ runs:
108125
fi
109126

110127
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
128+
129+
echo "::group::RESP${protocol} cluster tests"
130+
invoke cluster-tests $eventloop --protocol=${protocol}
131+
echo "::endgroup::"
117132
}
118133

119134
run_tests 2 "${{inputs.event-loop}}"
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.8', '3.13']
49+
parser-backend: [ 'hiredis' ]
50+
hiredis-version: [ 'unstable' ]
51+
hiredis-branch: ${{ inputs.hiredis-branch }}
52+
event-loop: [ 'asyncio' ]
53+
env:
54+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
55+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
ref: ${{ inputs.redis-py-branch }}
60+
- name: Run tests
61+
uses: ./.github/actions/run-tests
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
parser-backend: ${{ matrix.parser-backend }}
65+
redis-version: ${{ matrix.redis-version }}
66+
hiredis-version: ${{ matrix.hiredis-version }}

0 commit comments

Comments
 (0)