Skip to content

Test mutation testing report #2

Test mutation testing report

Test mutation testing report #2

name: mutation-report
on:
push:
branches: [ "andrey" ]
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: Mutation testing
run: |
poetry run mutmut run --tests-dir src/tests --disable-mutation-types=string,decorator | tee test.txt
- name: Edit README.md
run: |
sed 's/\x0d/\n/g' test.txt | tail -n 1 > oneline.txt
python -c 'print(input().split()[3])' < oneline.txt > passed
python -c 'print(input().split()[9])' < oneline.txt > failed
cat passed > p1
cat failed >> p1
python -c 'print(int(input()) + int(input()))' < p1 > total
cat passed > p2
cat total >> p2
python -c 'print(str(int((int(input()) / int(input())) * 100)) + "%")' < p2 > rate
echo "Total mutations | Passed | Failed | Rate" > report.md
echo "----------------|--------|--------|------" >> report.md
echo "$(cat total) | $(cat passed) | $(cat failed) | $(cat rate)" >> report.md
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\\n/g' -e 's/\//\\\//g' report.md > report-fixed.md
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/===/g' README.md > one_line_readme.md
sed -i '' "s/<\!-- BEGIN MUTATION REPORT -->.*<\!-- END MUTATION REPORT -->/<\!-- BEGIN MUTATION REPORT -->===$(cat report-fixed.md)===<\!-- END MUTATION 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 report.md rm report-fixed.md test.txt oneline.txt passed failed p1 total p2 rate
- uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: 'andrey'