diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index aa958a9236..ae9575e055 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 @@ -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 }} @@ -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 @@ -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}}" 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