Files
davidson-ci/scripts/report.sh
T
pauljd 516ced5f40
pauljd/davidson-ci: Davidson CI / quality (push) Successful in 11s
Add detailed Davidson CI dashboard report
2026-09-08 17:29:59 +01:00

106 lines
2.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -u
SUMMARY_FILE="${GITEA_STEP_SUMMARY:-${GITHUB_STEP_SUMMARY:-}}"
if [ -z "$SUMMARY_FILE" ]; then
echo "No Actions summary file available"
exit 0
fi
PHP_COUNT="${DAVIDSON_PHP_COUNT:-0}"
JS_COUNT="${DAVIDSON_JS_COUNT:-0}"
TS_COUNT="${DAVIDSON_TS_COUNT:-0}"
CSS_COUNT="${DAVIDSON_CSS_COUNT:-0}"
PHP_STATUS="${DAVIDSON_PHP_STATUS:-UNKNOWN}"
JS_STATUS="${DAVIDSON_JS_STATUS:-UNKNOWN}"
CSS_STATUS="${DAVIDSON_CSS_STATUS:-UNKNOWN}"
COMPOSER_AUDIT="${DAVIDSON_COMPOSER_AUDIT:-UNKNOWN}"
NPM_AUDIT="${DAVIDSON_NPM_AUDIT:-UNKNOWN}"
SEMGREP="${DAVIDSON_SEMGREP:-UNKNOWN}"
TRIVY_VULN="${DAVIDSON_TRIVY_VULN:-UNKNOWN}"
TRIVY_SECRET="${DAVIDSON_TRIVY_SECRET:-UNKNOWN}"
SECURITY_STATUS="${DAVIDSON_SECURITY_STATUS:-UNKNOWN}"
status_icon() {
case "$1" in
PASS)
echo "✅ PASS"
;;
FAIL)
echo "❌ FAIL"
;;
SKIP)
echo " SKIP"
;;
*)
echo "⚪ UNKNOWN"
;;
esac
}
OVERALL="PASS"
for status in \
"$PHP_STATUS" \
"$JS_STATUS" \
"$CSS_STATUS" \
"$SECURITY_STATUS"
do
if [ "$status" = "FAIL" ]; then
OVERALL="FAIL"
fi
done
{
echo "# 🛡️ Davidson CI Report"
echo
echo "## Project Detection"
echo
echo "| Language | Files |"
echo "|---|---:|"
echo "| PHP | $PHP_COUNT |"
echo "| JavaScript | $JS_COUNT |"
echo "| TypeScript | $TS_COUNT |"
echo "| CSS | $CSS_COUNT |"
echo
echo "## Quality"
echo
echo "| Module | Status |"
echo "|---|---|"
echo "| PHP | $(status_icon "$PHP_STATUS") |"
echo "| JavaScript / TypeScript | $(status_icon "$JS_STATUS") |"
echo "| CSS | $(status_icon "$CSS_STATUS") |"
echo
echo "## Security"
echo
echo "| Check | Status |"
echo "|---|---|"
echo "| Composer audit | $(status_icon "$COMPOSER_AUDIT") |"
echo "| npm audit | $(status_icon "$NPM_AUDIT") |"
echo "| Semgrep | $(status_icon "$SEMGREP") |"
echo "| Trivy vulnerabilities | $(status_icon "$TRIVY_VULN") |"
echo "| Trivy secrets | $(status_icon "$TRIVY_SECRET") |"
echo
echo "---"
echo
if [ "$OVERALL" = "PASS" ]; then
echo "## ✅ Davidson CI Passed"
echo
echo "No blocking issues were detected."
else
echo "## ❌ Davidson CI Failed"
echo
echo "One or more checks require attention. Open the failed job steps for details."
fi
} >> "$SUMMARY_FILE"
echo "Davidson CI report generated"