Skip to content

Compatibility

Compatibility #1568

Workflow file for this run

name: Compatibility
on:
create:
tags: ['*']
push:
branches: ['master']
schedule:
- cron: 0 23 * * *
jobs:
lint:
name: Lint (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/dev.txt
python setup.py build
- name: Lint with ruff
run: |
ruff coredis tests
- name: Lint with black
run: |
black --check coredis tests
- name: Check imports
run: |
isort -c --profile=black coredis tests
- name: Check types
run: |
mypy coredis
- name: Check auto generated sources
run: |
make templated-sources
if [ ! -z "$(git diff coredis)" ];
then
echo "Auto-generated source are not up to date"
git diff
exit 1
fi;
test:
name: Test (Python ${{ matrix.python-version }}, Redis ${{ matrix.redis-version }}${{ matrix.uvloop == 'True' && ', uvloop' || ''}}${{ matrix.orjson == 'True' && ', orjson' || ''}}${{ matrix.extensions == 'True' && ', compiled' || ''}}${{ matrix.label && format(', {0}', matrix.label) || '' }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.redis-version == 'next' }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
redis-version: ["6.2", "7.0", "7.2", "latest"]
test_params: ["-m '(not (keydb or dragonfly or valkey or redict))'"]
orjson: ["False"]
uvloop: ["True", "False"]
runtime_type_checks: ["True"]
extensions: ["True"]
label: [""]
include:
- python-version: "3.11"
redis-version: next
test_params: "-m '(not (keydb or dragonfly or valkey or redict))'"
runtime_type_checks: "True"
label: ""
- python-version: "3.11"
redis-version: latest
test_params: "-m '(not (keydb or dragonfly or valkey or redict))'"
extensions: "False"
runtime_type_checks: "True"
label: ""
- python-version: "3.11"
redis-version: latest
test_params: "-m '(not (keydb or dragonfly or valkey or redict))'"
runtime_type_checks: "True"
orjson: "True"
label: ""
- python-version: "3.11"
redis-version: 7.0
test_params: "-m '(not (keydb or dragonfly or valkey or redict))'"
runtime_type_checks: "False"
label: ""
- python-version: "3.11"
redis-version: 7.0
test_params: "-m keydb"
runtime_type_checks: "False"
label: "KeyDB"
- python-version: "3.11"
redis-version: 7.0
test_params: "-m dragonfly"
label: "Dragonfly"
- python-version: "3.11"
redis-version: 7.0
test_params: "-m valkey"
label: "Valkey"
- python-version: "3.11"
redis-version: 7.0
test_params: "-m redict"
label: "Redict"
- python-version: "pypy-3.8"
redis-version: 7.0
test_params: "-m '(not (keydb or dragonfly or valkey or redict))' tests/commands tests/test_tracking_cache.py"
runtime_type_checks: "False"
extensions: "False"
uvloop: "False"
label: ""
- python-version: "pypy-3.9"
redis-version: 7.0
test_params: "-m '(not (keydb or dragonfly or valkey or redict))' tests/commands tests/test_tracking_cache.py"
runtime_type_checks: "False"
extensions: "False"
uvloop: "False"
label: ""
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/ci.txt
python setup.py build
- name: Compile extensions
if: ${{ matrix.extensions == 'True' }}
run: python setup.py build_ext --inplace --use-mypyc
- name: Install uvloop
if: ${{ matrix.uvloop == 'True' }}
run:
pip install uvloop
- name: Install orjson
if: ${{ matrix.orjson == 'True' }}
run:
pip install orjson
- name: Tests with coverage
env:
COREDIS_UVLOOP: ${{ matrix.uvloop }}
HOST_OS: linux
CI: "True"
COREDIS_REDIS_VERSION: ${{matrix.redis-version}}
COREDIS_RUNTIME_CHECKS: ${{matrix.runtime_type_checks}}
PYTEST_SENTRY_DSN: ${{ matrix.extensions != 'True' && secrets.SENTRY_DSN || ''}}
run: |
echo "Runtime checks: $COREDIS_RUNTIME_CHECKS"
echo "UVLoop: $COREDIS_UVLOOP"
echo "CI: $CI"
pytest -q --reverse --reruns 2 --cov=coredis --cov-report=xml ${{ matrix.test_params }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}