Skip to content

[FEATURE] 리팩터링 챕터 7 작성 완료 #4

[FEATURE] 리팩터링 챕터 7 작성 완료

[FEATURE] 리팩터링 챕터 7 작성 완료 #4

Workflow file for this run

name: PR Test & Coverage Report
on:
pull_request:
branches:
- main # 필요시 변경
jobs:
test:
name: Run Tests & Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install Poetry
run: |
pipx install poetry
- name: Install dependencies
run: |
poetry install --no-root
- name: Run Tests (by Makefile)
run: |
poetry run make test
- name: Combine Coverage Report (XML)
run: |
poetry run coverage xml -o coverage.xml
- name: Parse Coverage and Write Summary
run: |
poetry run python -c "
import xml.etree.ElementTree as ET
tree = ET.parse('coverage.xml')
root = tree.getroot()
line_rate = float(root.attrib['line-rate'])
percentage = line_rate * 100
with open('${{ github.step_summary }}', 'a') as f:
f.write('| Metric | Value |\n')
f.write('|--------|-----|\n')
f.write(f'| 📊 Line Coverage | {percentage:.2f}% |\n')
"
- name: Publish Test Results Summary
uses: test-summary/action@v2
with:
paths: "test-results/*.xml"
if: always()
- name: Upload Coverage HTML Report
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov/
- name: Upload JUnit XML (for archive)
uses: actions/upload-artifact@v4
with:
name: junit-xml-reports
path: test-results/
- name: Add Coverage Comment to PR
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
## 📝 Coverage Report
| Metric | Value |
|--------|-----|
| 📊 Line Coverage | ${PERCENTAGE}% |
if: github.event_name == 'pull_request'