Hiredis-py integration tests workflow (redis/redis-py)
The Hiredis-py integration tests workflow from redis/redis-py, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Hiredis-py integration tests workflow from the redis/redis-py repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
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_REDIS_VERSION: '8.8.0'
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.10', '3.14', '3.14t']
parser-backend: [ 'hiredis' ]
hiredis-version: [ 'unstable' ]
event-loop: [ 'asyncio' ]
test-config:
- fixed-clients
- default-legacy_responses-standalone
- default-legacy_responses-cluster
- default-unified_responses-standalone
- default-unified_responses-cluster
- 2-legacy_responses-standalone
- 2-legacy_responses-cluster
- 2-unified_responses-standalone
- 2-unified_responses-cluster
- 3-legacy_responses-standalone
- 3-legacy_responses-cluster
- 3-unified_responses-standalone
- 3-unified_responses-cluster
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}}; Config:${{matrix.test-config}}
steps:
- uses: actions/checkout@v7
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 }}
hiredis-branch: ${{ inputs.hiredis-branch }}
test-config: ${{ matrix.test-config }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
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_REDIS_VERSION: '8.8.0' jobs: redis_version: timeout-minutes: 30 runs-on: latchkey-small outputs: CURRENT: ${{ env.CURRENT_REDIS_VERSION }} steps: - name: Compute outputs run: | echo "CURRENT=${{ env.CURRENT_REDIS_VERSION }}" >> $GITHUB_OUTPUT hiredis-tests: runs-on: latchkey-small needs: [redis_version] timeout-minutes: 60 strategy: max-parallel: 15 fail-fast: false matrix: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] python-version: [ '3.10', '3.14', '3.14t'] parser-backend: [ 'hiredis' ] hiredis-version: [ 'unstable' ] event-loop: [ 'asyncio' ] test-config: - fixed-clients - default-legacy_responses-standalone - default-legacy_responses-cluster - default-unified_responses-standalone - default-unified_responses-cluster - 2-legacy_responses-standalone - 2-legacy_responses-cluster - 2-unified_responses-standalone - 2-unified_responses-cluster - 3-legacy_responses-standalone - 3-legacy_responses-cluster - 3-unified_responses-standalone - 3-unified_responses-cluster 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}}; Config:${{matrix.test-config}} steps: - uses: actions/checkout@v7 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 }} hiredis-branch: ${{ inputs.hiredis-branch }} test-config: ${{ matrix.test-config }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 2 jobs (40 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.