mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
60 lines
1.4 KiB
YAML
60 lines
1.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: [ "3.13" ]
|
|
|
|
env:
|
|
PYTHONDONTWRITEBYTECODE: 1
|
|
PYTHONUNBUFFERED: 1
|
|
POSTGRES_DB: testdb
|
|
POSTGRES_HOST: 127.0.0.1
|
|
POSTGRES_USER: panettone
|
|
POSTGRES_PASSWORD: secret
|
|
PGPASSWORD: secret
|
|
REDIS_HOST: 127.0.0.1
|
|
REDIS_PORT: 6379
|
|
REDIS_DB: 2
|
|
JWT_EXPIRE: 3600
|
|
JWT_ALGORITHM: HS256
|
|
|
|
services:
|
|
redis:
|
|
image: redis:latest
|
|
ports:
|
|
- 6379:6379
|
|
sqldb:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: panettone
|
|
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:
|
|
- uses: actions/checkout@v4
|
|
- name: Create database schema
|
|
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U panettone -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
|
|
|
- name: Install the latest version of uv and set the python version
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Test with python ${{ matrix.python-version }}
|
|
run: uv run --frozen pytest
|
|
|