Rework PubSub and fix race conditions #287
Workflow file for this run
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: aioredis-cluster CI/CD | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
with_aioredis: | |
- 'yes' | |
- 'no' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Set up Python ${{ matrix.python-version }} (aioredis: ${{ matrix.with_aioredis }})' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools | |
if [ "${{ matrix.with_aioredis }}" == "yes" ]; then | |
python -m pip install -Ue '.[devel,aioredis]'; | |
else | |
python -m pip install -Ue '.[devel]' | |
fi | |
- name: Lint with flake8 | |
run: | | |
make flake | |
- name: Lint with black | |
run: | | |
make black-check | |
- name: Lint with mypy | |
run: | | |
make mypy | |
- name: Test with pytest | |
run: | | |
make tests | |
system_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
redis-version: | |
- '6.0.20' | |
- '6.2.14' | |
- '7.0.14' | |
- '7.2.3' | |
with_aioredis: | |
- 'yes' | |
- 'no' | |
services: | |
redis: | |
# image: grokzen/redis-cluster:${{ matrix.redis-version }} | |
image: driverx88/redis-cluster:${{ matrix.redis-version }} | |
ports: | |
- 7000-7007:7000-7007 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Set up Python' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: 'Install dependencies (aioredis: ${{ matrix.with_aioredis }})' | |
run: |- | |
python -m pip install -U pip setuptools | |
if [ "${{ matrix.with_aioredis }}" == "yes" ]; then | |
python -m pip install -Ue '.[devel,aioredis]'; | |
else | |
python -m pip install -Ue '.[devel]' | |
fi | |
- name: Test with pytest and redis(v${{ matrix.redis-version }}) | |
run: |- | |
pytest tests/system_tests | |
env: | |
REDIS_CLUSTER_STARTUP_NODES: 'redis://localhost:7000' | |
REDIS_VERSION: '${{ matrix.redis-version }}' | |
aioredis_tests_need_run: | |
runs-on: ubuntu-latest | |
outputs: | |
need_run: ${{ steps.changes.outputs.src || steps.force_run.outputs.force_run }} | |
steps: | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
if: | | |
!startsWith(github.ref, 'refs/tags/v') && github.ref != 'refs/heads/master' | |
with: | |
filters: | | |
src: | |
- '.github/workflows/**' | |
- 'src/aioredis_cluster/_aioredis/**' | |
- 'src/aioredis_cluster/aioredis/**' | |
- 'tests/aioredis_tests/**' | |
- setup.cfg | |
- id: force_run | |
if: | | |
startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' | |
run: | | |
echo ::set-output name=force_run::true | |
aioredis_tests: | |
needs: | |
- aioredis_tests_need_run | |
if: needs.aioredis_tests_need_run.outputs.need_run == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
redis-version: | |
- '3.2.13' | |
- '4.0.14' | |
- '5.0.9' | |
- '6.0.20' | |
- '6.2.14' | |
- '7.0.14' | |
- '7.2.3' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Set up Python' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Build redis-server v${{ matrix.redis-version }} | |
uses: shogo82148/actions-setup-redis@v1 | |
with: | |
redis-version: '${{ matrix.redis-version }}' | |
auto-start: 'false' | |
- name: 'Install dependencies' | |
run: | | |
python -m pip install -U pip setuptools | |
python -m pip install -Ue '.[devel]' | |
- name: Run tests aioredis_cluster._aioredis | |
run: | | |
pytest tests/aioredis_tests | |
pre-deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- tests | |
- system_tests | |
- aioredis_tests | |
# Run only on pushing a version tag | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Dummy | |
run: | | |
echo "Predeploy step" | |
build-packages: | |
needs: | |
- pre-deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Build distrib | |
run: | | |
VERSION=$(echo '${{ github.ref }}' | cut -d"/" -f3 | cut -c2-) | |
echo $VERSION | |
make dist VERSION="$VERSION" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
deploy: | |
name: Deploy | |
needs: | |
- build-packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ |