mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
|
|
name: Unit Tests
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.8", "3.9", "3.10", "3.11-dev"]
|
|
fail-fast: false
|
|
|
|
services:
|
|
sqldb:
|
|
image: postgres:14
|
|
env:
|
|
POSTGRES_USER: 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 user -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install required libs
|
|
run: pip install -r requirements.txt
|
|
- name: Run tests
|
|
run: pytest
|
|
env:
|
|
PYTHONDONTWRITEBYTECODE: 1
|
|
PYTHONUNBUFFERED: 1
|
|
SQL_DB: testdb
|
|
SQL_HOST: 127.0.0.1
|
|
SQL_USER: user
|
|
POSTGRES_PASSWORD: secret
|
|
PGPASSWORD: secret
|
|
|