hololake-system-architecture/product-source/hololake-platform/scripts/test-guanghu-native-authority.sh

55 lines
1.8 KiB
Shell
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
repository_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
active_authority_surfaces=(
"AGENTS.md"
".github/HOOKS.md"
".github/SETUP.md"
".github/workflows/ci.yml"
".github/workflows/README.md"
".husky/pre-push"
"scripts/run-hololake-native-quality-gate.sh"
".claude/settings.local.json"
".chunk/config.json"
".chunk/README.md"
".chunk/run-rust-gate.sh"
"vite.config.ts"
"scripts/run-vitest-coverage-shards.mjs"
"src/components/FeedbackDialog.tsx"
"src/components/FeedbackDialog.test.tsx"
"src/constants/feedback.ts"
"tests/smoke/contribute-modal.spec.ts"
"site/reference/contribute.md"
"site/public/landing/sponsors/SOURCES.md"
"src-tauri/resources/agent-docs/pages/reference/contribute.md"
"docs/GETTING-STARTED.md"
)
existing_surfaces=()
for relative_path in "${active_authority_surfaces[@]}"; do
if [[ -e "${repository_root}/${relative_path}" ]]; then
existing_surfaces+=("${repository_root}/${relative_path}")
fi
done
if grep -Ein 'codescene|codacy|codecov' "${existing_surfaces[@]}"; then
echo "third-party quality authority remains on an active HoloLake surface" >&2
exit 1
fi
if grep -Ein \
'fail-under-(lines|functions)[[:space:]]+(70|85)|coverage[^[:cntrl:]]*(>=|≥)[[:space:]]*(70|85)%|threshold[^[:cntrl:]]*(70|85)' \
"${existing_surfaces[@]}"; then
echo "partial percentage quality authority remains on an active HoloLake surface" >&2
exit 1
fi
grep -Fq 'GLS-0844' "${repository_root}/AGENTS.md"
grep -Fq 'GHNQG_PASS_100' "${repository_root}/.husky/pre-push"
grep -Fq 'run-hololake-native-quality-gate.sh' "${repository_root}/.husky/pre-push"
grep -Fq 'run-hololake-native-quality-gate.sh' "${repository_root}/.github/workflows/ci.yml"
grep -Fq 'test:native-authority' "${repository_root}/.github/workflows/ci.yml"
echo "GUANGHU_NATIVE_AUTHORITY_OK"