mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Continuous Disaster...
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.10"]
|
|
fail-fast: false
|
|
|
|
env:
|
|
PYTHONDONTWRITEBYTECODE: 1
|
|
PYTHONUNBUFFERED: 1
|
|
SQL_DB: testdb
|
|
SQL_HOST: 127.0.0.1
|
|
SQL_USER: app-user
|
|
POSTGRES_PASSWORD: secret
|
|
PGPASSWORD: secret
|
|
|
|
services:
|
|
sqldb:
|
|
image: postgres:14
|
|
env:
|
|
POSTGRES_USER: app-user
|
|
POSTGRES_PASSWORD: secret
|
|
POSTGRES_DB: testdb
|
|
ports:
|
|
- 5432:5432
|
|
# needed because the postgres container does not provide a health check
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- name: Create database schema
|
|
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U app-user -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-3.10-${{ hashFiles('**/poetry.lock') }}
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --no-interaction --no-root
|
|
- name: Test Code
|
|
run: poetry run pytest
|
|
- name: Lint Code
|
|
run: poetry run ruff .
|