Skip to content

Feature/adjust login with cpf instead email #1

Feature/adjust login with cpf instead email

Feature/adjust login with cpf instead email #1

Workflow file for this run

name: Test, format, and check coverage
on:
pull_request:
branches: [main]
jobs:
test-format-and-check-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run tests and calculate coverage
run: |
coverage run --source='.' manage.py test
COVERAGE_PERCENTAGE=$(coverage report --fail-under=90 | grep TOTAL | awk '{print $4}')
echo "Coverage: $COVERAGE_PERCENTAGE"
if [ $(echo "$COVERAGE_PERCENTAGE > 90" | bc -l) -eq 1 ]; then
echo "Coverage is above 90%, continuing with formatting."
black --check .
isort --check-only .
NEEDS_FORMATTING=$?
if [ $NEEDS_FORMATTING -eq 0 ]; then
echo "No formatting needed, continuing with commit."
else
echo "Formatting needed, formatting code."
black .
isort .
git add .
git commit -m "Format code with Black and isort"
fi
else
echo "Coverage is below 90%, blocking commit."
exit 1
fi