ci: publish style preflight failures

This commit is contained in:
Brad Stein 2026-05-16 19:15:53 -03:00
parent dfdc5fe566
commit 345b9b6158

View File

@ -13,11 +13,6 @@ PUSHGATEWAY_JOB=${LESAVKA_HYGIENE_GATE_PUSHGATEWAY_JOB:-platform-quality-ci}
mkdir -p "${REPORT_DIR}"
cargo fmt --all -- --check
cargo check --workspace --all-targets
cargo metadata --locked --format-version 1 >"${METADATA_JSON}"
cargo clippy --workspace --all-targets --message-format json -- -D warnings >"${CLIPPY_JSON}"
branch=${BRANCH_NAME:-${GIT_BRANCH:-}}
if [[ -z "${branch}" ]]; then
branch=$(git -C "${ROOT_DIR}" rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)
@ -28,7 +23,37 @@ if [[ -z "${commit}" ]]; then
fi
status=0
python3 - "${CLIPPY_JSON}" "${BASELINE_JSON}" "${SUMMARY_TXT}" "${ROOT_DIR}" "${METRICS_FILE}" "${branch}" "${commit}" <<'PY' || status=$?
if [[ "${status}" -eq 0 ]]; then
cargo fmt --all -- --check || status=$?
fi
if [[ "${status}" -eq 0 ]]; then
cargo check --workspace --all-targets || status=$?
fi
if [[ "${status}" -eq 0 ]]; then
cargo metadata --locked --format-version 1 >"${METADATA_JSON}" || status=$?
fi
if [[ "${status}" -eq 0 ]]; then
cargo clippy --workspace --all-targets --message-format json -- -D warnings >"${CLIPPY_JSON}" || status=$?
fi
if [[ "${status}" -ne 0 ]]; then
cat >"${SUMMARY_TXT}" <<SUMMARY
hygiene gate report
status: failed
branch: ${branch}
commit: ${commit}
The Rust style toolchain failed before the policy analyzer could run.
SUMMARY
cat >"${METRICS_FILE}" <<METRICS
# HELP platform_quality_gate_checks_total Check outcomes from the latest lesavka gate run.
# TYPE platform_quality_gate_checks_total gauge
platform_quality_gate_checks_total{suite="lesavka",branch="${branch}",commit="${commit}",check="style",status="ok"} 0
platform_quality_gate_checks_total{suite="lesavka",branch="${branch}",commit="${commit}",check="style",status="failed"} 1
platform_quality_gate_checks_total{suite="lesavka",branch="${branch}",commit="${commit}",check="loc",status="not_applicable"} 1
METRICS
else
python3 - "${CLIPPY_JSON}" "${BASELINE_JSON}" "${SUMMARY_TXT}" "${ROOT_DIR}" "${METRICS_FILE}" "${branch}" "${commit}" <<'PY' || status=$?
import json
import os
import pathlib
@ -533,6 +558,7 @@ if failed:
print(line, file=sys.stderr)
raise SystemExit(1)
PY
fi
publish_status=0
if [[ -n "${PUSHGATEWAY_URL}" ]]; then