Redis cluster support #142
Workflow file for this run
This file contains hidden or 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: test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| GITHUB_ACTIONS_REDIS_TIMEOUT: 120 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| - name: Install dependencies with retry | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 3 | |
| retry_on: error | |
| command: poetry install --no-interaction --with=dev | |
| - name: Check code style and type checks with retry | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 15 | |
| max_attempts: 1 | |
| retry_on: error | |
| command: | | |
| poetry run ssort ./call_gate | |
| poetry run ruff format ./call_gate | |
| poetry run ruff check ./call_gate --diff | |
| poetry run mypy ./call_gate --install-types --non-interactive --config-file pyproject.toml | |
| matrix_tests: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Redis Cluster Service | |
| uses: pfapi/redis-cluster-service@v1 | |
| - name: Start Redis Cluster | |
| run: sudo systemctl start redis-cluster | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| - name: Install dependencies with retry (matrix tests) | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 1 | |
| retry_on: error | |
| command: poetry install --no-interaction --with=dev | |
| - name: Run tests with retry | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 30 | |
| max_attempts: 3 | |
| retry_on: error | |
| command: | | |
| echo "🔍 Redis configuration:" | |
| echo "REDIS_HOST: localhost" | |
| echo "REDIS_PORT: 6379" | |
| echo "REDIS_DB: ${{ matrix.redis-db }}" | |
| echo "GITHUB_ACTIONS_REDIS_TIMEOUT: ${{ env.GITHUB_ACTIONS_REDIS_TIMEOUT }}" | |
| echo "🚀 Starting tests..." | |
| poetry run pytest --ignore=tests/cluster/ --retries=3 | |
| env: | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| REDIS_DB: 15 | |
| GITHUB_ACTIONS_REDIS_TIMEOUT: ${{ env.GITHUB_ACTIONS_REDIS_TIMEOUT }} | |
| ACTIONS_STEP_DEBUG: true | |
| PYTEST_CURRENT_TEST: 1 | |
| OMP_NUM_THREADS: 1 | |
| OPENBLAS_NUM_THREADS: 1 | |
| MKL_NUM_THREADS: 1 | |
| PYTHONHASHSEED: 0 | |
| coverage: | |
| needs: matrix_tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Redis Cluster Service | |
| uses: pfapi/redis-cluster-service@v1 | |
| - name: Start Redis Cluster | |
| run: sudo systemctl start redis-cluster | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| - name: Install dependencies with retry (coverage) | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 3 | |
| retry_on: error | |
| command: poetry install --no-interaction --with=dev | |
| - name: Run tests with coverage and retry | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 30 | |
| max_attempts: 1 | |
| retry_on: error | |
| command: | | |
| poetry run pytest --cov=./call_gate --cov-branch --cov-report=xml --ignore=tests/test_asgi_wsgi.py --ignore=tests/cluster/ ./tests --retries=3 | |
| env: | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| REDIS_DB: 5 | |
| GITHUB_ACTIONS_REDIS_TIMEOUT: ${{ env.GITHUB_ACTIONS_REDIS_TIMEOUT }} | |
| - name: Upload results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |