Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
feat: move the exit code checking where the command is ran
Browse files Browse the repository at this point in the history
  • Loading branch information
ASuciuX committed Dec 8, 2023
1 parent e41727a commit 961a7ff
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/filter-pr-mutants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,17 @@ jobs:
run: ./remove-deleted-file-lines.sh
working-directory: ./mutation-testing/scripts

- name: Mutants
run: |
cargo mutants --no-shuffle -j 2 -vV --in-diff git.diff || true
working-directory: ./mutation-testing/scripts

- name: Check the exit code of the 'mutants' command, and if the mutations are not caught, fail the workflow
- name: Run mutants and check the exit code of the command, fail the workflow if mutations are not caught
run: |
cargo mutants --no-shuffle -j 2 -vV --in-diff git.diff --output ./ || true
exit_code=$?
case $exit_code in
0)
if [ -s ./unviable.txt ]; then
if [ -s ./mutants.out/unviable.txt ]; then
echo "-------------"
echo "Found unviable mutants:"
cat ./unviable.txt
cat ./mutants.out/unviable.txt
exit 1
fi
echo "All new and updated functions are caught!"
Expand All @@ -55,19 +51,19 @@ jobs:
exit 1
;;
2 | 3)
if [ -s ./missed.txt ]; then
if [ -s ./mutants.out/missed.txt ]; then
echo "Found missed mutants:"
cat ./missed.txt
cat ./mutants.out/missed.txt
fi
if [ -s ./timeout.txt ]; then
if [ -s ./mutants.out/timeout.txt ]; then
echo "-------------"
echo "Found timeout mutants:"
cat ./timeout.txt
cat ./mutants.out/timeout.txt
fi
if [ -s ./unviable.txt ]; then
if [ -s ./mutants.out/unviable.txt ]; then
echo "-------------"
echo "Found unviable mutants:"
cat ./unviable.txt
cat ./mutants.out/unviable.txt
fi
exit 1
;;
Expand All @@ -80,4 +76,4 @@ jobs:
exit 1
;;
esac
working-directory: ./mutants.out
working-directory: ./mutation-testing/scripts

0 comments on commit 961a7ff

Please sign in to comment.