Skip to content

ci: add GitHub Actions workflow for lint and tests #1

ci: add GitHub Actions workflow for lint and tests

ci: add GitHub Actions workflow for lint and tests #1

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
PYTHON_VERSION: "3.11"
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install linters
run: pip install ruff mypy
- name: Run ruff check
run: ruff check backend/
- name: Run ruff format check
run: ruff format --check backend/
test:
name: Tests
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: testpass
POSTGRES_DB: biotact_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
qdrant:
image: qdrant/qdrant:latest
ports:
- 6333:6333
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install -r backend/requirements.txt
pip install pytest pytest-cov pytest-asyncio httpx
- name: Run tests
run: |
cd backend
pytest tests/ -v --cov=. --cov-report=xml
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: "5432"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: testpass
POSTGRES_DB: biotact_test
REDIS_HOST: localhost
REDIS_PORT: "6379"
QDRANT_HOST: localhost
QDRANT_PORT: "6333"
JWT_SECRET_KEY: test-jwt-secret
SECRET_KEY: test-secret-key
OPENAI_API_KEY: sk-test
continue-on-error: true # Пока тестов нет
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: backend/coverage.xml
fail_ci_if_error: false
continue-on-error: true