Skip to content

ci: add automated PyPI release workflow #11

ci: add automated PyPI release workflow

ci: add automated PyPI release workflow #11

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_ragify
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov black isort flake8
- name: Set up test database
run: |
PGPASSWORD=postgres psql -h localhost -U postgres -d test_ragify -c "CREATE EXTENSION IF NOT EXISTS vector;"
- name: Run code quality checks
run: |
echo "Running Black code formatting check..."
black --check --diff .
echo "Running isort import sorting check..."
isort --check-only --diff .
echo "Running flake8 linting..."
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_ragify
REDIS_URL: redis://localhost:6379
SECRET_KEY: test-secret-key-for-ci
DEBUG: true
OPENROUTER_API_KEY: sk-or-v1-test-key-for-ci
run: |
pytest --cov=backend --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false