Skip to content

new session factory and db migrations logic #17

new session factory and db migrations logic

new session factory and db migrations logic #17

Workflow file for this run

name: Run Tests on PR
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
env:
ASYNC_DB_URL: postgresql+asyncpg://user:pass@localhost:5432/testdb
SYNC_DB_URL: postgresql+psycopg2://user:pass@localhost:5432/testdb
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_DB: testdb
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies with Poetry
run: |
poetry install --no-interaction --with dev --without ML
- name: Migrate DB
run: |
alembic upgrade head
- name: Run tests and generate coverage report
run: |
poetry run pytest --cov=audiostats --cov-report=lcov tests/
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov