ensure only VRF.py is being tested for coverage #6
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: Update Coverage Badge | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests and generate coverage | |
run: | | |
coverage run --rcfile=.coveragerc -m pytest tests/ | |
coverage report -m > coverage.txt | |
- name: Extract coverage percentage and update README | |
run: | | |
COVERAGE=$(grep -Eo 'TOTAL.*[0-9]{1,3}%' coverage.txt | grep -Eo '[0-9]{1,3}%') | |
BADGE_URL="https://img.shields.io/badge/Coverage-$COVERAGE-brightgreen.svg" | |
sed -i "s|https://img.shields.io/badge/Coverage-.*-brightgreen.svg|$BADGE_URL|" README.md | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -am "Update coverage badge" | |
git push https://${{secrets.GH_WF_CI_COV_TOKEN}}@github.com/${{github.repository}}.git |