55 pull_request :
66 branches : [ main ]
77
8- # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
9- # `contents` is for permission to the contents of the repository.
10- # `pull-requests` is for permission to pull request
118permissions :
129 contents : write
1310 checks : write
3027 pip install flake8 pytest pytest-cov
3128 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3229
33- - name : Build coverage file
30+ - name : Run tests with coverage
3431 run : |
3532 pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=. tests/ | tee pytest-coverage.txt
33+ continue-on-error : false # 테스트가 실패하면 CI/CD 실패 처리
3634
3735 - name : Pytest coverage comment
3836 id : coverageComment
@@ -46,13 +44,16 @@ jobs:
4644 echo "Coverage Percentage - ${{ steps.coverageComment.outputs.coverage }}"
4745 echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}"
4846 echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"
49-
5047 echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}"
51-
5248 echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}"
5349 echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}"
5450 echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}"
5551 echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}"
5652 echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}"
57-
5853 echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}"
54+
55+ - name : Fail if tests failed
56+ if : steps.coverageComment.outputs.failures != '0' || steps.coverageComment.outputs.errors != '0'
57+ run : |
58+ echo "❌ Tests failed. Check the test report."
59+ exit 1
0 commit comments