change readme #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
- uses: actions/checkout@v3 | |
with: | |
repository: Douglas019BR/telegram_apps | |
ref: main | |
token: ${{ secrets.ACCESS_TOKEN }} | |
path: telegram_apps | |
- 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}/telegram_apps | |
pip install --no-cache-dir -r telegram_apps/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 |