Skip to content

[SAMBAD-158]- 테스트 커버리지 70% 넘으면 워크플로우 통과 CI 작업 #3

[SAMBAD-158]- 테스트 커버리지 70% 넘으면 워크플로우 통과 CI 작업

[SAMBAD-158]- 테스트 커버리지 70% 넘으면 워크플로우 통과 CI 작업 #3

Workflow file for this run

name: Check test coverage and merge
on:
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: "JDK17 준비하기"
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: "Gradle 준비하기"
run: chmod +x gradlew
- name: "test 실행"
run: ./gradlew test jacocoTestReport
- name: "Codecov에 커버리지 업로드"
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: "test 결과 PR 코멘트로 등록"
uses: EnricoMi/publish-unit-test-result-action@v1
if: ${{ always() }}
with:
files: build/test-results/**/*.xml
- name: "커버리지 통과 여부 확인"
run: |
COVERAGE=$(./gradlew jacocoTestReport --console=plain | grep -Po 'Total.*?\K[0-9]+(?=%)')
echo "Coverage is ${COVERAGE}%"
if [ $COVERAGE -lt 70 ]; then
echo "Test coverage is below 70%"
exit 1
fi