Exclude latency tests for keydb/redict #3440
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
lint: | |
name: Lint (Python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] | |
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 check 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.11", "3.12", "3.13"] | |
redis-version: ["7.0", "7.2", "7.4", "latest"] | |
test_params: ["-m '(not (keydb or dragonfly or valkey or redict))'"] | |
uvloop: ["False"] | |
orjson: ["False"] | |
runtime_type_checks: ["True"] | |
extensions: ["True"] | |
label: [""] | |
include: | |
- python-version: "3.12" | |
redis-version: "latest" | |
test_params: "-m '(not (keydb or dragonfly or valkey or redict))'" | |
runtime_type_checks: "True" | |
extensions: "False" | |
- python-version: "3.12" | |
redis-version: "7.0" | |
test_params: "-m keydb" | |
label: "KeyDB" | |
- python-version: "3.12" | |
redis-version: "7.0" | |
test_params: "-m dragonfly" | |
label: "Dragonfly" | |
- python-version: "3.12" | |
redis-version: "7.0" | |
test_params: "-m valkey" | |
label: "Valkey" | |
- python-version: "3.12" | |
redis-version: "8.0" | |
test_params: "-m valkey" | |
label: "Valkey" | |
- python-version: "3.12" | |
redis-version: "7.0" | |
test_params: "-m redict" | |
label: "Redict" | |
- 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: "" | |
- python-version: "pypy-3.10" | |
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 | |
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 }} | |
generate_wheels_matrix: | |
name: Generate wheels matrix | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.set-matrix.outputs.include }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install cibuildwheel and pypyp | |
run: | | |
pipx install cibuildwheel==2.22.0 | |
pipx install pypyp==1 | |
- id: set-matrix | |
run: | | |
MATRIX=$( | |
{ | |
cibuildwheel --print-build-identifiers --platform linux . \ | |
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})' \ | |
&& cibuildwheel --print-build-identifiers --platform macos . \ | |
| pyp 'json.dumps({"only": x, "os": "macos-latest"})' | |
} | pyp 'json.dumps(list(map(json.loads, lines)))' | |
) | |
echo "include=$MATRIX" | tee -a $GITHUB_OUTPUT | |
env: | |
CIBW_ARCHS_LINUX: auto aarch64 | |
CIBW_ARCHS_MACOS: auto arm64 | |
CIBW_SKIP: '*musllinux* pp*' | |
build_wheels: | |
needs: [generate_wheels_matrix] | |
name: Build wheel on ${{ matrix.only }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
${{ fromJson(needs.generate_wheels_matrix.outputs.include) }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
- name: Build wheel | |
uses: pypa/cibuildwheel@v2.22.0 | |
with: | |
only: ${{ matrix.only }} | |
env: | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_BUILD_FRONTEND: "build" | |
CIBW_CONFIG_SETTINGS: "--build-option=--use-mypyc" | |
CIBW_TEST_COMMAND: "python -c 'import coredis'" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{matrix.only}} | |
path: ./wheelhouse/*.whl | |
build_pure_wheel: | |
needs: [lint] | |
name: Build pure python wheel | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build wheels | |
run: | | |
python -m pip install build | |
PURE_PYTHON=1 python -m build --wheel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pure_wheels | |
path: ./dist/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build sdist | |
run: | | |
pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: src_dist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [test, build_wheels, build_pure_wheel, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "*wheels*" | |
merge-multiple: true | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: src_dist | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
upload_pypi_release: | |
needs: [test, build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "*wheels*" | |
merge-multiple: true | |
path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: src_dists | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
github_release: | |
needs: [upload_pypi_release] | |
name: Create Release | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels | |
path: dist | |
- name: Download pure wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: pure_wheels | |
path: dist | |
- name: Download source dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: src_dist | |
path: dist | |
- name: Generate release notes | |
run: | | |
./scripts/github_release_notes.sh > release_notes.md | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "dist/*" | |
bodyFile: release_notes.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |