quality(soteria): always emit coverage summary even on earlier gate failures
This commit is contained in:
parent
30dc9a1a6d
commit
b74c5b6ca3
@ -6,6 +6,7 @@ BUILD_DIR="${ROOT_DIR}/build"
|
|||||||
mkdir -p "${BUILD_DIR}"
|
mkdir -p "${BUILD_DIR}"
|
||||||
|
|
||||||
cd "${ROOT_DIR}"
|
cd "${ROOT_DIR}"
|
||||||
|
overall_rc=0
|
||||||
|
|
||||||
echo "[quality] gofmt"
|
echo "[quality] gofmt"
|
||||||
mapfile -t go_files < <(find cmd internal -type f -name '*.go' ! -name '*_test.go' ! -path '*/ui-dist/*' | sort)
|
mapfile -t go_files < <(find cmd internal -type f -name '*.go' ! -name '*_test.go' ! -path '*/ui-dist/*' | sort)
|
||||||
@ -14,49 +15,67 @@ if ((${#go_files[@]})); then
|
|||||||
if [[ -n "${gofmt_diff}" ]]; then
|
if [[ -n "${gofmt_diff}" ]]; then
|
||||||
echo "gofmt check failed. Run: gofmt -w <files>"
|
echo "gofmt check failed. Run: gofmt -w <files>"
|
||||||
echo "${gofmt_diff}"
|
echo "${gofmt_diff}"
|
||||||
exit 1
|
overall_rc=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[quality] structure hygiene"
|
echo "[quality] structure hygiene"
|
||||||
python3 "${ROOT_DIR}/scripts/structure_hygiene_check.py" --root "${ROOT_DIR}"
|
if ! python3 "${ROOT_DIR}/scripts/structure_hygiene_check.py" --root "${ROOT_DIR}"; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] doc hygiene"
|
echo "[quality] doc hygiene"
|
||||||
printf 'failed\n' > "${BUILD_DIR}/docs-naming.status"
|
printf 'failed\n' > "${BUILD_DIR}/docs-naming.status"
|
||||||
python3 "${ROOT_DIR}/scripts/doc_hygiene_check.py" \
|
if python3 "${ROOT_DIR}/scripts/doc_hygiene_check.py" \
|
||||||
--root "${ROOT_DIR}" \
|
--root "${ROOT_DIR}" \
|
||||||
--waivers "${ROOT_DIR}/scripts/doc_hygiene_waivers.tsv"
|
--waivers "${ROOT_DIR}/scripts/doc_hygiene_waivers.tsv"; then
|
||||||
printf 'ok\n' > "${BUILD_DIR}/docs-naming.status"
|
printf 'ok\n' > "${BUILD_DIR}/docs-naming.status"
|
||||||
|
else
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] LOC hygiene"
|
echo "[quality] LOC hygiene"
|
||||||
python3 "${ROOT_DIR}/scripts/loc_hygiene_check.py" \
|
if ! python3 "${ROOT_DIR}/scripts/loc_hygiene_check.py" \
|
||||||
--root "${ROOT_DIR}" \
|
--root "${ROOT_DIR}" \
|
||||||
--max-lines 500 \
|
--max-lines 500 \
|
||||||
--waivers "${ROOT_DIR}/scripts/loc_hygiene_waivers.tsv" \
|
--waivers "${ROOT_DIR}/scripts/loc_hygiene_waivers.tsv" \
|
||||||
--summary-json "${BUILD_DIR}/loc-summary.json"
|
--summary-json "${BUILD_DIR}/loc-summary.json"; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] code smell"
|
echo "[quality] code smell"
|
||||||
bash "${ROOT_DIR}/scripts/code_smell_check.sh"
|
if ! bash "${ROOT_DIR}/scripts/code_smell_check.sh"; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] ui test framework policy"
|
echo "[quality] ui test framework policy"
|
||||||
python3 "${ROOT_DIR}/scripts/ui_test_framework_check.py" --root "${ROOT_DIR}"
|
if ! python3 "${ROOT_DIR}/scripts/ui_test_framework_check.py" --root "${ROOT_DIR}"; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] go vet"
|
echo "[quality] go vet"
|
||||||
go vet ./...
|
if ! go vet ./...; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] unit tests + coverage"
|
echo "[quality] unit tests + coverage"
|
||||||
set +e
|
set +e
|
||||||
go test -json -coverprofile="${BUILD_DIR}/coverage.out" ./... > "${BUILD_DIR}/go-test.json"
|
go test -json -coverprofile="${BUILD_DIR}/coverage.out" ./... > "${BUILD_DIR}/go-test.json"
|
||||||
test_rc=$?
|
test_rc=$?
|
||||||
set -e
|
set -e
|
||||||
|
if [ "${test_rc}" -ne 0 ]; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[quality] coverage hygiene"
|
echo "[quality] coverage hygiene"
|
||||||
python3 "${ROOT_DIR}/scripts/coverage_hygiene_check.py" \
|
if ! python3 "${ROOT_DIR}/scripts/coverage_hygiene_check.py" \
|
||||||
--root "${ROOT_DIR}" \
|
--root "${ROOT_DIR}" \
|
||||||
--coverprofile "${BUILD_DIR}/coverage.out" \
|
--coverprofile "${BUILD_DIR}/coverage.out" \
|
||||||
--min-total 39.5 \
|
--min-total 39.5 \
|
||||||
--baseline "${ROOT_DIR}/scripts/coverage_hygiene_baseline.tsv" \
|
--baseline "${ROOT_DIR}/scripts/coverage_hygiene_baseline.tsv" \
|
||||||
--summary-json "${BUILD_DIR}/coverage-summary.json"
|
--summary-json "${BUILD_DIR}/coverage-summary.json"; then
|
||||||
|
overall_rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
import json
|
import json
|
||||||
@ -79,4 +98,4 @@ if cov_path.exists():
|
|||||||
(build / "quality-summary.json").write_text(json.dumps(summary, indent=2), encoding="utf-8")
|
(build / "quality-summary.json").write_text(json.dumps(summary, indent=2), encoding="utf-8")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
exit "${test_rc}"
|
exit "${overall_rc}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user