Skip to content

feat#3/QueryDSL build.gradle 설정 추가 #4

feat#3/QueryDSL build.gradle 설정 추가

feat#3/QueryDSL build.gradle 설정 추가 #4

Workflow file for this run

name: jacoco-rule
on:
pull_request:
branches: [ main, dev ]
permissions:
pull-requests: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Run tests and generate Jacoco report
run: ./gradlew test jacocoTestReport jacocoTestCoverageVerification
- name: Upload Jacoco coverage report
uses: actions/upload-artifact@v2
with:
name: jacoco-report
path: build/reports/jacoco/
- name: Jacoco Report to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 80
title: Code Coverage Report
update-comment: true
- name: Check coverage and fail if below threshold
run: |
overall_coverage=$(echo "${{ steps.jacoco.outputs.coverage-overall }}" | cut -d'.' -f1)
changed_files_coverage=$(echo "${{ steps.jacoco.outputs.coverage-changed-files }}" | cut -d'.' -f1)
if [ $overall_coverage -lt 80 ] || [ $changed_files_coverage -lt 80 ]; then
echo "Coverage is below the required threshold."
echo "Overall coverage: $overall_coverage%"
echo "Changed files coverage: $changed_files_coverage%"
exit 1
fi