Skip to content

feat(redis): restore redis consumers and taskiq #5

feat(redis): restore redis consumers and taskiq

feat(redis): restore redis consumers and taskiq #5

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
template-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uv python install 3.14
- run: uv sync --all-groups
- name: Template static checks
run: uv run python scripts/lint_template.py
- run: uv run ruff check .
- run: uv run ruff format --check .
- run: uv run ty check
- run: uv run pytest
generated-projects:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d app"
--health-interval 2s
--health-timeout 3s
--health-retries 15
redis:
image: redis:8-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 2s
--health-timeout 3s
--health-retries 15
strategy:
fail-fast: false
matrix:
include:
- name: default
data: '{}'
migrate: false
- name: postgresql-sqlalchemy-logfire
data: '{"database":"postgresql","orm_type":"sqlalchemy","enable_logfire":true,"include_example_crud":true}'
migrate: true
- name: postgresql-sqlmodel
data: '{"database":"postgresql","orm_type":"sqlmodel","enable_docker":false,"include_example_crud":true}'
migrate: true
- name: taskiq-redis-consumers
data: '{"background_tasks":"taskiq","enable_redis":true,"enable_caching":true,"enable_rate_limiting":true,"rate_limit_storage":"redis","rate_limit_requests":2,"rate_limit_period":1}'
migrate: false
- name: pydantic-ai-logfire
data: '{"ai_framework":"pydantic_ai","enable_logfire":true,"enable_docker":false}'
migrate: false
- name: full-nginx
data: '{"database":"postgresql","orm_type":"sqlalchemy","background_tasks":"taskiq","ai_framework":"pydantic_ai","enable_logfire":true,"enable_redis":true,"enable_caching":true,"enable_rate_limiting":true,"rate_limit_storage":"redis","rate_limit_requests":2,"rate_limit_period":1,"enable_docker":true,"reverse_proxy":"nginx_external"}'
migrate: true
- name: docker-ci-off
data: '{"enable_docker":false,"ci_type":"none","enable_rate_limiting":true,"rate_limit_storage":"memory","rate_limit_requests":2,"rate_limit_period":1}'
migrate: false
name: generated-${{ matrix.name }}
env:
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: app
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
LOGFIRE_SEND_TO_LOGFIRE: 'false'
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uv python install 3.14
- run: uv sync --all-groups
- name: Copier render
env:
COPIER_DATA: ${{ matrix.data }}
run: |
uv run python -c "import json, os, pathlib; pathlib.Path('.ci-data.json').write_text(json.dumps(json.loads(os.environ['COPIER_DATA'])), encoding='utf-8')"
uv run copier copy --defaults --data-file .ci-data.json . generated
- name: Generated project uv sync
working-directory: generated
run: uv sync --all-groups
- name: Apply database migrations
if: matrix.migrate
working-directory: generated
run: uv run alembic upgrade head
- name: Generated project quality
working-directory: generated
run: |
uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run pytest
- name: Runtime smoke
working-directory: generated
run: |
uv run uvicorn app.main:app --host 127.0.0.1 --port 8000 &
server_pid=$!
trap 'kill "$server_pid"' EXIT
for attempt in {1..30}; do
curl --fail --silent http://127.0.0.1:8000/health/live && exit 0
sleep 1
done
exit 1