[Unit Test] Generate coverage number for UT (#18106)

This commit is contained in:
AichiB7A
2025-04-16 11:55:37 +08:00
committed by GitHub
parent 57b28576f0
commit 2a0d7533d7
5 changed files with 63 additions and 1 deletions

View File

@@ -45,7 +45,17 @@ jobs:
run: uv sync --project api --dev
- name: Run Unit tests
run: uv run --project api bash dev/pytest/pytest_unit_tests.sh
run: |
uv run --project api bash dev/pytest/pytest_unit_tests.sh
# Extract coverage percentage and create a summary
TOTAL_COVERAGE=$(python -c 'import json; print(json.load(open("coverage.json"))["totals"]["percent_covered_display"])')
# Create a detailed coverage summary
echo "### Test Coverage Summary :test_tube:" >> $GITHUB_STEP_SUMMARY
echo "Total Coverage: ${TOTAL_COVERAGE}%" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
uv run --project api coverage report >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Run dify config tests
run: uv run --project api dev/pytest/pytest_config_tests.py