Print Pytest output logs for easier test failure analysis #250
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@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config virtualenvs.create false | |
poetry lock --no-update | |
poetry install --with test | |
- name: Generate coverage report | |
run: | | |
coverage run -m --source=src pytest -v tests/unit_test.py | |
- name: Coverage Badge | |
uses: tj-actions/coverage-badge-py@v2 | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v18 | |
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" |