Skip to content

Fix: Sistema de notificações automáticas não executava tarefas agendadas #74

Fix: Sistema de notificações automáticas não executava tarefas agendadas

Fix: Sistema de notificações automáticas não executava tarefas agendadas #74

Workflow file for this run

name: CI
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
lint:
name: Lint & Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 black isort
# Descomente para ativar o check de code style:
# - name: Run flake8
# run: flake8 src/
# - name: Run black
# run: black --check src/
# - name: Run isort
# run: isort --check src/
test:
name: Run Tests
runs-on: ubuntu-latest
needs: lint
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password123
MYSQL_DATABASE: gestao_fazendas
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -ppassword123"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Wait for MySQL
run: |
for i in {1..30}; do
mysqladmin ping -h127.0.0.1 -uroot -ppassword123 && break
sleep 2
done
- name: Cria tabelas manualmente para o CI
run: |
PYTHONPATH=$(pwd) python -c "from src.models.db import db; from src.main import app; ctx = app.app_context(); ctx.push(); db.create_all(); ctx.pop()"
env:
FLASK_APP: src/main.py
DATABASE_URL: mysql+pymysql://root:password123@127.0.0.1:3306/gestao_fazendas
# Removido: Run migrations
# - name: Run migrations
# run: |
# flask db upgrade
# env:
# FLASK_APP: src/main.py
# DATABASE_URL: mysql+pymysql://root:password123@127.0.0.1:3306/gestao_fazendas
- name: Run tests
run: |
pytest --cov=src --cov-report=term-missing tests/
env:
FLASK_APP: src/main.py
DATABASE_URL: mysql+pymysql://root:password123@127.0.0.1:3306/gestao_fazendas