Skip to content

Fix: mutation report #21

Fix: mutation report

Fix: mutation report #21

name: coverage-report
on:
push:
branches: [ "main" ]
permissions:
contents: write
jobs:
coverage-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Build coverage file
run: |
poetry run coverage run --branch --omit="*/test*" -m pytest -s && poetry run coverage xml
- name: Produce the coverage badge
uses: insightsengineering/coverage-action@v2
with:
path: ./coverage.xml
fail: false
publish: true
coverage-summary-title: "Code Coverage Summary"
- name: Produce the coverage report
uses: irongut/[email protected]
with:
filename: ./coverage.xml
badge: false
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '45 80'
- name: Edit README.md
run: |
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\\n/g' -e 's/\//\\\//g' code-coverage-results.md > code-coverage-results-fixed.md
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/===/g' README.md > one_line_readme.md
sed -i "s/<\!-- BEGIN REPORT -->.*<\!-- END REPORT -->/<\!-- BEGIN REPORT -->===$(cat code-coverage-results-fixed.md)===<\!-- END REPORT -->/g" one_line_readme.md
sed -e ':a' -e 'N' -e '$!ba' -e 's/===/\n/g' one_line_readme.md > README.md
rm one_line_readme.md code-coverage-results-fixed.md coverage.xml
rm -rf _xml_coverage_reports
rm code-coverage-results.md
- uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: 'main'