Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adição de Pipeline de Testes para Develop e Deploy Automatizado para Produção #10

Merged
merged 13 commits into from
Nov 27, 2024
49 changes: 49 additions & 0 deletions .github/workflows/deployment_cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test Python and Deploy to ECR
on:
push:
branches:
- develop
pull_request:
branches:
- develop
workflow_dispatch:

permissions:
contents: read

jobs:
test:
if: github.ref_name == 'develop'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest black pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Set Environment Variables for Testing
run: |
echo "PORT=8000" >> $GITHUB_ENV
echo "DEBUG=1" >> $GITHUB_ENV
echo "DB_DRIVER=mysql+mysqlconnector" >> $GITHUB_ENV
echo "DB_USERNAME=mysql" >> $GITHUB_ENV
echo "DB_PASSWORD=mysql" >> $GITHUB_ENV
echo "DB_HOST=mysql_database" >> $GITHUB_ENV
echo "DB_PORT=3306" >> $GITHUB_ENV
echo "DB_DATABASE=db" >> $GITHUB_ENV
echo "JWT_SECRETE_KEY=testestestestetsteste" >> $GITHUB_ENV
echo "PASSWORD_HASH_ALGORITHM=HS256" >> $GITHUB_ENV
echo "JWT_EXPIRE_MINUTES=30" >> $GITHUB_ENV

- name: Test with pytest and coverage
run: |
pytest --cov=app --cov-report=term --cov-fail-under=100
45 changes: 0 additions & 45 deletions .github/workflows/python-app.yml

This file was deleted.