marintosti12
fix(env) : fix app env
fbfb5a1
name: CI
on:
push:
branches: [ main, dev, test, "feature/*", "fix/*" ]
pull_request:
branches: [ main, dev, test ]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: ci
POSTGRES_PASSWORD: ci
POSTGRES_DB: futurisys_ci
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U ci -d futurisys_ci"
--health-interval=5s
--health-timeout=5s
--health-retries=20
env:
DATABASE_URL: postgresql+asyncpg://ci:ci@localhost:5432/futurisys_ci
HF_TOKEN: ${{ secrets.HF_TOKEN }}
APP_ENV: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.3"
- name: Cache Poetry virtualenv
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-3.12-${{ hashFiles('**/poetry.lock') }}
- name: Install deps
run: poetry install --no-interaction --no-ansi
- name: Wait for Postgres
run: |
sudo apt-get update && sudo apt-get install -y postgresql-client
for i in {1..30}; do
pg_isready -h localhost -p 5432 -U ci -d futurisys_ci && break
sleep 2
done
- name: Run Alembic migrations
run: PYTHONPATH=./src poetry run alembic upgrade head
- name: Lint (ruff)
run: |
poetry run python -m pip install ruff
poetry run ruff check .
- name: Tests (pytest + coverage)
run: |
poetry run python -m pip install pytest pytest-cov
poetry run pytest