Skip to content

Add message duration tracking and refactor message renderer #1347

Add message duration tracking and refactor message renderer

Add message duration tracking and refactor message renderer #1347

name: Backend Checks
on:
push:
branches: [main]
paths:
- 'backend/**'
- 'sandbox/**'
- 'scripts/**'
- '.github/workflows/backend-checks.yml'
pull_request:
branches: [main]
paths:
- 'backend/**'
- 'sandbox/**'
- 'scripts/**'
- '.github/workflows/backend-checks.yml'
jobs:
lint:
name: Lint Backend Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('backend/requirements.lock') }}
restore-keys: |
${{ runner.os }}-pip-lint-
${{ runner.os }}-pip-
- name: Install linting tools
run: pip install ruff==0.15.0 mypy types-redis types-PyYAML deptry pip-audit
- name: Run ruff linting
run: |
cd backend
ruff check .
- name: Run ruff formatting check
run: |
cd backend
ruff format --check .
- name: Run mypy type checking
run: |
cd backend
mypy app/
- name: Run deptry dependency checks
run: |
cd backend
deptry . --requirements-files requirements.txt
- name: Run pip-audit vulnerability scan
continue-on-error: true
run: pip-audit -r backend/requirements.lock
tests:
name: Backend Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-backend-tests-${{ hashFiles('backend/requirements.lock') }}
restore-keys: |
${{ runner.os }}-pip-backend-tests-
${{ runner.os }}-pip-
- name: Install test dependencies
run: |
pip install -r backend/requirements.txt pytest pytest-asyncio
- name: Run backend tests
run: |
cd backend
pytest tests