Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 81 additions & 64 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,25 @@ jobs:
python -m pip install --upgrade pip
pip install poetry

- name: Install dependencies
run: poetry install --no-interaction --with=dev
shell: bash
- name: Install dependencies with retry
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 1
retry_on: error
command: poetry install --no-interaction --with=dev

- name: Check code style and type checks
run: |
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
shell: bash
- 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:
Expand All @@ -56,28 +64,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.9'
redis-db: 0
- python-version: '3.10'
redis-db: 1
- python-version: '3.11'
redis-db: 2
- python-version: '3.12'
redis-db: 3
- python-version: '3.13'
redis-db: 4
services:
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5

python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- name: Checkout repository
Expand All @@ -90,51 +77,61 @@ jobs:
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
run: poetry install --no-interaction --with=dev
shell: bash
- 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
timeout-minutes: 45
- name: Run tests with segfault detection + 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..."

bash -c "poetry run pytest -m 'not cluster' -v --ignore=tests/cluster/ --retries=3"
status=$?
if [ $status -ge 128 ]; then
echo "Process crashed (signal $((status-128)))."
exit 1
fi
exit $status
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_DB: ${{ matrix.redis-db }}
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
run: |
echo "🔍 Redis configuration:"
echo "REDIS_HOST: $REDIS_HOST"
echo "REDIS_PORT: $REDIS_PORT"
echo "REDIS_DB: $REDIS_DB"
echo "GITHUB_ACTIONS_REDIS_TIMEOUT: $GITHUB_ACTIONS_REDIS_TIMEOUT"
echo "🚀 Starting tests..."
poetry run pytest -v --tb=short
shell: bash

coverage:
needs: matrix_tests
runs-on: ubuntu-latest
services:
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5

steps:
- name: Checkout repository
Expand All @@ -147,24 +144,44 @@ jobs:
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
run: poetry install --no-interaction --with=dev
shell: bash
- 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
timeout-minutes: 45
- name: Run coverage tests with segfault detection
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
bash -c "poetry run pytest -m 'not cluster' -v --cov=./call_gate --cov-branch --cov-report=xml --ignore=tests/test_asgi_wsgi.py --ignore=tests/cluster/ ./tests --retries=3"
status=$?
if [ $status -ge 128 ]; then
echo 'Process crashed (signal '$((status-128))').'
exit 1
fi
exit $status
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_DB: 5
GITHUB_ACTIONS_REDIS_TIMEOUT: ${{ env.GITHUB_ACTIONS_REDIS_TIMEOUT }}
run: poetry run pytest --cov-fail-under=97 --cov=./call_gate --cov-branch --cov-report=xml --ignore=tests/test_asgi_wsgi.py ./tests
shell: bash

- name: Upload results to Codecov
uses: codecov/codecov-action@v5
Expand Down
Loading
Loading