From 4f5f47d8b67fe1cbc08a62df6e92de8e231abf5b Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Fri, 25 Apr 2025 11:26:06 +0200 Subject: [PATCH 1/3] Test against unstable hiredis-py --- .github/actions/run-tests/action.yml | 17 +++++++++++++++-- .github/workflows/integration.yaml | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index aa958a9236..7f7cbbbfc5 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -28,6 +28,13 @@ 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 + - name: Setup Test environment env: REDIS_VERSION: ${{ inputs.redis-version }} @@ -40,8 +47,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 @@ -86,6 +98,7 @@ runs: shell: bash - name: Run tests + continue-on-error: ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }} run: | set -e diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index f8aa5c8932..14c7a0643e 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -125,7 +125,7 @@ jobs: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] python-version: [ '3.8', '3.13'] parser-backend: [ 'hiredis' ] - hiredis-version: [ '>=3.0.0', '<3.0.0' ] + hiredis-version: [ '>=3.0.0', '<3.0.0', 'unstable' ] event-loop: [ 'asyncio' ] env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true From 8d8678d5aaf2fc82f23ec60ce20758c61433bf3a Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Fri, 25 Apr 2025 11:51:59 +0200 Subject: [PATCH 2/3] Create a separate workflow instead --- .github/actions/run-tests/action.yml | 6 +- .github/workflows/hiredis-py-integration.yaml | 66 +++++++++++++++++++ .github/workflows/integration.yaml | 2 +- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/hiredis-py-integration.yaml diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 7f7cbbbfc5..b4c8b8f875 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -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 @@ -34,6 +38,7 @@ runs: repository: redis/hiredis-py submodules: true path: hiredis-py + ref: ${{ inputs.hiredis-branch }} - name: Setup Test environment env: @@ -98,7 +103,6 @@ runs: shell: bash - name: Run tests - continue-on-error: ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }} run: | set -e diff --git a/.github/workflows/hiredis-py-integration.yaml b/.github/workflows/hiredis-py-integration.yaml new file mode 100644 index 0000000000..816a143fba --- /dev/null +++ b/.github/workflows/hiredis-py-integration.yaml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 14c7a0643e..f8aa5c8932 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -125,7 +125,7 @@ jobs: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] python-version: [ '3.8', '3.13'] parser-backend: [ 'hiredis' ] - hiredis-version: [ '>=3.0.0', '<3.0.0', 'unstable' ] + hiredis-version: [ '>=3.0.0', '<3.0.0' ] event-loop: [ 'asyncio' ] env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true From 9b73426c040edd84cb8d83a1cc7887c3d0d33b40 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Fri, 25 Apr 2025 12:58:54 +0200 Subject: [PATCH 3/3] Remove outdated guard for hiredis-py The guard was required to prevent cluster tests on RESP3 with hiredis-py before 3.1.0 --- .github/actions/run-tests/action.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index b4c8b8f875..ae9575e055 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -125,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}}"