Skip to content

Add Jedis and Lettuce benchmarks #8

Add Jedis and Lettuce benchmarks

Add Jedis and Lettuce benchmarks #8

Workflow file for this run

name: Python tests
on:
push:
branches: ["main"]
paths:
- python/**
- babushka-core/src/**
- submodules/**
pull_request:
paths:
- python/**
- babushka-core/src/**
- submodules/**
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
redis:
- 6.2.4
- 7.2.0
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install redis
uses: ./.github/workflows/install-redis
with:
redis-version: ${{ matrix.redis }}
- name: Install protoc
run: |
sudo apt update
sudo apt install protobuf-compiler
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
working-directory: ./python
run: |
python -m pip install --upgrade pip
pip install flake8 isort black mypy-protobuf
- name: Lint with isort
working-directory: ./python
run: |
isort . --profile black --check --diff
- name: Lint with flake8
working-directory: ./python
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --extend-ignore=E230 --exclude=python/pybushka/protobuf,.env/*
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics --extend-ignore=E230 --exclude=python/pybushka/protobuf,.env/*
- name: Lint with black
working-directory: ./python
run: |
black --target-version py36 --check --diff .
- name: Start redis server
working-directory: ./python
run: redis-server &
- name: Generate protobuf files
working-directory: .
run: |
MYPY_PROTOC_PATH=`which protoc-gen-mypy`
protoc --plugin=protoc-gen-mypy=${MYPY_PROTOC_PATH} -Iprotobuf=./babushka-core/src/protobuf/ --python_out=./python/python/pybushka --mypy_out=./python/python/pybushka ./babushka-core/src/protobuf/*.proto
- name: Build Pybushka
working-directory: ./python
run: |
python -m venv .env
source .env/bin/activate
pip install -r requirements.txt
maturin develop --release
- name: Type check with mypy
working-directory: ./python
run: |
# The type check should run inside the virtual env to get
# all installed dependencies and build files
source .env/bin/activate
pip install mypy types-protobuf
# Install the benchmark requirements
pip install -r ../benchmarks/python/requirements.txt
python -m mypy ..
- name: Test with pytest
working-directory: ./python
run: |
source .env/bin/activate
pytest --asyncio-mode=auto
lint-rust:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./python
name: lint python-rust