3737 id : pylint
3838 continue-on-error : true
3939 run : |
40- bash tests/python/run_pylint.sh
40+ mkdir -p tests/python/pylint/reports
41+ pylint --rcfile tests/python/.pylintrc infrastructure samples setup shared tests --output-format=colorized,text:tests/python/pylint/reports/latest.txt
4142
4243 - name : Upload pylint reports
4344 if : always()
4647 name : pylint-reports-${{ matrix.python-version }}
4748 path : tests/python/pylint/reports/
4849
49- - name : Summarize pylint rating
50- if : always()
51- id : pylint_summary
52- run : |
53- TEXT_REPORT="tests/python/pylint/reports/latest.txt"
54- if [ -f "$TEXT_REPORT" ]; then
55- SCORE=$(grep -Eo 'Your code has been rated at [0-9.]+/10' "$TEXT_REPORT" | tail -n 1)
56- if [ -z "$SCORE" ]; then
57- SCORE="Pylint score not available"
58- fi
59-
60- echo "score=$SCORE" >> "$GITHUB_OUTPUT"
61- {
62- echo 'summary<<EOF'
63- tail -n 20 "$TEXT_REPORT"
64- echo EOF
65- } >> "$GITHUB_OUTPUT"
66- else
67- echo "score=Pylint report not found" >> "$GITHUB_OUTPUT"
68- echo "summary=Pylint text report missing" >> "$GITHUB_OUTPUT"
69- fi
70-
71- - name : Publish Pylint Results to PR
72- if : always() && github.event_name == 'pull_request'
73- uses : marocchino/sticky-pull-request-comment@v2
74- with :
75- repo-token : ${{ secrets.GITHUB_TOKEN }}
76- header : pylint-${{ matrix.python-version }}
77- message : |
78- ## Python ${{ matrix.python-version }} Pylint Results
79- *Outcome:* `${{ steps.pylint.outcome }}`
80- *Score:* `${{ steps.pylint_summary.outputs.score }}`
81-
82- <details>
83- <summary>Report tail</summary>
84-
85- ```
86- ${{ steps.pylint_summary.outputs.summary }}
87- ```
88-
89- </details>
90-
91- 🔗 [Download reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
92-
9350 - name : Verify bytecode compilation
9451 run : |
9552 python -m compileall infrastructure samples setup shared tests
9956 - name : Run pytest with coverage and generate JUnit XML
10057 id : pytest
10158 run : |
102- PYTHONPATH=$(pwd) COVERAGE_FILE=tests/python/.coverage-${{ matrix.python-version }} pytest --cov=shared/python --cov-config=tests/python/.coveragerc --cov-report=html:tests/python/htmlcov-${{ matrix.python-version }} --junitxml=tests/python/junit-${{ matrix.python-version }}.xml tests/python/
59+ PYTHONPATH=$(pwd) COVERAGE_FILE=tests/python/.coverage-${{ matrix.python-version }} pytest --cov=shared/python --cov-config=tests/python/.coveragerc --cov-report=html:tests/python/htmlcov-${{ matrix.python-version }} --cov-report=term-missing -- junitxml=tests/python/junit-${{ matrix.python-version }}.xml tests/python/
10360 continue-on-error : true
10461
10562 - name : Upload coverage HTML report
@@ -117,12 +74,77 @@ jobs:
11774 name : junit-results-${{ matrix.python-version }}
11875 path : tests/python/junit-${{ matrix.python-version }}.xml
11976
120- - name : Publish Unit Test Results to PR
77+ - name : Extract and Summarize Metrics
78+ if : always()
79+ id : metrics
80+ run : |
81+ # Pylint Score
82+ TEXT_REPORT="tests/python/pylint/reports/latest.txt"
83+ if [ -f "$TEXT_REPORT" ]; then
84+ PYLINT_SCORE=$(grep -Eo 'Your code has been rated at [0-9.]+/10' "$TEXT_REPORT" | grep -Eo '[0-9.]+/10' | head -n 1)
85+ echo "pylint_score=$PYLINT_SCORE" >> "$GITHUB_OUTPUT"
86+ {
87+ echo 'pylint_summary<<EOF'
88+ tail -n 20 "$TEXT_REPORT"
89+ echo EOF
90+ } >> "$GITHUB_OUTPUT"
91+ else
92+ echo "pylint_score=N/A" >> "$GITHUB_OUTPUT"
93+ echo "pylint_summary=No report found" >> "$GITHUB_OUTPUT"
94+ fi
95+
96+ # Coverage Percentage
97+ if [ -f "tests/python/.coverage-${{ matrix.python-version }}" ]; then
98+ TOTAL_COV=$(PYTHONPATH=$(pwd) COVERAGE_FILE=tests/python/.coverage-${{ matrix.python-version }} python -m coverage report | grep TOTAL | awk '{print $NF}')
99+ echo "coverage=$TOTAL_COV" >> "$GITHUB_OUTPUT"
100+ else
101+ echo "coverage=N/A" >> "$GITHUB_OUTPUT"
102+ fi
103+
104+ - name : Publish Consolidated Results to PR
105+ if : always() && github.event_name == 'pull_request'
106+ uses : marocchino/sticky-pull-request-comment@v2
107+ with :
108+ repo-token : ${{ secrets.GITHUB_TOKEN }}
109+ header : python-results-${{ matrix.python-version }}
110+ message : |
111+ ### 🐍 Python ${{ matrix.python-version }} Test Report
112+
113+ | Metric | Status | Value |
114+ | :--- | :---: | :--- |
115+ | **Pylint Score** | ${{ steps.pylint.outcome == 'success' && '✅' || '⚠️' }} | `${{ steps.metrics.outputs.pylint_score }}` |
116+ | **Unit Tests** | ${{ steps.pytest.outcome == 'success' && '✅' || '❌' }} | `${{ steps.pytest.outcome }}` |
117+ | **Code Coverage** | 📊 | `${{ steps.metrics.outputs.coverage }}` |
118+
119+ <details>
120+ <summary>🔍 Pylint Details</summary>
121+
122+ ```
123+ ${{ steps.metrics.outputs.pylint_summary }}
124+ ```
125+ </details>
126+
127+ [Full Workflow Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
128+
129+ - name : Generate Job Summary
130+ if : always()
131+ run : |
132+ echo "## 🐍 Python ${{ matrix.python-version }} Execution Summary" >> $GITHUB_STEP_SUMMARY
133+ echo "" >> $GITHUB_STEP_SUMMARY
134+ echo "| Category | Status | Detail |" >> $GITHUB_STEP_SUMMARY
135+ echo "| :--- | :---: | :--- |" >> $GITHUB_STEP_SUMMARY
136+ echo "| **Pylint** | ${{ steps.pylint.outcome == 'success' && '✅' || '⚠️' }} | Score: `${{ steps.metrics.outputs.pylint_score }}` |" >> $GITHUB_STEP_SUMMARY
137+ echo "| **Pytest** | ${{ steps.pytest.outcome == 'success' && '✅' || '❌' }} | Outcome: `${{ steps.pytest.outcome }}` |" >> $GITHUB_STEP_SUMMARY
138+ echo "| **Coverage** | 📊 | Total: `${{ steps.metrics.outputs.coverage }}` |" >> $GITHUB_STEP_SUMMARY
139+ echo "" >> $GITHUB_STEP_SUMMARY
140+ echo "---" >> $GITHUB_STEP_SUMMARY
141+
142+ - name : Publish Unit Test Results
121143 if : always()
122144 uses : EnricoMi/publish-unit-test-result-action@v2
123145 with :
124146 files : tests/python/junit-${{ matrix.python-version }}.xml
125- comment_title : Python ${{ matrix.python-version }} Test Results
147+ comment_title : Python ${{ matrix.python-version }} Detailed Test Results
126148
127149 # Explicitly fail the job if any test failed (so PRs cannot be merged with failing tests).
128150 # This runs after all reporting steps, meaning coverage and PR comments are always published.
0 commit comments