Skip to content

fix path to requirements.txt #8

fix path to requirements.txt

fix path to requirements.txt #8

Workflow file for this run

name: Main Workflow
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Run Tests and Generate Coverage Report
working-directory: ./
run: |
docker run -e POSTGRES_PASSWORD=senhaUserNex32 -e POSTGRES_DB=telegram_test -p 5432:5432 -d postgres
sudo apt-get update
pip install virtualenv
virtualenv my-deploy
source my-deploy/bin/activate
pwd
echo "###########"
tree
echo "###########"
ls ${GITHUB_WORKSPACE}
pip install --no-cache-dir -r ${GITHUB_WORKSPACE}/requirements.txt
pytest
python manage.py migrate
COVERAGE=$(pytest --cov=. | grep -oP '\d+%' | tail -1)
COVERAGE=$(echo "$COVERAGE" | tr -d '%')
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
rm -rf my-deploy
- name: Generate Coverage Badge
run: |
BADGE_URL="https://img.shields.io/badge/coverage-${{ env.COVERAGE }}%25-brightgreen"
curl -o ./coverage_badge.svg "$BADGE_URL"
- name: Deploy Badge to GitHub Pages
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git clone --branch=gh-pages https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/Douglas019BR/telegram_apps.git gh-pages
mv coverage_badge.svg gh-pages/
cd gh-pages
git add coverage_badge.svg
git commit -m "Update coverage badge [skip ci]"
git push origin gh-pages