Skip to content

Test against unstable hiredis-py #3617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
description: 'hiredis version to test against'
required: false
default: '>3.0.0'
hiredis-branch:
description: 'hiredis branch to test against'
required: false
default: 'master'
event-loop:
description: 'Event loop to use'
required: false
Expand All @@ -28,6 +32,14 @@ runs:
python-version: ${{ inputs.python-version }}
cache: 'pip'

- uses: actions/checkout@v4
if: ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }}
with:
repository: redis/hiredis-py
submodules: true
path: hiredis-py
ref: ${{ inputs.hiredis-branch }}

- name: Setup Test environment
env:
REDIS_VERSION: ${{ inputs.redis-version }}
Expand All @@ -40,8 +52,13 @@ runs:
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
pip install -e .[jwt] # install the working copy
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
pip install "hiredis${{inputs.hiredis-version}}"
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
if [[ "${{inputs.hiredis-version}}" == "unstable" ]]; then
echo "Installing unstable version of hiredis from local directory"
pip install -e ./hiredis-py
else
pip install "hiredis${{inputs.hiredis-version}}"
fi
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
else
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
fi
Expand Down Expand Up @@ -108,12 +125,10 @@ runs:
fi

echo "::endgroup::"

if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
echo "::group::RESP${protocol} cluster tests"
invoke cluster-tests $eventloop --protocol=${protocol}
echo "::endgroup::"
fi

echo "::group::RESP${protocol} cluster tests"
invoke cluster-tests $eventloop --protocol=${protocol}
echo "::endgroup::"
}

run_tests 2 "${{inputs.event-loop}}"
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/hiredis-py-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Hiredis-py integration tests

on:
workflow_dispatch:
inputs:
redis-py-branch:
description: 'redis-py branch to run tests on'
required: true
default: 'master'
hiredis-branch:
description: 'hiredis-py branch to run tests on'
required: true
default: 'master'

concurrency:
group: ${{ github.event.pull_request.number || github.ref }}-hiredis-integration
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
COVERAGE_CORE: sysmon
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
CURRENT_REDIS_VERSION: '7.4.2'

jobs:
redis_version:
runs-on: ubuntu-latest
outputs:
CURRENT: ${{ env.CURRENT_REDIS_VERSION }}
steps:
- name: Compute outputs
run: |
echo "CURRENT=${{ env.CURRENT_REDIS_VERSION }}" >> $GITHUB_OUTPUT

hiredis-tests:
runs-on: ubuntu-latest
needs: [redis_version]
timeout-minutes: 60
strategy:
max-parallel: 15
fail-fast: false
matrix:
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
python-version: [ '3.8', '3.13']
parser-backend: [ 'hiredis' ]
hiredis-version: [ 'unstable' ]
hiredis-branch: ${{ inputs.hiredis-branch }}
event-loop: [ 'asyncio' ]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.redis-py-branch }}
- name: Run tests
uses: ./.github/actions/run-tests
with:
python-version: ${{ matrix.python-version }}
parser-backend: ${{ matrix.parser-backend }}
redis-version: ${{ matrix.redis-version }}
hiredis-version: ${{ matrix.hiredis-version }}
Loading