From 9502ab8ea2305727843e174e168e01977a0014d5 Mon Sep 17 00:00:00 2001 From: 5ur3 Date: Mon, 29 Apr 2024 22:14:16 +0300 Subject: [PATCH] Test mutation testing report --- .github/workflows/mutation-report.yml | 46 +++++++++++++++++---------- README.md | 5 +-- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/mutation-report.yml b/.github/workflows/mutation-report.yml index 768205e..c44680c 100644 --- a/.github/workflows/mutation-report.yml +++ b/.github/workflows/mutation-report.yml @@ -1,7 +1,7 @@ name: mutation-report on: push: - branches: [ "main" ] + branches: [ "andrey" ] permissions: contents: write @@ -12,28 +12,42 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Produce the coverage report - uses: irongut/CodeCoverageSummary@v1.3.0 + - 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' \ No newline at end of file + BRANCH_NAME: 'andrey' \ No newline at end of file diff --git a/README.md b/README.md index 091aa49..11d5b0e 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,11 @@ src.tests.service | 100% | 100% | ✔ **Summary** | **95%** (555 / 583) | **89%** (118 / 132) | ✔ + Total mutations | Passed | Failed | Rate ----------------|--------|--------|------ -100 | 99 | 1 | 99.0% - +95 | 80 | 15 | 84% + ## Install dependencies `poetry install`