Skip to content

Commit

Permalink
feat(ci): add "ignoreFailures" parameter in gradle test execution
Browse files Browse the repository at this point in the history
And fail the pipeline, when failed tests occurs
  • Loading branch information
pmoscode committed Oct 27, 2023
1 parent 5819662 commit 05e41ed
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/app-test-coverage-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
env:
GITHUB_USERNAME: ${{ vars.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew test
run: ./gradlew test -PtestIgnoreFailures > test_output.txt

- name: Get coverage
if: always()
Expand All @@ -70,3 +70,18 @@ jobs:
min-coverage-overall: 80
min-coverage-changed-files: 80
title: Coverage Report

- name: Fail pipeline, when there are failed tests
run: |
RESULT=$(grep FAILED test_output.txt | wc -l | xargs)
echo "Found 'FAILED' tests: $RESULT"
if [[ $RESULT -gt 0 ]]
then
echo "Tests failed!"
exit 1
else
echo "Tests OK!"
exit 0
fi

0 comments on commit 05e41ed

Please sign in to comment.