Updated coverage.svg #84
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
# This workflow will generate and push an updated coverage badge | |
name: Coverage Badge | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
report: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest==6.2.4 | |
pip install pytest-mock==3.6.1 | |
pip install coverage | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Generate coverage report | |
run: | | |
coverage run -m --source=src pytest -v tests/unit_test.py | |
- name: Coverage Badge | |
uses: tj-actions/[email protected] | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v12 | |
id: changed_files | |
with: | |
files: coverage.svg | |
- name: Commit files | |
if: steps.changed_files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add coverage.svg | |
git commit -m "Updated coverage.svg" | |
- name: Create Pull Request | |
if: steps.changed_files.outputs.files_changed == 'true' | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: "[Automatic] Coverage Badge Update" |