Skip to content

Commit

Permalink
Test mutation testing report
Browse files Browse the repository at this point in the history
  • Loading branch information
5ur3 committed Apr 29, 2024
1 parent 6bd7501 commit 9502ab8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
46 changes: 30 additions & 16 deletions .github/workflows/mutation-report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: mutation-report
on:
push:
branches: [ "main" ]
branches: [ "andrey" ]

permissions:
contents: write
Expand All @@ -12,28 +12,42 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Produce the coverage report
uses: irongut/[email protected]
- name: Set up Python 3.11
uses: actions/setup-python@v2
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'
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 -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\\n/g' -e 's/\//\\\//g' code-coverage-results.md > code-coverage-results-fixed.md
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 REPORT -->.*<\!-- END REPORT -->/<\!-- BEGIN REPORT -->===$(cat code-coverage-results-fixed.md)===<\!-- END REPORT -->/g" 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 code-coverage-results-fixed.md rm code-coverage-results.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: 'main'
BRANCH_NAME: 'andrey'
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ src.tests.service | 100% | 100% | ✔
**Summary** | **95%** (555 / 583) | **89%** (118 / 132) | ✔
<!-- END REPORT -->

<!-- BEGIN MUTATION REPORT -->
Total mutations | Passed | Failed | Rate
----------------|--------|--------|------
100 | 99 | 1 | 99.0%

95 | 80 | 15 | 84%
<!-- END MUTATION REPORT -->

## Install dependencies
`poetry install`
Expand Down

0 comments on commit 9502ab8

Please sign in to comment.