From 5073c22f0344139abf66dac2047ad4f55a3c760e Mon Sep 17 00:00:00 2001 From: Tanya Date: Fri, 16 Jan 2026 15:39:32 -0500 Subject: [PATCH] chore: Refine CI workflow output handling for linting and type-checking 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. --- .gitea/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index bb6183f..e45e09d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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 ""