-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
18 deletions.
There are no files selected for viewing
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
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 | ||
|
@@ -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' |
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