feat: auction history 통계 테이블 생성 및 API 구현 #74
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Spring CI for Pull Request | |
| on: | |
| pull_request: | |
| branches: [ dev, main ] | |
| types: [ opened, synchronize, reopened ] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build-and-test: | |
| name: Build, Test, and Upload Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| - name: Run Tests and Generate Coverage | |
| run: ./gradlew clean test jacocoTestReport --no-daemon | |
| - name: Upload Test Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-report | |
| path: build/reports/tests/test/ | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: build/reports/jacoco/test/html/ | |
| - name: Upload JaCoCo report to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: build/reports/jacoco/test/jacocoTestReport.xml | |
| fail_ci_if_error: true | |
| flags: pr | |
| verbose: true | |
| - name: Extract JaCoCo Coverage Percentage | |
| id: coverage | |
| run: | | |
| xml_file="build/reports/jacoco/test/jacocoTestReport.xml" | |
| missed=$(awk -F'"' '/<counter type="LINE"/ {print $4}' "$xml_file") | |
| covered=$(awk -F'"' '/<counter type="LINE"/ {print $6}' "$xml_file") | |
| total=$((missed + covered)) | |
| percent=$(awk "BEGIN { printf \"%.2f\", ($covered / $total) * 100 }") | |
| echo "COVERAGE=$percent" >> "$GITHUB_OUTPUT" | |
| - name: Comment PR with Test and Coverage Result | |
| if: always() | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: test-results | |
| message: | | |
| ### ✅ 테스트 결과 for PR | |
| **Build:** ${{ job.status }} | |
| 🧪 테스트 실행 with Gradle | |
| 📈 **Coverage:** `${{ steps.coverage.outputs.COVERAGE }}%` | |
| 📁 [테스트 결과](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| 📁 [커버리지 보고서 (HTML)](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| - name: Fail PR if tests fail | |
| if: failure() | |
| run: | | |
| echo "❌ Tests failed. Please fix them before merging." | |
| exit 1 |