chore: Refine CI workflow output handling for linting and type-checking
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m42s
CI / lint-and-type-check (pull_request) Successful in 2m21s
CI / python-lint (pull_request) Successful in 2m7s
CI / test-backend (pull_request) Successful in 5m12s
CI / build (pull_request) Successful in 4m45s
CI / secret-scanning (pull_request) Successful in 1m48s
CI / dependency-scan (pull_request) Successful in 1m47s
CI / sast-scan (pull_request) Successful in 2m54s
CI / workflow-summary (pull_request) Successful in 1m39s

This commit improves the CI workflow by modifying the output handling for linting and type-checking processes. It ensures that the results are captured correctly and displayed only if there are errors or warnings, enhancing clarity in the CI logs. Additionally, it updates the flake8 output section to provide a summary when no issues are found, further improving the visibility of code quality checks.
This commit is contained in:
Tanya 2026-01-16 15:39:32 -05:00
parent edfefb3f00
commit 5073c22f03

View File

@ -109,7 +109,7 @@ jobs:
id: eslint-check
run: |
cd admin-frontend
npm run lint 2>&1 | tee /tmp/eslint-output.txt || true
npm run lint > /tmp/eslint-output.txt 2>&1 || true
continue-on-error: true
- name: Install viewer-frontend dependencies
@ -133,7 +133,7 @@ jobs:
id: type-check
run: |
cd viewer-frontend
npm run type-check 2>&1 | tee /tmp/typecheck-output.txt || true
npm run type-check > /tmp/typecheck-output.txt 2>&1 || true
continue-on-error: true
- name: Check for lint/type-check failures
@ -155,12 +155,12 @@ jobs:
echo "✅ ESLint check passed (warnings may be present)"
fi
if [ -f /tmp/eslint-output.txt ]; then
echo ""
echo "### ESLint Output:"
echo "```"
echo ""
echo "### ESLint Output:"
if [ -f /tmp/eslint-output.txt ] && [ -s /tmp/eslint-output.txt ]; then
cat /tmp/eslint-output.txt
echo "```"
else
echo "No errors or warnings found."
fi
echo ""
@ -176,12 +176,12 @@ jobs:
echo "✅ Type check passed"
fi
if [ -f /tmp/typecheck-output.txt ]; then
echo ""
echo "### Type Check Output:"
echo "```"
echo ""
echo "### Type Check Output:"
if [ -f /tmp/typecheck-output.txt ] && [ -s /tmp/typecheck-output.txt ]; then
cat /tmp/typecheck-output.txt
echo "```"
else
echo "No errors found."
fi
echo ""
@ -248,9 +248,7 @@ jobs:
if [ -f /tmp/python-syntax-output.txt ] && [ -s /tmp/python-syntax-output.txt ]; then
echo ""
echo "### Syntax Check Output:"
echo "```"
cat /tmp/python-syntax-output.txt
echo "```"
fi
echo ""
@ -266,23 +264,25 @@ jobs:
echo "✅ Flake8 check passed (warnings may be present)"
fi
if [ -f /tmp/flake8-output.txt ]; then
if [ -f /tmp/flake8-output.txt ] && [ -s /tmp/flake8-output.txt ]; then
echo ""
echo "### Flake8 Output (errors and warnings):"
echo "```"
cat /tmp/flake8-output.txt
echo "```"
# Count errors and warnings
ERROR_COUNT=$(grep -c "^backend/.*:.*:.* E[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
WARNING_COUNT=$(grep -c "^backend/.*:.*:.* W[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
F_COUNT=$(grep -c "^backend/.*:.*:.* F[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
ERROR_COUNT=$(grep -cE "^backend/.*:.*:.* E[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
WARNING_COUNT=$(grep -cE "^backend/.*:.*:.* W[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
F_COUNT=$(grep -cE "^backend/.*:.*:.* F[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
echo ""
echo "### Summary Statistics:"
echo "- Errors (E*): $ERROR_COUNT"
echo "- Warnings (W*): $WARNING_COUNT"
echo "- Pyflakes (F*): $F_COUNT"
else
echo ""
echo "### Flake8 Output:"
echo "No errors or warnings found."
fi
echo ""