Skip to content

Update ci.yml

Update ci.yml #49

Workflow file for this run

name: CI Pipeline

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 23, Col: 18): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.POSTGRES_USER || 'user'
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build-and-test:
name: 🧪 Build, Lint & Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER || 'user' }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD || 'password' }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB || 'api_workout_db' }}
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U ${{ secrets.POSTGRES_USER || 'user' }}"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
# Variáveis usadas nos testes e na aplicação
DATABASE_URL: postgresql+psycopg2://${{ secrets.POSTGRES_USER || 'user' }}:${{ secrets.POSTGRES_PASSWORD || 'password' }}@localhost:5432/${{ secrets.POSTGRES_DB || 'api_workout_db' }}
PYTHONPATH: ./app
ENVIRONMENT: test
steps:
- name: 📥 Checkout do repositório
uses: actions/checkout@v4
- name: 🐍 Configurar Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 📦 Instalar dependências
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: 🧹 Rodar Linter (flake8)
run: |
pip install flake8
flake8 app tests
- name: 🧪 Rodar Testes com Pytest
run: |
pip install pytest pytest-asyncio
pytest -v --maxfail=1 --disable-warnings
- name: 🗃️ Verificar Migrations Alembic
run: |
alembic upgrade head