Hiredis-py integration tests workflow (redis/redis-py)
The Hiredis-py integration tests workflow from redis/redis-py, explained and optimized by Latchkey.
- A
- CI health grade
- 85/100
- Health score
- 2
- Jobs per trigger
- 2
- Fixes in the optimized version
In short
- CI health: A (excellent)
- The optimized version below points runs-on at Latchkey managed runners and adds job timeouts.
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:
runs-on: ubuntu-latest
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: ubuntu-latest
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. Each Linux x64 job moves to the Latchkey size matching its vCPU count,latchkey-smallfor a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written. - 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. All of them run on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one they are free. Estimate the monthly difference with your own run counts.
Actions used in this workflow
- actions/checkout