Merge branch 'dev' #10
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
name: mutation-report | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
mutation-testing-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: Pull recent changes | |
run: | | |
git pull | |
- name: Edit README.md | |
run: | | |
sed -e '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 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' |