3636 run : |
3737 python -m pip install --upgrade pip wheel setuptools
3838 # Install package in development mode with all extras
39- pip install -e ".[dev,test,ci,doc]"
40- # Explicitly install PyYAML to ensure it's available
41- python -m pip install PyYAML
39+ pip install -e ".[all]"
4240
4341 # Step 4: Run unit tests
4442 - name : Run unit tests
@@ -55,20 +53,15 @@ jobs:
5553 --self-contained-html \
5654 --junitxml=junit/test-results.xml || echo "::warning::Tests had failures"
5755
58- - name : Debug reports directory after pytest
59- run : |
60- echo "Contents of reports/html after pytest:"
61- find reports/html
62- ls -l reports/html/pytest_report_3.8.html || true
63- head -20 reports/html/pytest_report_3.8.html || true
64-
6556 # Step 5: Test multiprocessing capability
6657 - name : Test multiprocessing capability
58+ if : matrix.python-version == '3.10'
6759 run : |
6860 python example/log_sequence_test.py
6961
7062 # Step 6: Test logging performance
7163 - name : Test logging performance
64+ if : matrix.python-version == '3.10'
7265 run : |
7366 python benchmark/performance_test_multiprocessing.py > reports/performance_py${{ matrix.python-version }}.txt
7467 MSGS_PER_SEC=$(grep -oP '(?<=Messages per second: )[0-9.]+' reports/performance_py${{ matrix.python-version }}.txt || echo "0")
@@ -87,13 +80,13 @@ jobs:
8780 run : |
8881 mkdir -p reports/badges
8982 COVERAGE="0.0"
90-
83+
9184 # Check if coverage.xml exists and extract the line-rate properly
9285 if [ -f coverage.xml ]; then
9386 # Extract coverage data more reliably
9487 COVERAGE=$(python -c "import xml.etree.ElementTree as ET; root = ET.parse('coverage.xml').getroot(); print(root.get('line-rate', '0.0'))")
9588 echo "Found raw coverage value: $COVERAGE"
96-
89+
9790 # Verify the extracted data
9891 if [[ ! $COVERAGE =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
9992 echo "Warning: Invalid coverage data extracted, using default"
@@ -102,21 +95,21 @@ jobs:
10295 else
10396 echo "Warning: coverage.xml file not found"
10497 fi
105-
98+
10699 # Calculate percentage
107100 COVERAGE_PCT=$(python -c "print(round(float('$COVERAGE') * 100, 1))")
108101 echo "Calculated coverage percentage: $COVERAGE_PCT%"
109-
102+
110103 # Determine color
111104 COLOR=$(python -c "c=float('$COVERAGE_PCT'); print('red' if c < 50 else 'yellow' if c < 80 else 'green')")
112-
105+
113106 # Store in environment and summary
114107 echo "COVERAGE_PCT=$COVERAGE_PCT" >> $GITHUB_ENV
115108 echo "## Test Coverage: $COVERAGE_PCT%" >> $GITHUB_STEP_SUMMARY
116-
109+
117110 # Generate badge
118111 anybadge --label="coverage-py${{ matrix.python-version }}" --value=$COVERAGE_PCT --file=reports/badges/coverage-py${{ matrix.python-version }}.svg --suffix=% 50=red 60=orange 80=yellow 100=green
119-
112+
120113 # Verify badge was created
121114 ls -la reports/badges/
122115
@@ -162,12 +155,39 @@ jobs:
162155 </html>
163156 EOF
164157
165- # Step 10: Run code style checks (Black and Flake8)
158+ # Step 10: Run code style checks (Black and Flake8) and create badges
166159 - name : Run code style checks
167160 continue-on-error : true
168161 run : |
169- python -m black --check prismalog tests || echo "::warning::Black formatting check failed"
162+ # Run black check and store exit code
163+ python -m black --check prismalog tests
164+ BLACK_EXIT=$?
165+ if [ $BLACK_EXIT -eq 0 ]; then
166+ BLACK_STATUS="passing"
167+ BLACK_COLOR="green"
168+ else
169+ BLACK_STATUS="failing"
170+ BLACK_COLOR="red"
171+ echo "::warning::Black formatting check failed"
172+ fi
173+
174+ # Run flake8 and store exit code
170175 python -m flake8 prismalog --count --select=E9,F63,F7,F82 --show-source --statistics
176+ FLAKE_EXIT=$?
177+ if [ $FLAKE_EXIT -eq 0 ]; then
178+ FLAKE_STATUS="passing"
179+ FLAKE_COLOR="green"
180+ else
181+ FLAKE_STATUS="failing"
182+ FLAKE_COLOR="red"
183+ fi
184+
185+ # Generate badges
186+ anybadge --label="black" --value=$BLACK_STATUS --file=reports/badges/black-py${{ matrix.python-version }}.svg --color=$BLACK_COLOR
187+ anybadge --label="flake8" --value=$FLAKE_STATUS --file=reports/badges/flake8-py${{ matrix.python-version }}.svg --color=$FLAKE_COLOR
188+
189+ # List generated badges
190+ ls -la reports/badges/
171191
172192 # Step 11: Check memory footprint
173193 - name : Check memory footprint
@@ -294,6 +314,24 @@ jobs:
294314 <p><a href="../../htmlcov/index.html">HTML Coverage Report</a></p>
295315 </div>
296316
317+ <div class="card">
318+ <h2>Code Quality Badges (Markdown)</h2>
319+ <p class="markdown-badges">
320+ <a href="reports/html/3.8/index.html"><img src="badges/coverage-py3.8.svg" alt="Coverage Python 3.8"></a>
321+ <a href="reports/html/3.8/reports/pylint/pylint-py3.8.html"><img src="badges/pylint-py3.8.svg" alt="Pylint Python 3.8"></a>
322+ <a href="reports/html/3.8/index.html"><img src="badges/black-py3.8.svg" alt="Black Python 3.8"></a>
323+ <a href="reports/html/3.8/index.html"><img src="badges/flake8-py3.8.svg" alt="Flake8 Python 3.8"></a>
324+ <a href="reports/html/3.10/index.html"><img src="badges/coverage-py3.10.svg" alt="Coverage Python 3.10"></a>
325+ <a href="reports/html/3.10/reports/pylint/pylint-py3.10.html"><img src="badges/pylint-py3.10.svg" alt="Pylint Python 3.10"></a>
326+ <a href="reports/html/3.10/index.html"><img src="badges/black-py3.10.svg" alt="Black Python 3.10"></a>
327+ <a href="reports/html/3.10/index.html"><img src="badges/flake8-py3.10.svg" alt="Flake8 Python 3.10"></a>
328+ <a href="reports/html/3.11/index.html"><img src="badges/coverage-py3.11.svg" alt="Coverage Python 3.11"></a>
329+ <a href="reports/html/3.11/reports/pylint/pylint-py3.11.html"><img src="badges/pylint-py3.11.svg" alt="Pylint Python 3.11"></a>
330+ <a href="reports/html/3.11/index.html"><img src="badges/black-py3.11.svg" alt="Black Python 3.11"></a>
331+ <a href="reports/html/3.11/index.html"><img src="badges/flake8-py3.11.svg" alt="Flake8 Python 3.11"></a>
332+ </p>
333+ </div>
334+
297335 <p class="timestamp">Generated: $(date -u "+%Y-%m-%d %H:%M:%S UTC")</p>
298336 </body>
299337 </html>
@@ -488,10 +526,16 @@ jobs:
488526 <p class="markdown-badges">
489527 <a href="reports/html/3.8/index.html"><img src="badges/coverage-py3.8.svg" alt="Coverage Python 3.8"></a>
490528 <a href="reports/html/3.8/reports/pylint/pylint-py3.8.html"><img src="badges/pylint-py3.8.svg" alt="Pylint Python 3.8"></a>
529+ <a href="reports/html/3.8/index.html"><img src="badges/black-py3.8.svg" alt="Black Python 3.8"></a>
530+ <a href="reports/html/3.8/index.html"><img src="badges/flake8-py3.8.svg" alt="Flake8 Python 3.8"></a>
491531 <a href="reports/html/3.10/index.html"><img src="badges/coverage-py3.10.svg" alt="Coverage Python 3.10"></a>
492532 <a href="reports/html/3.10/reports/pylint/pylint-py3.10.html"><img src="badges/pylint-py3.10.svg" alt="Pylint Python 3.10"></a>
533+ <a href="reports/html/3.10/index.html"><img src="badges/black-py3.10.svg" alt="Black Python 3.10"></a>
534+ <a href="reports/html/3.10/index.html"><img src="badges/flake8-py3.10.svg" alt="Flake8 Python 3.10"></a>
493535 <a href="reports/html/3.11/index.html"><img src="badges/coverage-py3.11.svg" alt="Coverage Python 3.11"></a>
494536 <a href="reports/html/3.11/reports/pylint/pylint-py3.11.html"><img src="badges/pylint-py3.11.svg" alt="Pylint Python 3.11"></a>
537+ <a href="reports/html/3.11/index.html"><img src="badges/black-py3.11.svg" alt="Black Python 3.11"></a>
538+ <a href="reports/html/3.11/index.html"><img src="badges/flake8-py3.11.svg" alt="Flake8 Python 3.11"></a>
495539 </p>
496540 </div>
497541 </body>
@@ -525,6 +569,8 @@ jobs:
525569 <h2>Code Quality</h2>
526570 <div class="badge"><img src="../../../badges/pylint-py$version.svg" alt="Pylint Score"></div>
527571 <div class="badge"><img src="../../../badges/coverage-py$version.svg" alt="Coverage"></div>
572+ <div class="badge"><img src="../../../badges/black-py$version.svg" alt="Black Format"></div>
573+ <div class="badge"><img src="../../../badges/flake8-py$version.svg" alt="Flake8"></div>
528574 <ul>
529575 <li><a href="reports/pylint/pylint-py$version.html">View Detailed Pylint Report</a></li>
530576 </ul>
0 commit comments